API specification

Basic info about endpoints, resources, credentials, and environments

Commerce Layer exposes a fast RESTarrow-up-right API that lets you add ecommerce to your favorite tech stack.

Commerce Layer API is 100% compliant with the JSON APIarrow-up-right specification (v1.0). It supports compound documents, sparse fieldsets, resource linking, filtering, sorting, pagination, and more. The JSON API community has shared some client librariesarrow-up-right that can help you get started.

circle-exclamation

The guide that follows is your reference for all the operations that you can perform on the API resources and contains all the information you need to get a comprehensive overview of how it works.

Authentication

All API requests must be authenticated. To get a valid access token you need to send a POST request to the following endpoint:

https://auth.commercelayer.io/oauth/token
Authenticationchevron-right

Base endpoint

Once you have a valid token, all API requests must be made over HTTPSarrow-up-right to the following base endpoint:

https://yourdomain.commercelayer.io

Where yourdomain is the unique subdomain of your organization.

Core resources

Commerce Layer commerce API features 400+ endpoints. Check our API referencearrow-up-right for the complete and updated list of all the core resources, in detail. For each single resource you will find:

  • The resource object and its fields, attributes, and relationships.

  • The allowed CRUD operations you can perform on the related endpoint with basic examples of the request/response format.

Credentials

Commerce Layer implements the industry-standard OAuth 2.0arrow-up-right protocol to manage clients' authorization. It defines three types of API credentials: sales channel, integration, webapp. Which one to use depends on your specific need. You can leverage our how-tos to get started with the most popular use cases.

Environments

For each organization, you can work either in test mode (default) or live mode.

circle-info

Working in test mode is free forever. You can try Commerce Layer in test mode as long as you need to.

Test mode also provides you with a development environment after the go-live. All API calls are identical between the two environments. Use test or live API credentials to make the switch.

circle-exclamation
circle-check

Open-source projects and developer tools

JS SDKarrow-up-right, CLIarrow-up-right, and React componentsarrow-up-right are available as open-source projects. More libraries and SDKs for the most popular languages are coming soon. We also provide a tested and constantly updated OpenAPI schemaarrow-up-right you can leverage to build mock servers, auto-generate code, and implement contract testing.

Changelog

To stay up-to-date with any changes we make on Commerce Layer APIs, apps, and open-source projects (including versioning, product releases, new features, and general improvements), make sure to check our changelog.

Last updated