Sales Channels API Routes

A sales channel indicates a channel where products can be sold in. For example, a webshop or a mobile app.

These API routes allow admins to manage sales channels and the products available in them.

GET /admin/sales-channels#

List Sales Channels

Retrieve a list of sales channels. The sales channels can be filtered by fields such as id. The sales channels can also be sorted or paginated.

Authentication: secret API key (HTTP Basic authorization), cookie session, JWT bearer token.

Query parameters

fieldsstringOptional
Comma-separated fields that should be included in the returned data. if a field is prefixed with + 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.
offsetnumberOptional
The number of items to skip when retrieving a list.
limitnumberOptional
Limit the number of items returned in the list.
orderstringOptional
The field to sort the data by. By default, the sort order is ascending. To change the order to descending, prefix the field name with -.
qstringOptional
Search term to filter the sales channel's searchable properties.
idstring | string[]Optional
Filter by a sales channel ID.
namestring | string[]Optional
Filter by a sales channel name.
descriptionstringOptional
The sales channel's description.
is_disabledbooleanOptional
Filter by whether the sales channel is disabled.
created_atobjectOptional
Filter by a sales channel's creation date. Accepts the filter operators.
updated_atobjectOptional
Filter by a sales channel's update date. Accepts the filter operators.
deleted_atobjectOptional
Filter by a sales channel's deletion date. Accepts the filter operators.
location_idstring | string[]Optional
Filter by a location ID to retrieve its associated sales channels.
publishable_key_idstring | string[]Optional
Filter by a publishable API key's ID to retrieve its associated sales channels.
$andobject[]Optional
Join query parameters with an AND condition. Each object's content is the same type as the expected query parameters.
$orobject[]Optional
Join query parameters with an OR condition. Each object's content is the same type as the expected query parameters.
with_deletedbooleanOptional
Whether to include deleted records in the result.

Request examples

Responses

200 OK

limitnumber
The maximum number of items returned.
offsetnumber
The number of items skipped before retrieving the returned items.
countnumber
The total number of items.
sales_channelsobject[]
The list of sales channels.

400, 401, 404, 409, 422, 500: an error response is returned.


POST /admin/sales-channels#

Create Sales Channel

Create a sales channel.

Authentication: secret API key (HTTP Basic authorization), cookie session, JWT bearer token.

Query parameters

fieldsstringOptional
Comma-separated fields that should be included in the returned data. if a field is prefixed with + 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)

namestring
The sales channel's name.
descriptionstringOptional
The sales channel's description.
is_disabledbooleanOptional
Whether the sales channel is disabled.
metadataobjectOptional
The sales channel's metadata, used to store custom key-value pairs. Learn more in the Manage Metadata section.

Request examples

Responses

200 OK

sales_channelobject
The sales channel's details.

400, 401, 404, 409, 422, 500: an error response is returned.

Emitted events

  • sales-channel.created: Emitted when sales channels are created.

GET /admin/sales-channels/{id}#

Get a Sales Channel

Retrieve a sales channel by its ID. You can expand the sales channel's relations or select the fields that should be returned.

Authentication: secret API key (HTTP Basic authorization), cookie session, JWT bearer token.

Path parameters

idstring
The sales channel's ID.

Query parameters

fieldsstringOptional
Comma-separated fields that should be included in the returned data. if a field is prefixed with + 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

sales_channelobject
The sales channel's details.

400, 401, 404, 409, 422, 500: an error response is returned.


POST /admin/sales-channels/{id}#

Update a Sales Channel

Update a sales channel's details.

Authentication: secret API key (HTTP Basic authorization), cookie session, JWT bearer token.

Path parameters

idstring
The sales channel's ID.

Query parameters

fieldsstringOptional
Comma-separated fields that should be included in the returned data. if a field is prefixed with + 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)

namestringOptional
The sales channel's name.
descriptionstringOptional
The sales channel's description.
is_disabledbooleanOptional
Whether the sales channel is disabled.
metadataobjectOptional
The sales channel's metadata, can hold custom key-value pairs. Learn more in the Manage Metadata section.

Request examples

Responses

200 OK

sales_channelobject
The sales channel's details.

400, 401, 404, 409, 422, 500: an error response is returned.

Emitted events

  • sales-channel.updated: Emitted when sales channels are updated.

DELETE /admin/sales-channels/{id}#

Delete a Sales Channel

Delete a sales channel.

Authentication: secret API key (HTTP Basic authorization), cookie session, JWT bearer token.

Path parameters

idstring
The sales channel's ID.

Request examples

Responses

200 OK

idstring
The sales channel's ID.
objectstring
The name of the deleted object.

Default: "sales-channel"

deletedboolean
Whether the sales channel was deleted.

400, 401, 404, 409, 422, 500: an error response is returned.

Emitted events

  • sales-channel.deleted: Emitted when sales channels are deleted.

POST /admin/sales-channels/{id}/products#

Manage Products in Sales Channel

Manage products in a sales channel to add or remove them from the channel.

Authentication: secret API key (HTTP Basic authorization), cookie session, JWT bearer token.

Path parameters

idstring
The sales channel's ID.

Query parameters

fieldsstringOptional
Comma-separated fields that should be included in the returned data. if a field is prefixed with + 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[]Optional
The IDs of an entity to add to the other.
removestring[]Optional
The IDs of an entity to remove from the other.

Request examples

Responses

200 OK

sales_channelobject
The sales channel's details.

400, 401, 404, 409, 422, 500: an error response is returned.

Emitted events

  • product.updated: Emitted when products are updated.
Found a problem with this page?Report Issue
Edited Nov 14·Edit this page