Customer Groups API Routes
Customers can be organized into groups. These groups are useful for segregation and marketing purposes.
For example, you can provide different prices for specific customers by creating a price list conditioned to their group.
These API routes allow admin users to manage groups and the customers in them.
GET /admin/customer-groups#
List Customer Groups
Retrieve a list of customer groups. The customer groups can be filtered by fields such as id. The customer groups 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.offsetnumberOptionallimitnumberOptionalorderstringOptional-.qstringOptionalidstring | string[]Optionalnamestring | string[]Optionalcustomersstring | string[] | objectOptionalFilter by the ID of a customer to retrieve its groups.
customersstring | string[] | objectOptionalcreated_bystring | string[]Optionalcreated_atobjectOptionalupdated_atobjectOptionaldeleted_atobjectOptional$andobject[]Optional$orobject[]Optionalwith_deletedbooleanOptionalRequest examples
Responses
200 OK
limitnumberoffsetnumbercountnumbercustomer_groupsobject[]The list of customer groups.
customer_groupsobject[]400, 401, 404, 409, 422, 500: an error response is returned.
POST /admin/customer-groups#
Create Customer Group
Create a customer group.
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.Request body (application/json)
namestringmetadataobjectOptionalRequest examples
Responses
200 OK
customer_groupobjectThe customer group's details.
customer_groupobject400, 401, 404, 409, 422, 500: an error response is returned.
GET /admin/customer-groups/{id}#
Get a Customer Group
Retrieve a customer group by its ID. You can expand the customer group'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.Request examples
Responses
200 OK
customer_groupobjectThe customer group's details.
customer_groupobject400, 401, 404, 409, 422, 500: an error response is returned.
POST /admin/customer-groups/{id}#
Update a Customer Group
Update a customer group'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.Request body (application/json)
namestringOptionalmetadataobjectOptionalRequest examples
Responses
200 OK
customer_groupobjectThe customer group's details.
customer_groupobject400, 401, 404, 409, 422, 500: an error response is returned.
DELETE /admin/customer-groups/{id}#
Delete a Customer Group
Delete a customer group. Customers in the group aren't deleted.
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.
POST /admin/customer-groups/{id}/customers#
Manage Customers of a Customer Group
Manage the customers of a group to add or remove them from the group.
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.Request body (application/json)
addstring[]Optionalremovestring[]OptionalRequest examples
Responses
200 OK
customer_groupobjectThe customer group's details.
customer_groupobject400, 401, 404, 409, 422, 500: an error response is returned.