Collections API Routes
A product collection organizes products into a collection for marketing purposes. For example, a summer collection.
These API routes allow admin users to manage collections and the products in them.
GET /admin/collections#
List Collections
Retrieve a list of collections. The collections can be filtered by fields such as id. The collections 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-.deleted_atobjectOptionalqstringOptionalidstring | string[]Optionalhandlestring | string[]Optionaltitlestring | string[]Optionalcreated_atobjectOptionalupdated_atobjectOptional$andobject[]Optional$orobject[]Optionalwith_deletedbooleanOptionalexternal_idstring | string[]OptionalRequest examples
Responses
200 OK
limitnumberoffsetnumbercountnumbercollectionsobject[]The list of product collections.
collectionsobject[]estimate_countnumberOptional400, 401, 404, 409, 422, 500: an error response is returned.
POST /admin/collections#
Create Collection
Create a collection.
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)
titlestringhandlestringOptionalmetadataobjectOptionaladditional_dataobjectOptionaladditional_data parameter.Request examples
Responses
200 OK
collectionobjectThe product collection's details.
collectionobject400, 401, 404, 409, 422, 500: an error response is returned.
Emitted events
product-collection.created: Emitted when product collections are created.
GET /admin/collections/{id}#
Get a Collection
Retrieve a collection by its ID. You can expand the collection's relations or select the fields that should be returned using the query parameters.
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
collectionobjectThe product collection's details.
collectionobject400, 401, 404, 409, 422, 500: an error response is returned.
POST /admin/collections/{id}#
Update a Collection
Update a collection'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)
titlestringOptionalhandlestringOptionalmetadataobjectOptionaladditional_dataobjectOptionaladditional_data parameter.Request examples
Responses
200 OK
collectionobjectThe product collection's details.
collectionobject400, 401, 404, 409, 422, 500: an error response is returned.
Emitted events
product-collection.updated: Emitted when product collections are updated.
DELETE /admin/collections/{id}#
Delete a Collection
Delete a product collection.
Authentication: secret API key (HTTP Basic authorization), cookie session, JWT bearer token.
Path parameters
idstringRequest examples
Responses
200 OK
idstringobjectstringDefault: "collection"
deletedboolean400, 401, 404, 409, 422, 500: an error response is returned.
Emitted events
product-collection.deleted: Emitted when product collections are deleted.
POST /admin/collections/{id}/products#
Manage Products of a Collection
Manage the products of a collection by adding or removing them from the collection.
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
collectionobjectThe product collection's details.
collectionobject400, 401, 404, 409, 422, 500: an error response is returned.
Emitted events
product.updated: Emitted when products are updated.