Skip to main content

Store New Customer

Create the Azotte-side projection of a customer using identity data sourced from your system. Returns the canonical AzotteCustomer record (including CustomerUrn).

URL

POST /api/c2a/customer/store

Request Parameters

Body: StoreCustomerRequest.

NameTypeDescription
customerobject (CustomerDto)Required. Customer payload.
claimedRegionobject (ClaimedRegion)Required. Country / language context claimed by the caller. Scopes storefront, currency, tax.

CustomerDto

NameTypeDescription
externalIdentifierstringRequired. Tenant-side identifier. Must be unique per tenant.
emailstringCustomer email.
phoneNumberstringE.164 phone number.
salutationstringSalutation prefix.
firstNamestringGiven name.
lastNamestringFamily name.
genderstring (EnGender)Gender code.
legalTypestring (EnPersonLegalType)Individual or Corporate.
primaryBillingAddressobject (PostalAddress)Billing address.
corporationInfoobject (CorporationInfo)Conditional. Required when legalType = Corporate.
privacyobject (AzotteCustomerPrivacySettings)Communication consents.
statusstringCaller-asserted status.

ClaimedRegion

NameTypeDescription
countryCodestringRequired. ISO 3166-1 alpha-2 country code.
languageCodestringRequired. ISO 639-1 language code.

Request Example

{
"customer": {
"externalIdentifier": "crm-9981273",
"email": "jane.doe@example.com",
"phoneNumber": "+49 170 1234567",
"salutation": "Ms.",
"firstName": "Jane",
"lastName": "Doe",
"gender": "Female",
"legalType": "Individual",
"primaryBillingAddress": {
"street": "Hauptstr. 1",
"city": "Berlin",
"postalCode": "10115",
"countryCode": "DE"
}
},
"claimedRegion": {
"countryCode": "DE",
"languageCode": "de"
}
}

Response Parameters

StoreCustomerResponse.

NameTypeDescription
resultobject (AzotteCustomer)Canonical customer record.
result.customerUrnstringAzotte-assigned URN. Use this in every downstream call.
result.externalIdentifierstringEcho of supplied ExternalId.
result.emailstringEchoed email.
result.statusstringOperational status (Active, etc.).
statusobject (AzotteStatus)Operation status envelope.
status.messageCodestringSUCCESS on hit.

Sample Response

{
"result": {
"customerUrn": "cu.00.482",
"externalIdentifier": "crm-9981273",
"email": "jane.doe@example.com",
"status": "Active"
},
"status": { "messageCode": "SUCCESS" }
}

Bad Request (HTTP 400)

messageCodeTrigger
BAD_REQUESTrequest.Customer is null.
INVALID_REQUESTFluentValidation rule failed on payload.

Conflict (HTTP 409)

Duplicate identity collision.

messageCodeTrigger
USER_WITH_SAME_PHONE_NUMBER_EXISTSPhone number already attached to another customer.
USER_WITH_SAME_EMAIL_EXISTSEmail already attached to another customer.
CUSTOMER_ALREADY_STOREDexternalIdentifier already projected (call /info or /update instead).

Server Error (HTTP 500)

messageCodeTrigger
SQL_DATABASE_FAILUREInsert returned null (DB layer rejected the row).
INTERNAL_SERVER_ERRORUnhandled exception caught by the controller.

Behaviour

  • ExternalId uniqueness is enforced per tenant. Colliding ExternalId returns CUSTOMER_ALREADY_STORED (409).
  • Email and phone uniqueness enforced per tenant — return USER_WITH_SAME_EMAIL_EXISTS / USER_WITH_SAME_PHONE_NUMBER_EXISTS (409).
  • Validation of mandatory tenant-side fields runs via TenantCustomerInfoStorageValidatorINVALID_REQUEST (400).
  • Privacy / consent flags are stored verbatim; you remain responsible for the legal basis.

Sample Codes

curl --location 'https://acme.sandbox.azotte.com/api/v1/c2a/customer/store' \
--header 'Content-Type: application/json' \
--header 'x-tn: e2a1c7b2-4f3a-4b8e-9c2d-1a2b3c4d5e6f' \
--header 'x-api-key: sk_dev_acme_sample_123456789' \
--data '{
"customer": {
"externalIdentifier": "crm-9981273",
"email": "jane.doe@example.com",
"firstName": "Jane",
"lastName": "Doe",
"legalType": "Individual"
},
"claimedRegion": { "countryCode": "DE", "languageCode": "de" }
}'