Commerce Layer Core API (2024-09-05)

Number of APIs: 553

This is the latest collection for the Commerce Layer API updated on 2024-09-05 16:16:32 +0200. You can check our Changelog for updates on product releases, new features, and general improvements.

Getting Started

Step One: Fork Collection

To get started, kindly click on the button below to fork the collection.

[Run in Qodex]

Step Two: Get Access Token

All requests to Commerce Layer API must be authenticated with an OAuth2 bearer token. To get an access token, you need to execute an authorization flow by using a valid application type as the client. Each application type has its own usage, authentication flow, and permissions. There are three application types: sales channel, integration, and webapp. Each of these applications can be authenticated with different authorization grant flows using the available authorization grant types as described in the table below:

Commerce Layer authorization flows table
  • The client credentials grant type gives you a “guest” access token to both sales channel and integration applications.
  • The password grant type gives you an access token to sales channel applications in exchange for customer credentials.
  • The authorization code grant type is used by backend applications to exchange an authorization code for an access token.
  • The refresh token grant type is used by clients to exchange a refresh token for an expired access token.

Each access token generated based on the application types gets a specific set of permissions. For example, sales channel applications can read resource lists only for SKUs, SKU options, prices, promotions, and bundles. Anything outside this will require another application type. You can read the documentation to learn more about the available roles and permissions or for further information on authentication with Commerce Layer API. We also have a JavaScript authentication library you can easily use to generate any type of access token.

Step Three: Set Environment

To make it easier to make requests across all the resources with the same credentials, you can create an Environment to use across the forked collection following the steps below.

  1. Click on the “Environments” tab and click on “Create Environment” at the top left corner of the page.
  2. Fill out the form and add a subdomain and access_token variable with your Commerce Layer organization slug and access token.
  3. Click on the “💾  Save” icon to save the environment variables you have created.
  4. You can also edit the name of the Environment by highlighting the existing “New Environment” name just above the form. You will see an edit icon you can click on to enter a new name.

Step Four: Make API Requests

If everything is added correctly, you can head back to the collection, select the environment and begin making use of the collection.

For example, you can use the SKU resource to List all SKUs, and all you need to do is hit the “Send” button.

A screenshot of an SKU request on Qodex
  1. Addresses - Retrieve an address GET https://{{subdomain}}.commercelayer.io/api/addresses/{{address_id}}

  2. Adjustments - Retrieve an adjustment GET https://{{subdomain}}.commercelayer.io/api/adjustments/{{adjustment_id}}

  3. Authorizations - Retrieve an authorization GET https://{{subdomain}}.commercelayer.io/api/authorizations/{{authorization_id}}

  4. Customer Password Resets - Create a customer password reset POST https://{{subdomain}}.commercelayer.io/api/customer_password_resets

  5. Google Geocoders - Retrieve a google geocoder GET https://{{subdomain}}.commercelayer.io/api/google_geocoders/{{google_geocoder_id}}

  6. Order Subscription Items - Delete an order subscription item DELETE https://{{subdomain}}.commercelayer.io/api/order_subscription_items/{{order_subscription_item_id}}

  7. Payment Methods - Update a payment method PATCH https://{{subdomain}}.commercelayer.io/api/payment_methods/{{payment_method_id}}

  8. Shipping Categories - Create a shipping category POST https://{{subdomain}}.commercelayer.io/api/shipping_categories

  9. Stock Reservations - Retrieve a stock reservation GET https://{{subdomain}}.commercelayer.io/api/stock_reservations/{{stock_reservation_id}}

  10. Tax Categories - List all tax categories GET https://{{subdomain}}.commercelayer.io/api/tax_categories