Customers API Routes
Customers can either be created when they register through the Store APIs, or created by the admin using the Admin APIs.
These API routes allow admin users to manage customers in their store.
GET /admin/customers#
List Customers
Retrieve a list of customers. The customers can be filtered by fields such as id. The customers can also be sorted or paginated.
Authentication: secret API key (HTTP Basic authorization), cookie session, JWT bearer token.
Query parameters
fieldsstringOptional+ it will be added to the default fields, using - will remove it from the default fields. without prefix it will replace the entire default fields. This API route restricts the fields that can be selected. Learn how to override the retrievable fields in the Retrieve Custom Links documentation.offsetnumberOptionallimitnumberOptionalorderstringOptional-.groupsstring | object | string[]OptionalFilter by a customer group's ID to retrieve customers that belong to it.
groupsstring | object | string[]OptionalqstringOptionalidstring | string[] | objectOptionalemailstring | string[] | objectOptionalcompany_namestring | string[] | objectOptionalfirst_namestring | string[] | objectOptionallast_namestring | string[] | objectOptionalcreated_bystring | string[] | objectOptionalcreated_atobjectOptionalupdated_atobjectOptionaldeleted_atobjectOptional$andobject[]Optional$orobject[]Optionalhas_accountbooleanOptionalwith_deletedbooleanOptionalRequest examples
Responses
200 OK
limitnumberoffsetnumbercountnumbercustomersobject[]The list of customers.
customersobject[]400, 401, 404, 409, 422, 500: an error response is returned.
POST /admin/customers#
Create Customer
Create a customer.
Authentication: secret API key (HTTP Basic authorization), cookie session, JWT bearer token.
Query parameters
fieldsstringOptional+ it will be added to the default fields, using - will remove it from the default fields. without prefix it will replace the entire default fields. This API route restricts the fields that can be selected. Learn how to override the retrievable fields in the Retrieve Custom Links documentation.Request body (application/json)
emailstringcompany_namestringfirst_namestringlast_namestringphonestringmetadataobjectadditional_dataobjectOptionaladditional_data parameter.Request examples
Responses
200 OK
customerobjectThe customer's details.
customerobject400, 401, 404, 409, 422, 500: an error response is returned.
Emitted events
customer.created: Emitted when a customer is created.
POST /admin/customers/export#
Export Customers
Start a customer export process to retrieve a file of exported customers. Use the query parameters to filter the exported customers and select the fields to include.
You'll receive in the response the transaction ID of the workflow generating the file. To check the status of the execution, send a GET request to /admin/workflows-executions/export-customers/:transaction-id.
Once the execution finishes successfully, a notification is created for the export. You can retrieve the notifications using the /admin/notification API route to retrieve the file's download URL.
Authentication: secret API key (HTTP Basic authorization), cookie session, JWT bearer token.
Query parameters
groupsstring | object | string[]OptionalFilter by a customer group's ID to retrieve customers that belong to it.
groupsstring | object | string[]Optionalhas_accountbooleanOptionalqstringOptionalidstring | string[] | objectOptionalemailstring | string[] | objectOptionalcompany_namestring | string[] | objectOptionalfirst_namestring | string[] | objectOptionallast_namestring | string[] | objectOptionalcreated_bystring | string[] | objectOptionalcreated_atobjectOptionalupdated_atobjectOptionaldeleted_atobjectOptionallimitnumberOptionaloffsetnumberOptionalorderstringOptional-.with_deletedbooleanOptionalfieldsstringOptional+ it will be added to the default fields, using - will remove it from the default fields. Without prefix it will replace the entire default fields.$andobject[]Optional$orobject[]OptionalRequest body (application/json)
format"csv" | "json"Optionaljson.batch_sizestring | numberOptionalRequest examples
Responses
202 OK
transaction_idstring400, 401, 404, 409, 422, 500: an error response is returned.
GET /admin/customers/{id}#
Get a Customer
Retrieve a customer by its ID. You can expand the customer's relations or select the fields that should be returned.
Authentication: secret API key (HTTP Basic authorization), cookie session, JWT bearer token.
Path parameters
idstringQuery parameters
fieldsstringOptional+ it will be added to the default fields, using - will remove it from the default fields. without prefix it will replace the entire default fields. This API route restricts the fields that can be selected. Learn how to override the retrievable fields in the Retrieve Custom Links documentation.Request examples
Responses
200 OK
customerobjectThe customer's details.
customerobject400, 401, 404, 409, 422, 500: an error response is returned.
POST /admin/customers/{id}#
Update a Customer
Update a customer's details.
Authentication: secret API key (HTTP Basic authorization), cookie session, JWT bearer token.
Path parameters
idstringQuery parameters
fieldsstringOptional+ it will be added to the default fields, using - will remove it from the default fields. without prefix it will replace the entire default fields. This API route restricts the fields that can be selected. Learn how to override the retrievable fields in the Retrieve Custom Links documentation.Request body (application/json)
emailstringcompany_namestringfirst_namestringlast_namestringphonestringmetadataobjectadditional_dataobjectOptionaladditional_data parameter.Request examples
Responses
200 OK
customerobjectThe customer's details.
customerobject400, 401, 404, 409, 422, 500: an error response is returned.
Emitted events
customer.updated: Emitted when a customer is updated.
DELETE /admin/customers/{id}#
Delete a Customer
Delete a customer.
Authentication: secret API key (HTTP Basic authorization), cookie session, JWT bearer token.
Path parameters
idstringRequest examples
Responses
200 OK
idstringobjectstringdeletedboolean400, 401, 404, 409, 422, 500: an error response is returned.
Emitted events
customer.deleted: Emitted when a customer is deleted.
GET /admin/customers/{id}/addresses#
List Addresses
Retrieve a list of addresses in a customer. The addresses can be filtered by fields like query. The addresses can also be paginated.
Authentication: secret API key (HTTP Basic authorization), cookie session, JWT bearer token.
Path parameters
idstringQuery parameters
fieldsstringOptional+ it will be added to the default fields, using - will remove it from the default fields. without prefix it will replace the entire default fields. This API route restricts the fields that can be selected. Learn how to override the retrievable fields in the Retrieve Custom Links documentation.offsetnumberOptionallimitnumberOptionalorderstringOptional-.qstringOptionalcompanystring | string[]Optionalcitystring | string[]Optionalcountry_codestring | string[]Optionalprovincestring | string[]Optionalpostal_codestring | string[]Optional$andobject[]Optional$orobject[]Optionalwith_deletedbooleanOptionalRequest examples
Responses
200 OK
limitnumberoffsetnumbercountnumberaddressesobject[]The customer addresses.
addressesobject[]400, 401, 404, 409, 422, 500: an error response is returned.
POST /admin/customers/{id}/addresses#
Add a Customer Address
Add an address to a customer.
Authentication: secret API key (HTTP Basic authorization), cookie session, JWT bearer token.
Path parameters
idstringQuery parameters
fieldsstringOptional+ it will be added to the default fields, using - will remove it from the default fields. without prefix it will replace the entire default fields. This API route restricts the fields that can be selected. Learn how to override the retrievable fields in the Retrieve Custom Links documentation.Request body (application/json)
address_namestringis_default_shippingbooleanOptionalis_default_billingbooleanOptionalcompanystringfirst_namestringlast_namestringaddress_1stringaddress_2stringcitystringcountry_codestringprovincestringus-capostal_codestringphonestringmetadataobjectadditional_dataobjectOptionaladditional_data parameter.Request examples
Responses
200 OK
customerobjectThe customer's details.
customerobject400, 401, 404, 409, 422, 500: an error response is returned.
GET /admin/customers/{id}/addresses/{address_id}#
List Addresses
Retrieve a list of a customer's addresses. The addresses can be filtered by fields like company. The addresses can also be paginated.
Authentication: secret API key (HTTP Basic authorization), cookie session, JWT bearer token.
Path parameters
idstringaddress_idstringQuery parameters
fieldsstringOptional+ it will be added to the default fields, using - will remove it from the default fields. without prefix it will replace the entire default fields. This API route restricts the fields that can be selected. Learn how to override the retrievable fields in the Retrieve Custom Links documentation.Request examples
Responses
200 OK
addressobjectThe customer's address.
addressobject400, 401, 404, 409, 422, 500: an error response is returned.
POST /admin/customers/{id}/addresses/{address_id}#
Update a Customer's Address
Update a customer address's details.
Authentication: secret API key (HTTP Basic authorization), cookie session, JWT bearer token.
Path parameters
idstringaddress_idstringQuery parameters
fieldsstringOptional+ it will be added to the default fields, using - will remove it from the default fields. without prefix it will replace the entire default fields. This API route restricts the fields that can be selected. Learn how to override the retrievable fields in the Retrieve Custom Links documentation.Request body (application/json)
address_namestringis_default_shippingbooleanOptionalis_default_billingbooleanOptionalcompanystringfirst_namestringlast_namestringaddress_1stringaddress_2stringcitystringcountry_codestringprovincestringus-capostal_codestringphonestringmetadataobjectadditional_dataobjectOptionaladditional_data parameter.Request examples
Responses
200 OK
customerobjectThe customer's details.
customerobject400, 401, 404, 409, 422, 500: an error response is returned.
DELETE /admin/customers/{id}/addresses/{address_id}#
Remove an Address from Customer
Remove a customer's address.
Authentication: secret API key (HTTP Basic authorization), cookie session, JWT bearer token.
Path parameters
idstringaddress_idstringQuery parameters
fieldsstringOptional+ it will be added to the default fields, using - will remove it from the default fields. without prefix it will replace the entire default fields. This API route restricts the fields that can be selected. Learn how to override the retrievable fields in the Retrieve Custom Links documentation.Request examples
Responses
200 OK
idstringobjectstringdeletedbooleanparentobjectOptionalThe customer's details.
parentobjectOptional400, 401, 404, 409, 422, 500: an error response is returned.
POST /admin/customers/{id}/customer-groups#
Manage Customer Groups of Customer
Manage the customer groups of a customer, adding or removing the customer from those groups.
Authentication: secret API key (HTTP Basic authorization), cookie session, JWT bearer token.
Path parameters
idstringQuery parameters
fieldsstringOptional+ it will be added to the default fields, using - will remove it from the default fields.
without prefix it will replace the entire default fields. This API route restricts the fields that can be selected. Learn how to override the retrievable fields in
the Retrieve Custom Links documentation.Request body (application/json)
addstring[]Optionalremovestring[]OptionalRequest examples
Responses
200 OK
customerobjectThe customer's details.
customerobject400, 401, 404, 409, 422, 500: an error response is returned.