Customers
Create or update an array of 1 to 100 customers atomically. If any item fails, none are stored. customer.code, customer.type, and customer.name are required when creating a new customer. Surname and description are optional. Phones, emails, and addresses are optional; phone.value, email.value, and address.city are required when supplied for a new customer. New contacts and addresses are appended; omitted existing contact data is not deleted.
http://localhost:3000/api/v1/customers- Method
- POST
- Content type
- application/json
- Authentication
- Required · active locations · non-expired key
- Maximum payload
- 1 MiB
- Request frequency
- 30 requests per 60 seconds
Request headers
Send these headers with every POST request.
Content-Type: application/json
Authorization: Bearer y3m_ABCD2345_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxTo get the authorization key, open Dashboard, use the three-dot menu on the company card, and select API integrations. Under Secret keys, select Create secret key, enable the Customers scope, and assign at least one active location. Copy the full key when it is created because it is shown only once, then send it after Bearer in the Authorization header.
Request fields
Required and optional fields accepted in the JSON request body. Unknown fields are rejected at every level.
| Field | Type | Requirement | Description |
|---|---|---|---|
externalId | string | Required | Caller-controlled Customer identifier from the source system; it does not need to be a UUID. It is unique within the company; the internal Y3M identifier is a UUID v7. Maximum 200 characters. |
customer | object | null | Optional | Optional customer identity. Name is required here when creating a new customer. |
customer.code | string | Optional | Optional visible customer code. Maximum 100 characters. |
customer.type | string | Optional | Optional external customer type. Maximum 100 characters. |
customer.name | string | On create | Required when externalId does not match an existing customer. When omitted for an existing customer, the stored name is used. Maximum 200 characters. |
customer.surname | string | null | Optional | Optional customer surname. Maximum 100 characters. |
description | string | null | Optional | Optional customer description. Maximum 2,000 characters. |
phones | array | Optional | Up to 20 phone entries appended when not already stored for this customer. The first new phone in the payload becomes the default. |
phones[].value | string | On create | Required when adding a phone to a new customer. Up to 100 characters. |
phones[].position | integer | Optional | Optional positive display position. |
emails | array | Optional | Up to 20 email entries appended when not already stored for this customer. The first new email in the payload becomes the default. |
emails[].value | string | On create | Required when adding an email to a new customer. Up to 320 characters. |
emails[].position | integer | Optional | Optional positive display position. |
addresses | array | Optional | Up to 20 addresses to append when identical addresses do not already exist. The first new address in the payload becomes the default. |
addresses[].countryCode | string | null | Optional | Optional ISO 3166-1 alpha-2 country code using two uppercase letters. View country codes |
addresses[].region | string | null | Optional | Optional region or state. |
addresses[].postalCode | string | null | Optional | Optional postal code. |
addresses[].city | string | On create | Required for an address on a new customer; maximum 150 characters. |
addresses[].street | string | null | Optional | Optional street or complete free-form address. |
addresses[].building | string | null | Optional | Optional building number or name. |
addresses[].unit | string | null | Optional | Optional apartment, office, or unit. |
addresses[].position | integer | Optional | Optional positive display position. Positions must be unique within the addresses array. |
Error responses
Possible errors returned by this endpoint and how to resolve them.
| Status | Code | Meaning | Resolution |
|---|---|---|---|
400 | INVALID_JSON | The request body is not valid JSON. | Send one correctly formatted JSON array. |
400 | INVALID_PAYLOAD | The JSON body is not an array. | Send a root JSON array containing between 1 and 100 objects. |
401 | UNAUTHORIZED | The Authorization header is missing, malformed, or contains an invalid API key. | Send a valid API key using the Bearer authorization scheme. |
401 | API_KEY_EXPIRED | The API key has reached its expiration date. | Create a new API key and retry the request. |
403 | FORBIDDEN | The API key cannot access this module or is not assigned to an active company location. | Assign an active location, enable the required module, or use another key. |
409 | CUSTOMER_DELETED | A customer referenced by externalId is deleted. | Restore the customer in Y3M, then retry the request. |
413 | PAYLOAD_TOO_LARGE | The request body exceeds the 1 MiB limit. | Reduce the JSON payload size to 1 MiB or less. |
415 | UNSUPPORTED_MEDIA_TYPE | The Content-Type header is not application/json. | Send Content-Type: application/json. |
422 | VALIDATION_ERROR | The JSON is valid but one or more fields do not satisfy the endpoint contract. | Use each { path, message } entry in error.details to correct the specified field. |
429 | RATE_LIMIT_EXCEEDED | More than 30 requests were sent within 60 seconds. | Wait for the number of seconds specified by the Retry-After header. |
500 | INTERNAL_ERROR | Request infrastructure, authentication, or rate-limit processing is temporarily unavailable. | Retry later. Contact support if the error continues. |
500 | STORAGE_ERROR | The validated payload could not be stored. | Retry later. Contact support if the error continues. |
Example request
Send this JSON array in the POST request body.
[
{
"externalId": "CUSTOMER-123",
"customer": {
"code": "CUSTOMER-001",
"type": "Wholesale",
"name": "Example",
"surname": "Company"
},
"description": "Wholesale customer",
"phones": [
{
"value": "+32470000000",
"position": 1
}
],
"emails": [
{
"value": "orders@example.com",
"position": 1
}
],
"addresses": [
{
"countryCode": "BE",
"region": "Brussels-Capital",
"postalCode": "1000",
"city": "Brussels",
"street": "Example Street",
"building": "1",
"unit": "12",
"position": 1
}
]
}
]