userBuyerCreate Mutation
Description
Creates a new buyer with personal information, contact details, addresses, and optional list memberships. If createEshopAccount is true, the buyer is created with an eshop account and a password token is generated. If lists are provided, the buyer is added to those customer lists. Returns the created buyer.
mutation userBuyerCreate(
$email: String!
$firstName: String!
$lastName: String!
$telephone: String
$organisation: String
$taxNumber: String
$lists: [ID]
$addresses: [AddressInput]
$createEshopAccount: Boolean
) {
userBuyerCreate(
email: $email
firstName: $firstName
lastName: $lastName
telephone: $telephone
organisation: $organisation
taxNumber: $taxNumber
lists: $lists
addresses: $addresses
createEshopAccount: $createEshopAccount
) {
_id
created
updated
lastLogin
active
birthdate
firstName
lastName
email
name
path
telephone
organisation
taxNumber
lists {
_id
ref
added
lastModified
}
accountCreated
addresses {
_id
description
firstName
lastName
addressLine1
addressLine2
streetNumber
city
state
stateCode
postCode
alpha2
country
type
}
notes
verification {
status
token
code
date
hash
}
orderCount
orderTotal
creditNotesCount
wantsCount
vouchersCount
type
}
}
Variables
{
"email": "email@example.com",
"firstName": "John",
"lastName": "Doe",
"telephone": "telephone",
"organisation": "organisation",
"taxNumber": "taxNumber",
"lists": [
"eb6000863872dc9145ae24a8"
],
"addresses": [
{
"description": "A description",
"addressLine1": "addressLine1",
"addressLine2": "addressLine2",
"streetNumber": 42,
"city": "Montreal",
"state": "Quebec",
"postCode": "postCode",
"alpha2": "alpha2",
"country": "Canada",
"stateCode": "stateCode",
"type": "type",
"geoLoc": {
"type": "type",
"coordinates": [
30.7
]
}
}
],
"createEshopAccount": true
}
Response
{
"userBuyerCreate": {
"_id": "8133a01003fdb7c512311741",
"created": 1768727500890,
"updated": 1726790593251,
"lastLogin": 1738773164972,
"active": true,
"birthdate": 1722778791909,
"firstName": "example",
"lastName": "example",
"email": "email@example.com",
"name": "example",
"path": "/release/1763553751/release-artist-release-name",
"telephone": "example",
"organisation": "example",
"taxNumber": "example",
"lists": [
{
"_id": "dd93939f7acc5ae5fe38f48b",
"ref": "788ab7005f3766b485d5c9df",
"added": 1756691977318,
"lastModified": 1762729713016
}
],
"accountCreated": true,
"addresses": [
{
"_id": "f27ea76ad623725eae5e9f31",
"description": "example",
"firstName": "example",
"lastName": "example",
"addressLine1": "example",
"addressLine2": "example",
"streetNumber": 42,
"city": "example",
"state": "example",
"stateCode": "example",
"postCode": "example",
"alpha2": "example",
"country": "example",
"type": "example"
}
],
"notes": "example",
"verification": {
"status": true,
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ",
"code": "example",
"date": 1751669076927,
"hash": "example"
},
"orderCount": 42,
"orderTotal": 1.23,
"creditNotesCount": 42,
"wantsCount": 42,
"vouchersCount": 42,
"type": "example"
}
}
Arguments
| Name | Type | Description |
|---|---|---|
email | String! | Email address of the buyer. Must be unique within the shop. |
firstName | String! | First name of the buyer. |
lastName | String! | Last name of the buyer. |
telephone | String | Telephone number of the buyer. |
organisation | String | Organization or company name associated with the buyer. |
taxNumber | String | Tax identification number for the buyer. |
lists | [ID] | List of customer list reference IDs to add the buyer to upon creation. |
addresses | [AddressInput] | List of addresses for the buyer. |
createEshopAccount | Boolean | Whether to create an eshop account for the buyer, allowing them to log in to the storefront. If true, a password token is generated and an account creation confirmation email is sent. |