createCustomer
Requires permission customers:customer:create.
Creates a customer in your organization, with its account, addresses and contacts. Needs the customers create permission.
Errors: a failed call returns a GraphQL errors entry, not a field on the result, and data may be null or partial. Read the entry's extensions.code and message; every shape and code is in the Error reference.
Example:
- GraphQL
- cURL
mutation CreateCustomer($createCustomerInput: CreateCustomerInput!) {
createCustomer(createCustomerInput: $createCustomerInput) {
id
code
registrationNumber
name
customerTierName
displayName
addresses {
id
postalCode
contactName
type
createdAt
addressLine1
}
}
}
curl -X POST "https://<api-host>/graphql" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
--data @- <<'EOF'
{
"query": "mutation CreateCustomer($createCustomerInput: CreateCustomerInput!) {\n createCustomer(createCustomerInput: $createCustomerInput) {\n id\n code\n registrationNumber\n name\n customerTierName\n displayName\n addresses {\n id\n postalCode\n contactName\n type\n createdAt\n addressLine1\n }\n }\n}",
"variables": {
"createCustomerInput": {
"alsoCreateAsVendor": true,
"communicationPreference": "string",
"creditLimit": 0,
"loyaltyPoints": 0,
"marketingOptIn": true,
"name": "string",
"tags": [
"string"
]
}
}
}
EOF
Variables:
{
"createCustomerInput": {
"alsoCreateAsVendor": true,
"communicationPreference": "string",
"creditLimit": 0,
"loyaltyPoints": 0,
"marketingOptIn": true,
"name": "string",
"tags": [
"string"
]
}
}
Response:
{
"data": {
"createCustomer": {
"id": "id",
"code": "string",
"registrationNumber": "string",
"name": "string",
"customerTierName": "string",
"displayName": "string",
"addresses": [
{
"id": "id",
"postalCode": "string",
"contactName": "string",
"type": "string",
"createdAt": "2025-01-15T00:00:00Z",
"addressLine1": "string"
}
]
}
}
}
createCustomer(
createCustomerInput: CreateCustomerInput!
): Customer!
Arguments
createCustomer.createCustomerInput ● CreateCustomerInput! non-null input
The customer to create: its name, account settings, addresses and contacts.
Type
Customer object
A customer: a partner with the customer role.