Response messages

The shared localized response-message contract for CTX actions and Storefront GraphQL.

Response messages#

CTX actions and Storefront GraphQL mutation payloads use a shared code-first response-message contract. Clients branch on code; human-facing text comes from message in the resolved locale.

Field

Contract

code

Stable machine-readable result code. This is the durable integration contract.

message

Localized human text for the resolved response locale. Do not branch application logic on this field.

locale

Locale used to resolve the message.

params

Sorted key/value placeholders used to render the localized message.

graphql
type ResponseMessage {
  code: String!
  message: String!
  locale: String!
  params: [ResponseParam!]!
}

type ResponseParam {
  key: String!
  value: String!
}
json
{
  "response": {
    "code": "STOREFRONT_CUSTOMER_LOGIN_SUCCESS",
    "message": "Signed in successfully.",
    "locale": "en",
    "params": []
  }
}