Api Keys API Routes
API keys can be used for authentication or resource-scoping.
A secret API key can be used to authenticate admin users. A publishable API key can be used to scope client requests to one or more sales channels.
These API routes allow admin users to manage both publishable and secret API keys.
GET /admin/api-keys#
List API Keys
Retrieve a list of API keys. The API keys can be filtered by fields such as id. The API keys 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[]Optionaltitlestring | string[]Optionaltokenstring | string[]Optionaltype"secret" | "publishable"Optionalcreated_atobjectOptionalupdated_atobjectOptionaldeleted_atobjectOptionalrevoked_atobjectOptional$andobject[]Optional$orobject[]Optionalwith_deletedbooleanOptionalRequest examples
Responses
200 OK
limitnumberoffsetnumbercountnumberapi_keysobject[]The list of API keys.
api_keysobject[]400, 401, 404, 409, 422, 500: an error response is returned.
POST /admin/api-keys#
Create Api Key
Create a secret or publishable API key. A secret API key is used for admin authentication.
A publishable API key is used by client applications to set the scope of the request.
Authentication: secret API key (HTTP Basic authorization), cookie session, JWT bearer token.
Request body (application/json)
titlestringtype"publishable" | "secret"secret for a user's API key; Use publishable for Publishable API keys.Request examples
Responses
200 OK
api_keyobjectThe API key's details.
api_keyobject400, 401, 404, 409, 422, 500: an error response is returned.
GET /admin/api-keys/{id}#
Get API Key
Retrieve an API key by its ID. You can expand the API key'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
api_keyobjectThe API key's details.
api_keyobject400, 401, 404, 409, 422, 500: an error response is returned.
POST /admin/api-keys/{id}#
Update an API Key
Update an API key'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)
titlestringRequest examples
Responses
200 OK
api_keyobjectThe API key's details.
api_keyobject400, 401, 404, 409, 422, 500: an error response is returned.
DELETE /admin/api-keys/{id}#
Delete an Api Key
Delete a publishable or secret API key.
Authentication: secret API key (HTTP Basic authorization), cookie session, JWT bearer token.
Path parameters
idstringRequest examples
Responses
200 OK
idstringobjectstringDefault: "api_key"
deletedboolean400, 401, 404, 409, 422, 500: an error response is returned.
POST /admin/api-keys/{id}/revoke#
Revoke API Key
Revokes an API key. If the API key is a secret, it can't be used for authentication anymore. If it's publishable, it can't be used by client applications.
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)
revoke_innumberOptionalRequest examples
Responses
200 OK
api_keyobjectThe API key's details.
api_keyobject400, 401, 404, 409, 422, 500: an error response is returned.
POST /admin/api-keys/{id}/sales-channels#
Manage Sales Channels of a Publishable API Key
Manage the sales channels of a publishable API key, either to associate them or remove them from the API key.
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
api_keyobjectThe API key's details.
api_keyobject400, 401, 404, 409, 422, 500: an error response is returned.