Menu
Commercetools
Commercetools' GraphQL API — one action per Query/Mutation for products, carts, orders, customers, prices, and discounts. Covers the OAuth client-credentials connection and endpoint, the editable query / Variables model, the two-level data / errors response, version-based optimistic concurrency, update actions, localized text, and where/limit/offset pagination. Every action is documented in the action reference.
Browse 257 Commercetools actions Api · As · Associate · Attribute · Bulk · Business · +54 moreOn this page
What this connector is
Commercetools is a headless, composable commerce platform. This connector wraps
its GraphQL API — one endpoint (/{project-key}/graphql) that serves every
resource: products, categories, carts, orders, customers, inventory, prices,
discounts, quotes, and B2B business units.
It is generated from commercetools' published GraphQL schema — one action per
Query or Mutation root field. commercetools' mcpServer* operations (its own
MCP-server management, not commerce) and any @deprecated fields are left
out.
Browse every action, grouped by resource, in the action reference. Each action page shows its default query, typed variables with an example, and the response fields.
Connecting
Every action uses a Commercetools connection. In commercetools' Merchant Center, go to Settings → Developer settings → API clients, create an API client, and copy its details before you close the dialog (the secret is shown only once). The connection asks for:
- Region — the host segment for your project, e.g.
europe-west1.gcp,us-central1.gcp,australia-southeast1.gcp,eu-central-1.aws,us-east-2.aws. It's the part betweenapi./auth.and.commercetools.comin the URLs the Merchant Center shows you. - Project key — your commercetools project key.
- Client ID and Client Secret — from the API client.
- Scopes — optional, space-separated. Defaults to
manage_project:<project-key>; set granular scopes here instead if your API client is scoped down (e.g.manage_products:acme view_orders:acme).
The connector mints an OAuth2 client-credentials token from
https://auth.<region>.commercetools.com/oauth/token, caches it, and
refreshes it automatically shortly before it expires (commercetools tokens
last ~2 days) — the same token lifecycle the Elastic Path connection uses. The
token is sent as Authorization: Bearer <token>.
The GraphQL endpoint —
https://api.<region>.commercetools.com/<project-key>/graphql — is filled in
from the connection's region and project key automatically. Override the
Endpoint field on an action only to point at a different project.
How the actions work
Each action wraps one GraphQL operation:
- GraphQL Query — the query/mutation document, pre-filled and fully
editable. The generated selection set is nested up to 3 levels and omits
fields that take their own arguments (localized text, expandable references,
nested pagination) — edit it to add
name(locale: "en-US"), expand a{ typeId, id }reference, or selectresults { ... }on a list query. - Variables — one multi-line field for the whole
variablesobject, with the usual parameter picker to wire in values with{{<stepReference>.field.path}}. It is pre-filled with a skeleton of every declared argument. For update mutations the skeleton'sactionsarray lists every possible update action in one object — replace it with an array where each element has exactly one update-action key (see "Update actions"). Once references resolve it must be valid JSON. - Endpoint — your project's GraphQL URL (see above).
- Additional Headers, Forward All Headers — as on every connector.
If you edit the query to add or rename variables, keep Variables in sync —
they are sent together as { query, variables }.
Reading the response
Every action's result is at {{<stepReference>.response...}} (see Step
Reference): {{<stepReference>.response.status}},
{{<stepReference>.response.headers.<name>}}, and
{{<stepReference>.response.data...}} for the body.
The body is the raw GraphQL HTTP response, so there are two levels of
data:
- The operation result —
{{<stepReference>.response.data.data.<fieldName>}}. A step named "Get Product" (referencegetProduct) running theproductquery resolves the product at{{getProduct.response.data.data.product.id}}. A list query resolves as{{getProducts.response.data.data.products.results}}(an array) plus.total,.count,.offset. - GraphQL errors — a top-level
errorsarray (unknown field, missing scope, validation problem, staleversion) fails the step. Details at{{<stepReference>.response.data.errors}}(each{ message, path, locations, extensions });extensions.codeidentifies the problem. Turn on Continue on Error to inspect the errors and branch instead of stopping.
commercetools does not use Shopify's userErrors pattern — a mutation
either returns the resource under data.<mutationName> or reports the problem
in errors.
Optimistic concurrency (version)
Every commercetools resource carries an integer version that increments on
each change. Update and delete mutations require the current version:
mutation UpdateProduct($id: String!, $version: Long!, $actions: [ProductUpdateAction!]!) {
updateProduct(id: $id, version: $version, actions: $actions) {
id
version
}
}
Pass a stale version and the mutation fails with an error. Read the resource
immediately before the mutation and pass
{{getProduct.response.data.data.product.version}} so the two steps agree.
Update actions
commercetools has no PATCH-style partial update — every change is one or more update actions passed as an array. Each array element is an object with exactly one key, the action name, whose value is that action's parameters:
{
"id": "a1b2c3d4-....",
"version": 7,
"actions": [
{ "changeName": { "name": { "en-US": "New name" }, "staged": false } },
{ "setDescription": { "description": { "en-US": "..." }, "staged": false } },
{ "publish": { "scope": "All" } }
]
}
The Variables skeleton collapses all the possible actions for a resource into
one object so you can see what's available — delete the ones you don't need and
split the rest into separate { ... } elements. commercetools' API reference
lists every update action per resource (Products, Carts, Orders, Customers, …).
Identifiers, keys, and references
idis a plain UUID (a1b2c3d4-e5f6-...), not agid://global id.- Most resources also accept a user-defined
key— many queries and mutations take either, e.g.product(id: "...")orproduct(key: "my-sku"),updateCategory(key: "...", version: ..., actions: [...]). - References in responses come back as
{ "typeId": "product", "id": "..." }. To get the referenced object's own fields, expand the reference in the query — e.g.lineItems { productId name(locale:"en") variant { sku } }rather than justlineItems { productId }.
Localized text
LocalizedString fields (name, description, slug, metaTitle, …)
either take a locale argument or return an array of { locale, value }. The
generated selection set does not add locale: arguments, so edit the query:
name(locale: "en-US") for a single string, or nameAllLocales { locale value }
for every translation. On write, a localized value is a JSON object keyed by
locale: { "en-US": "Hat", "de-DE": "Hut" }.
Pagination and filtering
List queries (products, orders, customers, categories, …) take:
limit(default 20, max 500) andoffset(max 10000) — or, for deep pagination, sort byidand use awherepredicate onidinstead of a large offset.sort— an array of strings, e.g.["createdAt desc", "id asc"].where— a commercetools Query Predicate string, e.g.where: "masterData(current(masterVariant(sku = \"ABC-1\")))"orwhere: "orderState = \"Open\" and createdAt > \"2026-01-01T00:00:00.000Z\"".
Responses are { results, total, count, offset, exists } — not Relay-style
edges/node. Add results { ... } to the query's selection set (the
generator leaves it out because it's an argument-bearing connection).
Store and customer scope
inStore(key: "uk")/inStores(keys: [...])wrap store-scoped reads and writes — the fields you select inside them are the same, but limited to that store's carts, orders, customers, and product selections.me { ... }and the*My*mutations (createMyCart,updateMyCustomer,createMyOrderFromCart, …) are customer-scoped and need a customer's password-flow token, which a client-credentials connection cannot issue. Use the admin equivalents instead:customer/customers,cart/carts,createOrderFromCart,updateCustomer.
Common operations
- Publish a product —
updateProductwith a{ "publish": { "scope": "All" } }update action. Products havemasterData { current { ... } staged { ... } }. - Cart to order —
createCart→updateCart(add line items, set addresses, apply discount codes) →createOrderFromCart. - Sign up a customer —
customerSignUpcreates the customer and returns{ customer, cartId }. - Search —
productProjectionSearchandproductsSearchdo full-text and faceted search.
Not sure which action?
Open the action reference and search or filter by resource (Product, Cart, Order, Customer, …). Action names are the GraphQL field names exactly. The most common actions:
- Products: product, products, createProduct, updateProduct, productProjectionSearch, createCategory
- Carts and orders: createCart, updateCart, createOrderFromCart, order, orders, updateOrder
- Customers and stock: customer, customers, customerSignUp, updateCustomer, inventoryEntries
Also applies here
Step Name
What it's for
Every step in a workflow gets a name — either one you set or a default based on the connector and action (e.g. "Get Order Details", "Send Welcome Email"). It's shown throughout the UI and in your execution history, and it's also the source for the step's Reference — a camelCase identifier auto-generated from the name (e.g. "Get Order Details" → getOrderDetails) — which is what you actually use in {{...}} expressions to read this step's output from later steps. See Step Reference.
Rules
- Must be at least 2 characters, and 50 characters or fewer.
- Must be unique within the workflow — reusing a name that's already taken will be rejected, with a suggested alternative (e.g.
"Get Order Details 2"). - Can't be empty.
Tips
- Prefer a descriptive, human-readable name over a generic one — "Get Order Details" is easier to work with later than "HTTP Request 2", especially once a workflow has a dozen steps.
- Renaming a step updates every reference to it elsewhere in the workflow automatically.
Step Reference
Syntax
Any input field can reference earlier data using {{expression}}. The expression is evaluated as JSONata — so simple dot-paths and more advanced queries (filters, functions) both work.
Referencing a step's output
Use the step's Reference — a camelCase identifier auto-generated from its Name (e.g. "Get Order Details" → getOrderDetails), shown read-only wherever the step's fields are configured — followed by the field path. Elsewhere in these docs this general pattern is written as {{<stepReference>.field.path}}:
{{getOrderDetails.response.data.id}}
{{getOrderDetails.response.status}}
The raw display name won't work here even though it's what you see in the UI — {{Get Order Details.response.data.id}} isn't valid, since a bare name containing spaces isn't a single JSONata identifier. Always use the camelCase Reference.
You can also reference steps by position instead of by reference:
{{steps[0].response.data.id}}
Referencing trigger data
{{trigger.headers.authorization}}
{{trigger.body.customerId}}
{{trigger.query.page}}
{{trigger.params.orderId}}
{{trigger.method}}
{{trigger.path}}
Referencing workflow variables
{{variables.myVariable}}
See Variables for the full list of variable types and more examples, including connection-type variables.
Referencing runtime variables
A separate, mutable namespace written by the Variable connector while a run is in progress — not the same as the workflow-level variables above:
{{runtimeVariables.myVariable}}
Notes
- If an expression can't be resolved (a typo in a step name, a field that doesn't exist), it resolves to an empty string rather than failing the workflow — check your execution history if a value comes through blank.
- Object values are automatically JSON-stringified when interpolated into a string field.
Execution Settings
Fire-and-forget
When enabled, the workflow doesn't wait for this step to complete before moving to the next one. Use it for steps whose result nothing downstream depends on — logging, analytics, notifications — so they don't add latency to the steps that matter.
Continue on error
When enabled, a failure in this step doesn't stop the workflow — execution continues to the next step. The failure is still recorded in the execution history; this just controls whether it's fatal.
Combine the two for steps that are genuinely optional to the outcome: fire-and-forget so they don't add latency, continue-on-error so a failure in them (e.g. an analytics endpoint being briefly down) doesn't take down an otherwise-successful workflow run.
Caching
What it does
When enabled, a step's result is cached for a configurable TTL (time-to-live, in seconds). If the step runs again with the same effective cache key before the TTL expires, the cached result is returned instead of re-running the step.
Configuring it
- Enabled — turn caching on or off for this step.
- TTL — how long (in seconds) a cached result stays valid.
- Cache key template — an expression (supporting the same
{{...}}step reference syntax used elsewhere) that determines what counts as "the same call". By default this is based on the step's resolved input; a custom template lets you cache more narrowly or broadly than that.
When to use it
Good candidates are steps that call something slow or rate-limited but return the same answer for the same input within a short window — a lookup against a rarely-changing external system, for example. Skip it for steps whose result must always be fresh (anything involving live inventory, pricing, or payment state).
Locking
What it does
When enabled, only one execution of this step (for a given lock key) can run at a time. If a second execution tries to run the same step while a lock is held, it waits until the lock is released or the hold period elapses.
Configuring it
- Enabled — turn locking on or off for this step.
- Lock key — an expression (supporting the same
{{...}}step reference syntax used elsewhere) that determines what counts as "the same resource". By default the lock is scoped to the step itself; a custom key lets you lock per-customer, per-order, or any other identifier that needs serialized access. - Period — how long (in seconds) the lock is held before it's automatically released, in case an execution doesn't complete normally.
When to use it
Use it whenever concurrent executions could race on the same resource — e.g. two workflow runs both trying to update the same order's status at once. A lock key scoped to the order id ensures only one of them proceeds at a time.
Last updated 9 October 2026