Customer classes
Read the customer classes and assign a class to a customer.
List customer classes
GET
/customer-classes
Scope: customers.read
Returns all customer classes with all their settings (for example discount and price display),
sorted by position. payment_methods lists the payment methods available to the class.
Example request
curl "https://shop.example.com/api/v1/customer-classes" \
-H "Authorization: Bearer $API_KEY" \
-H "Accept: application/json" Responses
200 OK All customer classes.
{
"data": [
{
"id": 1,
"name": "Retail customers",
"position": 1,
"price_display": null,
"discount_type": null,
"discount_percent": 0,
"allow_coupon": 1,
"payment_methods": [
{
"id": 3,
"name": "Invoice",
"provider": "invoice"
}
]
},
{
"id": 3,
"name": "Business customers",
"position": 2,
"price_display": "NS",
"discount_type": null,
"discount_percent": 5,
"allow_coupon": 1,
"payment_methods": [
{
"id": 3,
"name": "Invoice",
"provider": "invoice"
}
]
}
]
} Response fields
| Field | Type | Required | Description |
|---|---|---|---|
data[] | array of object | required | |
id | integer | required | Value for customer_class_id. |
name | string | required | |
position | integer | null | optional | Sort position. |
price_display | string | null | optional | NS = the class sees net prices; any other value = gross prices. |
discount_type | string | null | optional | |
discount_percent | number | null | optional | Discount of the class in percent. |
allow_coupon | integer | null | optional | 1 if coupons may be used. |
payment_methods[] | array of object | required | Payment methods available to the class. |
id | integer | required | |
name | string | required | |
provider | string | 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 a customer's class
PUT
/customers/{externalId}/class
Scope: customers.write
Assigns a customer class to the customer. The new class applies from the next order on, including its discount.
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 |
|---|---|---|---|
customer_class_id | integer | required | ID of an existing customer class (see listCustomerClasses). |
Example request
curl -X PUT "https://shop.example.com/api/v1/customers/u-55871/class" \
-H "Authorization: Bearer $API_KEY" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{
"customer_class_id": 3
}' Responses
200 OK The class was assigned.
{
"data": {
"customer_id": 9021,
"customer_class_id": 3
}
} Response fields
| Field | Type | Required | Description |
|---|---|---|---|
data | object | required | |
customer_id | integer | required | Our customer number. |
customer_class_id | integer | required | The class now assigned to the customer. |
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.