Mutation
createCustomer
Creates a new customer account. The email address must be unique. A welcome email is sent upon successful creation.
Signature
mutation { createCustomer(input: CreateCustomerInput!): CreateCustomerPayload! }
Arguments
| Name | Type | Required | Description |
|---|---|---|---|
input |
CreateCustomerInput! |
Yes | Customer creation input containing email, name, and optional profile details |
Return Type
CreateCustomerPayload!
Complexity: 3
Examples
Query
mutation CreateCustomer($input: CreateCustomerInput!) {
createCustomer(input: $input) {
customer {
id
email
firstName
lastName
createdAt
}
errors {
field
message
}
}
}
Variables
{
"input": {
"email": "[email protected]",
"firstName": "Jane",
"lastName": "Smith",
"phone": "+44 7700 900123",
"marketingOptIn": true
}
}
Response
{
"data": {
"createCustomer": {
"customer": {
"id": "cust_new456",
"email": "[email protected]",
"firstName": "Jane",
"lastName": "Smith",
"createdAt": "2024-06-21T16:00:00Z"
},
"errors": null
}
}
}