Create or update a customer
All field references · Customers
POST /v1/customers
Creates a customer or updates an existing one. Matching runs in this order: external_reference, then code, then email. If the email matches several customers, nothing is guessed — the response is 409 with customer_match_ambiguous. Name and customer number are only set on creation. Omitted sections are kept; a delivery address and contacts you send replace their section completely, even with fill_empty. Requires the one-time approval of the organization; a test key may only use validate_only here.
Required scopes: "customers:write".
#Request body
Request body required.
Content type: application/json
| Field | Type | Presence | null | Meaning, limits and examples |
|---|---|---|---|---|
| $ (whole value) | object | Whole value | Not allowed | Create or update by external reference, then customer number, then email. At least one of name, company, last_name or email is required. Omitted values preserve existing data; null and empty strings are not accepted. Sending contacts or delivery_address replaces the corresponding complete collection or address. Additional properties are not allowed. |
| external_reference | string | Optional | Not allowed | Your stable customer reference; matching takes precedence over code and email. minLength: 1. maxLength: 200. |
| code | string | Optional | Not allowed | Meykt customer number for matching or creation; does not rename an existing customer number. minLength: 1. maxLength: 60. |
| name | string | Optional | Not allowed | Display name used on creation; not renamed by an update through this endpoint. minLength: 1. maxLength: 300. |
| salutation | string | Optional | Not allowed | Salutation for the person; use one of the listed codes. enum: ["mr","mrs","diverse","dr","prof"]. |
| first_name | string | Optional | Not allowed | Given name of the customer or contact. minLength: 1. maxLength: 120. |
| last_name | string | Optional | Not allowed | Family name of the customer or contact; may identify the customer when name, company and email are absent. minLength: 1. maxLength: 120. |
| string | Optional | Not allowed | Customer or contact email address. At customer level this is the final matching fallback after external_reference and code. format: "email". maxLength: 254. | |
| phone | string | Optional | Not allowed | Telephone number, preferably including the international prefix. minLength: 1. maxLength: 60. |
| mobile | string | Optional | Not allowed | Mobile telephone number, preferably including the international prefix. minLength: 1. maxLength: 60. |
| company | string | Optional | Not allowed | Company name; can identify a customer when name, last_name and email are absent. minLength: 1. maxLength: 200. |
| customer_type | string | Optional | Not allowed | Customer category: b2c for consumers, b2b for businesses, wholesale for wholesale customers. enum: ["b2c","b2b","wholesale"]. |
| street | string | Optional | Not allowed | Street name without the separately supplied house number. minLength: 1. maxLength: 200. |
| house_number | string | Optional | Not allowed | House number including any suffix. minLength: 1. maxLength: 40. |
| address_line2 | string | Optional | Not allowed | Additional address information, such as floor or department. minLength: 1. maxLength: 200. |
| postal_code | string | Optional | Not allowed | Postal code as text, preserving leading zeroes. minLength: 1. maxLength: 30. |
| city | string | Optional | Not allowed | City or locality. minLength: 1. maxLength: 120. |
| country | string | Optional | Not allowed | Country as text. Prefer a two-letter country code such as DE; this endpoint also accepts existing textual country values. minLength: 1. maxLength: 80. |
| website_url | string | Optional | Not allowed | Customer website address as text. minLength: 1. maxLength: 300. |
| company_size | string | Optional | Not allowed | Company size classification or description used by your source system. minLength: 1. maxLength: 60. |
| preferred_content_language | string | Optional | Not allowed | Two-character preferred content language code, for example de or en. minLength: 2. maxLength: 2. |
| custom_fields | object | Optional | Not allowed | Additional customer fields keyed by the field identifiers configured in Meykt. Discover configured keys and types through GET /v1/customers/fields. propertyNames: {"maxLength":80}. |
| custom_fields.{key} | any JSON value | Every additional entry | Allowed by schema | Value for this additional customer key. Discover configured keys and types through GET /v1/customers/fields; legacy customer imports do not validate these values against field definitions. |
| delivery_address | object | Optional | Not allowed | When supplied, replaces the complete default shipping address even in fill_empty mode. Must contain at least one field. Omit to preserve it. Additional properties are not allowed. minProperties: 1. |
| delivery_address.company | string | Optional | Not allowed | Company name; can identify a customer when name, last_name and email are absent. minLength: 1. maxLength: 200. |
| delivery_address.first_name | string | Optional | Not allowed | Given name of the customer or contact. minLength: 1. maxLength: 120. |
| delivery_address.last_name | string | Optional | Not allowed | Family name of the customer or contact; may identify the customer when name, company and email are absent. minLength: 1. maxLength: 120. |
| delivery_address.street | string | Optional | Not allowed | Street name without the separately supplied house number. minLength: 1. maxLength: 200. |
| delivery_address.house_number | string | Optional | Not allowed | House number including any suffix. minLength: 1. maxLength: 40. |
| delivery_address.address_line2 | string | Optional | Not allowed | Additional address information, such as floor or department. minLength: 1. maxLength: 200. |
| delivery_address.postal_code | string | Optional | Not allowed | Postal code as text, preserving leading zeroes. minLength: 1. maxLength: 30. |
| delivery_address.city | string | Optional | Not allowed | City or locality. minLength: 1. maxLength: 120. |
| delivery_address.country | string | Optional | Not allowed | Country as text. Prefer a two-letter country code such as DE; this endpoint also accepts existing textual country values. minLength: 1. maxLength: 80. |
| contacts | array | Optional | Not allowed | When supplied, replaces all contacts even in fill_empty mode. Omit to preserve them; an empty list is invalid. minItems: 1. maxItems: 20. |
| contacts[] | object | Every array item | Not allowed | Additional properties are not allowed. |
| contacts[].salutation | string | Optional | Not allowed | Salutation for the person; use one of the listed codes. enum: ["mr","mrs","diverse","dr","prof"]. |
| contacts[].first_name | string | Required when parent is present | Not allowed | Given name of this contact. minLength: 1. maxLength: 120. |
| contacts[].last_name | string | Required when parent is present | Not allowed | Family name of this contact. minLength: 1. maxLength: 120. |
| contacts[].position | string | Optional | Not allowed | Job title or role of this contact. minLength: 1. maxLength: 120. |
| contacts[].email | string | Optional | Not allowed | Customer or contact email address. At customer level this is the final matching fallback after external_reference and code. format: "email". maxLength: 254. |
| contacts[].phone | string | Optional | Not allowed | Telephone number, preferably including the international prefix. minLength: 1. maxLength: 60. |
| contacts[].mobile | string | Optional | Not allowed | Mobile telephone number, preferably including the international prefix. minLength: 1. maxLength: 60. |
| contacts[].is_primary | boolean | Optional | Not allowed | Whether this contact is the primary contact. |
| update_mode | string | Optional | Not allowed | overwrite is the default. fill_empty preserves populated simple contact and billing-address fields. Supplied custom fields, customer type, shipping address and contacts have their own update rules. enum: ["overwrite","fill_empty"]. |
| validate_only | boolean | Optional | Not allowed | Evaluate matching without writing. Required for test keys; matching still reads real customer data after sharing consent. |
| $ (whole value) | any JSON value | Conditional: anyOf 1/4 | Allowed by schema | anyOf 1/4: At least one alternative must match. Create or update by external reference, then customer number, then email. At least one of name, company, last_name or email is required. Omitted values preserve existing data; null and empty strings are not accepted. Sending contacts or delivery_address replaces the corresponding complete collection or address. |
| $ | requirement | Required: name | See field type | anyOf 1/4: At least one alternative must match. |
| $ (whole value) | any JSON value | Conditional: anyOf 2/4 | Allowed by schema | anyOf 2/4: At least one alternative must match. Create or update by external reference, then customer number, then email. At least one of name, company, last_name or email is required. Omitted values preserve existing data; null and empty strings are not accepted. Sending contacts or delivery_address replaces the corresponding complete collection or address. |
| $ | requirement | Required: company | See field type | anyOf 2/4: At least one alternative must match. |
| $ (whole value) | any JSON value | Conditional: anyOf 3/4 | Allowed by schema | anyOf 3/4: At least one alternative must match. Create or update by external reference, then customer number, then email. At least one of name, company, last_name or email is required. Omitted values preserve existing data; null and empty strings are not accepted. Sending contacts or delivery_address replaces the corresponding complete collection or address. |
| $ | requirement | Required: last_name | See field type | anyOf 3/4: At least one alternative must match. |
| $ (whole value) | any JSON value | Conditional: anyOf 4/4 | Allowed by schema | anyOf 4/4: At least one alternative must match. Create or update by external reference, then customer number, then email. At least one of name, company, last_name or email is required. Omitted values preserve existing data; null and empty strings are not accepted. Sending contacts or delivery_address replaces the corresponding complete collection or address. |
| $ | requirement | Required: email | See field type | anyOf 4/4: At least one alternative must match. |
#Response 200, 201
200: Success; see the status meaning of the operation. 201: Success
Content type: application/json
| Field | Type | Presence | null | Meaning, limits and examples |
|---|---|---|---|---|
| $ (whole value) | object | Whole value | Not allowed | Additional properties are not allowed. |
| data | alternative (anyOf) | Required when parent is present | Not allowed | Authorized response payload or documented event data. |
| data | object | Conditional: anyOf 1/2 | Not allowed | anyOf 1/2: At least one alternative must match. Authorized response payload or documented event data. Additional properties are not allowed. |
| data.result | string | Required when parent is present | Not allowed | anyOf 1/2: At least one alternative must match. Result of this request, using the operation-specific values documented by the schema. enum: ["created","updated"]. |
| data.customer | object | Required when parent is present | Not allowed | anyOf 1/2: At least one alternative must match. Customer contact or master data authorized for this response. Additional properties are not allowed. |
| data.customer.id | string | Required when parent is present | Not allowed | anyOf 1/2: At least one alternative must match. Stable entry identifier. format: "uuid". |
| data.customer.code | string | Required when parent is present | Not allowed | anyOf 1/2: At least one alternative must match. Customer number, unique within your organization. |
| data.customer.name | string | Required when parent is present | Not allowed | anyOf 1/2: At least one alternative must match. Display name. |
| data.customer.salutation | string or null | Required when parent is present | Allowed by schema | anyOf 1/2: At least one alternative must match. Salutation code for this person. |
| data.customer.first_name | string or null | Required when parent is present | Allowed by schema | anyOf 1/2: At least one alternative must match. Given name of this person. |
| data.customer.last_name | string or null | Required when parent is present | Allowed by schema | anyOf 1/2: At least one alternative must match. Family name of this person. |
| data.customer.email | string or null | Required when parent is present | Allowed by schema | anyOf 1/2: At least one alternative must match. Contact email address. |
| data.customer.phone | string or null | Required when parent is present | Allowed by schema | anyOf 1/2: At least one alternative must match. Contact telephone number, including international prefix where applicable. |
| data.customer.mobile | string or null | Required when parent is present | Allowed by schema | anyOf 1/2: At least one alternative must match. Mobile telephone number, including international prefix where applicable. |
| data.customer.company | string or null | Required when parent is present | Allowed by schema | anyOf 1/2: At least one alternative must match. Company or organization name. |
| data.customer.customer_type | string | Required when parent is present | Not allowed | anyOf 1/2: At least one alternative must match. Customer classification: consumer, business or wholesale as indicated by the code. |
| data.customer.billing_address | object | Required when parent is present | Not allowed | anyOf 1/2: At least one alternative must match. Customer billing address; absent member values are returned as null. Additional properties are not allowed. |
| data.customer.billing_address.street | string or null | Required when parent is present | Allowed by schema | anyOf 1/2: At least one alternative must match. Street name; house number is provided separately in house_number. |
| data.customer.billing_address.house_number | string or null | Required when parent is present | Allowed by schema | anyOf 1/2: At least one alternative must match. House number including any suffix. |
| data.customer.billing_address.address_line2 | string or null | Required when parent is present | Allowed by schema | anyOf 1/2: At least one alternative must match. Additional address information such as floor, department or care-of recipient. |
| data.customer.billing_address.postal_code | string or null | Required when parent is present | Allowed by schema | anyOf 1/2: At least one alternative must match. Postal code as text, preserving leading zeroes. |
| data.customer.billing_address.city | string or null | Required when parent is present | Allowed by schema | anyOf 1/2: At least one alternative must match. City or locality. |
| data.customer.billing_address.country | string or null | Required when parent is present | Allowed by schema | anyOf 1/2: At least one alternative must match. Country recorded for the address; use the format documented for this endpoint. |
| data.customer.website_url | string or null | Required when parent is present | Allowed by schema | anyOf 1/2: At least one alternative must match. Customer website address. |
| data.customer.company_size | string or null | Required when parent is present | Allowed by schema | anyOf 1/2: At least one alternative must match. Company size classification or description. |
| data.customer.preferred_content_language | string or null | Required when parent is present | Allowed by schema | anyOf 1/2: At least one alternative must match. Preferred two-character content-language code such as de or en. |
| data.customer.is_active | boolean | Required when parent is present | Not allowed | anyOf 1/2: At least one alternative must match. Whether this entry is currently active and available for ordinary use. |
| data.customer.custom_fields | object | Required when parent is present | Not allowed | anyOf 1/2: At least one alternative must match. Customer fields keyed by their configured field identifiers. |
| data.customer.custom_fields.{key} | any JSON value | Every additional entry | Allowed by schema | anyOf 1/2: At least one alternative must match. Value stored for the configured customer field. Discover its declared type and options through GET /v1/customers/fields. |
| data.customer.delivery_address | alternative (anyOf) | Required when parent is present | Allowed by schema | anyOf 1/2: At least one alternative must match. Default shipping address, or null when none is recorded. |
| data.customer.delivery_address | object | Conditional: anyOf 1/2 | Not allowed | anyOf 1/2: At least one alternative must match.; anyOf 1/2: At least one alternative must match. Default shipping address, or null when none is recorded. Additional properties are not allowed. |
| data.customer.delivery_address.street | string or null | Required when parent is present | Allowed by schema | anyOf 1/2: At least one alternative must match.; anyOf 1/2: At least one alternative must match. Street name; house number is provided separately in house_number. |
| data.customer.delivery_address.house_number | string or null | Required when parent is present | Allowed by schema | anyOf 1/2: At least one alternative must match.; anyOf 1/2: At least one alternative must match. House number including any suffix. |
| data.customer.delivery_address.address_line2 | string or null | Required when parent is present | Allowed by schema | anyOf 1/2: At least one alternative must match.; anyOf 1/2: At least one alternative must match. Additional address information such as floor, department or care-of recipient. |
| data.customer.delivery_address.postal_code | string or null | Required when parent is present | Allowed by schema | anyOf 1/2: At least one alternative must match.; anyOf 1/2: At least one alternative must match. Postal code as text, preserving leading zeroes. |
| data.customer.delivery_address.city | string or null | Required when parent is present | Allowed by schema | anyOf 1/2: At least one alternative must match.; anyOf 1/2: At least one alternative must match. City or locality. |
| data.customer.delivery_address.country | string or null | Required when parent is present | Allowed by schema | anyOf 1/2: At least one alternative must match.; anyOf 1/2: At least one alternative must match. Country recorded for the address; use the format documented for this endpoint. |
| data.customer.delivery_address.company | string or null | Required when parent is present | Allowed by schema | anyOf 1/2: At least one alternative must match.; anyOf 1/2: At least one alternative must match. Company or organization name. |
| data.customer.delivery_address.first_name | string or null | Required when parent is present | Allowed by schema | anyOf 1/2: At least one alternative must match.; anyOf 1/2: At least one alternative must match. Given name of this person. |
| data.customer.delivery_address.last_name | string or null | Required when parent is present | Allowed by schema | anyOf 1/2: At least one alternative must match.; anyOf 1/2: At least one alternative must match. Family name of this person. |
| data.customer.delivery_address | null | Conditional: anyOf 2/2 | Allowed by schema | anyOf 1/2: At least one alternative must match.; anyOf 2/2: At least one alternative must match. Default shipping address, or null when none is recorded. |
| data.customer.contacts | array | Required when parent is present | Not allowed | anyOf 1/2: At least one alternative must match. Customer contacts, primary first and then in creation order. |
| data.customer.contacts[] | object | Every array item | Not allowed | anyOf 1/2: At least one alternative must match. Additional properties are not allowed. |
| data.customer.contacts[].salutation | string or null | Required when parent is present | Allowed by schema | anyOf 1/2: At least one alternative must match. Salutation code for this person. |
| data.customer.contacts[].first_name | string | Required when parent is present | Not allowed | anyOf 1/2: At least one alternative must match. Given name of this person. |
| data.customer.contacts[].last_name | string | Required when parent is present | Not allowed | anyOf 1/2: At least one alternative must match. Family name of this person. |
| data.customer.contacts[].position | string or null | Required when parent is present | Allowed by schema | anyOf 1/2: At least one alternative must match. Job title or role of this contact. |
| data.customer.contacts[].email | string or null | Required when parent is present | Allowed by schema | anyOf 1/2: At least one alternative must match. Contact email address. |
| data.customer.contacts[].phone | string or null | Required when parent is present | Allowed by schema | anyOf 1/2: At least one alternative must match. Contact telephone number, including international prefix where applicable. |
| data.customer.contacts[].mobile | string or null | Required when parent is present | Allowed by schema | anyOf 1/2: At least one alternative must match. Mobile telephone number, including international prefix where applicable. |
| data.customer.contacts[].is_primary | boolean | Required when parent is present | Not allowed | anyOf 1/2: At least one alternative must match. Whether this is the primary contact. |
| data.customer.created_at | string | Required when parent is present | Not allowed | anyOf 1/2: At least one alternative must match. Created at, with time-zone offset. format: "date-time". |
| data.customer.updated_at | string | Required when parent is present | Not allowed | anyOf 1/2: At least one alternative must match. Last changed at, with time-zone offset. format: "date-time". |
| data.matched_by | alternative (anyOf) | Required when parent is present | Allowed by schema | anyOf 1/2: At least one alternative must match. Rule that matched the existing customer; null when no existing match was found. |
| data.matched_by | string | Conditional: anyOf 1/2 | Not allowed | anyOf 1/2: At least one alternative must match.; anyOf 1/2: At least one alternative must match. Rule that matched the existing customer; null when no existing match was found. enum: ["external_reference","code","email"]. |
| data.matched_by | null | Conditional: anyOf 2/2 | Allowed by schema | anyOf 1/2: At least one alternative must match.; anyOf 2/2: At least one alternative must match. Rule that matched the existing customer; null when no existing match was found. |
| data | object | Conditional: anyOf 2/2 | Not allowed | anyOf 2/2: At least one alternative must match. Authorized response payload or documented event data. Additional properties are not allowed. |
| data.result | string | Required when parent is present | Not allowed | anyOf 2/2: At least one alternative must match. Result of this request, using the operation-specific values documented by the schema. enum: ["would_create","would_update"]. |
| data.customer_id | alternative (anyOf) | Required when parent is present | Allowed by schema | anyOf 2/2: At least one alternative must match. Identifier of the matched customer; null when the preview would create a new customer. |
| data.customer_id | string | Conditional: anyOf 1/2 | Not allowed | anyOf 2/2: At least one alternative must match.; anyOf 1/2: At least one alternative must match. Identifier of the matched customer; null when the preview would create a new customer. format: "uuid". |
| data.customer_id | null | Conditional: anyOf 2/2 | Allowed by schema | anyOf 2/2: At least one alternative must match.; anyOf 2/2: At least one alternative must match. Identifier of the matched customer; null when the preview would create a new customer. |
| data.matched_by | alternative (anyOf) | Required when parent is present | Allowed by schema | anyOf 2/2: At least one alternative must match. Rule that matched the existing customer; null when no existing match was found. |
| data.matched_by | string | Conditional: anyOf 1/2 | Not allowed | anyOf 2/2: At least one alternative must match.; anyOf 1/2: At least one alternative must match. Rule that matched the existing customer; null when no existing match was found. enum: ["external_reference","code","email"]. |
| data.matched_by | null | Conditional: anyOf 2/2 | Allowed by schema | anyOf 2/2: At least one alternative must match.; anyOf 2/2: At least one alternative must match. Rule that matched the existing customer; null when no existing match was found. |
#Response 400, 401, 403, 409, 413, 422, 429, 500, 503
400: The request is not valid JSON. 401: The key is missing, unknown, revoked or expired. 403: The key lacks a required scope, or the operation requires a live key. 409: The same ID already exists with different content. It is never overwritten. 413: The JSON request exceeds 256 KiB. 422: Content validation failed. The response lists all affected locations at once. 429: A rate limit was reached and the request did not run. Wait for Retry-After, then repeat it unchanged. X-RateLimit-Scope names the limit: key (120 requests per minute), organization (300 per minute across all keys), write (1,000 at once, refilling at 60 per minute) or list (300 unfiltered list pages at once, refilling at 10 per minute). 500: Unexpected error on our side. 503: Temporarily unavailable. Repeat the same request with the same business identity.
Content type: application/json
| Field | Type | Presence | null | Meaning, limits and examples |
|---|---|---|---|---|
| $ (whole value) | object | Whole value | Not allowed | — |
| error | object | Required when parent is present | Not allowed | Machine-readable error code; use it to select the documented recovery path. |
| error.code | string | Required when parent is present | Not allowed | Machine-readable, permanently stable error code. Program against it, not against message. |
| error.message | string | Required when parent is present | Not allowed | Explanation for humans. May change at any time. |
| error.field | string | Optional | Not allowed | Affected location in the request, if it can be determined. |
| error.doc_url | string | Required when parent is present | Not allowed | Documentation link explaining this API error. format: "uri". |
Machine-readable version of this page: https://www.meykt.com/developers/fields-create-customer.md