Customer labels
Read the available customer labels and set label values on a customer.
List customer labels
/customer-labels
Scope: customers.read
Returns all customer labels with their values, sorted by label name. Labels are set on a
customer by the ID of a value (values[].id), not by the label ID.
Example request
curl "https://shop.example.com/api/v1/customer-labels" \
-H "Authorization: Bearer $API_KEY" \
-H "Accept: application/json" Responses
200 OK All customer labels with their values.
{
"data": [
{
"id": 4,
"name": "Interests",
"active": true,
"values": [
{
"id": 31,
"value": "Running",
"color": "#2e7d32",
"active": true
},
{
"id": 32,
"value": "Yoga",
"color": null,
"active": true
}
]
}
]
} Response fields
| Field | Type | Required | Description |
|---|---|---|---|
data[] | array of object | required | |
id | integer | required | ID of the label. |
name | string | required | |
active | boolean | required | |
values[] | array of object | required | |
id | integer | required | ID of the value. Use it in value_ids and in removeCustomerLabel. |
value | string | required | |
color | string | null | required | Display color, for example #2e7d32. |
active | boolean | required |
Error responses
401 Unauthorized The API key is missing, malformed, wrong, paused, expired or revoked. The body is always the same and never names the reason.
{
"error": {
"code": "unauthorized",
"message": "Invalid or missing API key.",
"details": []
}
} 403 Forbidden The API key is valid but lacks a scope this endpoint needs. details.required lists the scopes
the endpoint requires, details.missing the ones your key lacks. Ask the shop operator to add
the scope.
{
"error": {
"code": "insufficient_scope",
"message": "The API key is missing a required scope.",
"details": {
"required": [
"orders.write"
],
"missing": [
"orders.write"
]
}
}
} 404 Not Found The path does not exist, the API is not enabled on this system, the order does not belong to the shop of your API client, or the customer, address or label value is not known to your API client.
{
"error": {
"code": "not_found",
"message": "The requested resource does not exist.",
"details": []
}
} 429 Too Many Requests Too many requests. Either your API client used up its requests per minute
(message Too many requests., with all rate limit headers), or too many failed authentications
came in a short time (message Too many authentication attempts., only Retry-After). Both
carry the code rate_limited.
{
"error": {
"code": "rate_limited",
"message": "Too many requests.",
"details": []
}
} 500 Internal Server Error An unexpected error occurred on our side. Retry later.
{
"error": {
"code": "server_error",
"message": "An unexpected error occurred.",
"details": []
}
} All error codes: error code reference.
Set label values on a customer
/customers/{externalId}/labels
Scope: customers.write
Sets label values on the customer. With mode: add (default) the values are added and values
already set stay. With mode: replace exactly these values are set afterwards and all others
are removed; "value_ids": [] removes all. A value that is already set is never set twice.
The response lists all label values set on the customer afterwards, sorted by ID.
Path parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
externalId | string | required | Your customer ID, as sent in customer.external_id. Case-sensitive. URL-encode special characters. max length 191 |
Request body
| Field | Type | Required | Description |
|---|---|---|---|
mode | string | null | optional | add adds the values and keeps the others; replace sets exactly these values and removes all others. one of: add, replace, null · default "add" |
value_ids | array of integer | required | IDs of label values (values[].id from listCustomerLabels). Must be present, may be empty; no duplicates. max 200 items |
Example request
curl -X PUT "https://shop.example.com/api/v1/customers/u-55871/labels" \
-H "Authorization: Bearer $API_KEY" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{
"mode": "add",
"value_ids": [
31,
32
]
}' Responses
200 OK The label values now set on the customer.
{
"data": {
"customer_id": 9021,
"value_ids": [
31,
32
]
}
} Response fields
| Field | Type | Required | Description |
|---|---|---|---|
data | object | required | |
customer_id | integer | required | Our customer number. |
value_ids | array of integer | required | All label value IDs set on the customer after the change, ascending. |
Error responses
401 Unauthorized The API key is missing, malformed, wrong, paused, expired or revoked. The body is always the same and never names the reason.
{
"error": {
"code": "unauthorized",
"message": "Invalid or missing API key.",
"details": []
}
} 403 Forbidden The API key is valid but lacks a scope this endpoint needs. details.required lists the scopes
the endpoint requires, details.missing the ones your key lacks. Ask the shop operator to add
the scope.
{
"error": {
"code": "insufficient_scope",
"message": "The API key is missing a required scope.",
"details": {
"required": [
"orders.write"
],
"missing": [
"orders.write"
]
}
}
} 404 Not Found The path does not exist, the API is not enabled on this system, the order does not belong to the shop of your API client, or the customer, address or label value is not known to your API client.
{
"error": {
"code": "not_found",
"message": "The requested resource does not exist.",
"details": []
}
} 422 Unprocessable Content The request data is invalid. details lists every problem at once: per field a list of
{code, message}. Field names use dots for nesting, for example value_ids.1 is the second
entry of value_ids (counting from 0).
{
"error": {
"code": "validation_failed",
"message": "The request payload is invalid.",
"details": {
"street": [
{
"code": "required",
"message": "The street field is required."
}
],
"country": [
{
"code": "unknown_country",
"message": "The selected country is invalid."
}
]
}
}
} 429 Too Many Requests Too many requests. Either your API client used up its requests per minute
(message Too many requests., with all rate limit headers), or too many failed authentications
came in a short time (message Too many authentication attempts., only Retry-After). Both
carry the code rate_limited.
{
"error": {
"code": "rate_limited",
"message": "Too many requests.",
"details": []
}
} 500 Internal Server Error An unexpected error occurred on our side. Retry later.
{
"error": {
"code": "server_error",
"message": "An unexpected error occurred.",
"details": []
}
} All error codes: error code reference.
Remove a label value from a customer
/customers/{externalId}/labels/{valueId}
Scope: customers.write
Removes one label value from the customer. Answers 404 if the value is not set on the customer.
Path parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
externalId | string | required | Your customer ID, as sent in customer.external_id. Case-sensitive. URL-encode special characters. max length 191 |
valueId | integer | required | ID of the label value (values[].id from listCustomerLabels). |
Example request
curl -X DELETE "https://shop.example.com/api/v1/customers/u-55871/labels/31" \
-H "Authorization: Bearer $API_KEY" \
-H "Accept: application/json" Responses
204 No Content The label value was removed. The response has no body.
Error responses
401 Unauthorized The API key is missing, malformed, wrong, paused, expired or revoked. The body is always the same and never names the reason.
{
"error": {
"code": "unauthorized",
"message": "Invalid or missing API key.",
"details": []
}
} 403 Forbidden The API key is valid but lacks a scope this endpoint needs. details.required lists the scopes
the endpoint requires, details.missing the ones your key lacks. Ask the shop operator to add
the scope.
{
"error": {
"code": "insufficient_scope",
"message": "The API key is missing a required scope.",
"details": {
"required": [
"orders.write"
],
"missing": [
"orders.write"
]
}
}
} 404 Not Found The path does not exist, the API is not enabled on this system, the order does not belong to the shop of your API client, or the customer, address or label value is not known to your API client.
{
"error": {
"code": "not_found",
"message": "The requested resource does not exist.",
"details": []
}
} 429 Too Many Requests Too many requests. Either your API client used up its requests per minute
(message Too many requests., with all rate limit headers), or too many failed authentications
came in a short time (message Too many authentication attempts., only Retry-After). Both
carry the code rate_limited.
{
"error": {
"code": "rate_limited",
"message": "Too many requests.",
"details": []
}
} 500 Internal Server Error An unexpected error occurred on our side. Retry later.
{
"error": {
"code": "server_error",
"message": "An unexpected error occurred.",
"details": []
}
} All error codes: error code reference.