Retail Cloud API Developer Guide for Hyperforce Users

Accessing Retail Cloud's APIs externally from Hyperforce involves a secure, token-based authentication process. This guide outlines the steps required to generate a JSON Web Token (JWT) and invoke the Retail Cloud API.

For a comprehensive list of APIs and SPIs, see Retail Cloud API Specifications.

Create an external client app with OAuth and JWT enabled. See Create a Local External Client App in Salesforce Help.

JWT generation requires the domain, consumer key, and consumer secret, all sourced from the Salesforce Org where the merchant is configured.

The API token must come from the same Salesforce Org as the merchant. Tokens from a different Org fail authentication.

  1. Log into the Organization or Sandbox Organization where the merchant was created.
  2. From Setup, in the Quick Find box, enter "External Client Apps", and then select External Client Apps Manager.
  3. Select the merchant's app, and click the Settings tab.
  4. Expand the OAuth Settings section.
  5. Click the Consumer Key and Secret button, and copy the key and secret. Save these values in a secure location.
  6. From Setup, in the Quick Find box, enter "My Domain", and then select My Domain.
  7. Copy the value shown in the Current My Domain URL field. Save this value in a secure location.

mceclip0.png

Request a JWT from Salesforce. Use this example POST request as a starting point. Replace the domain, client ID, and client Secret with the values you copied from Step 1.

Sample Token Request

Sample Response

Extract the access token value from the response. This token is used for the Authorization header in the API requests.

Sample Authorization Header

API requests require the headers in this list. The x-locale and x-region headers are merchant-specific, not Org-specific. A single Org (or Sandbox Org) can contain multiple merchants. These headers help route the request to the correct merchant within the Org.

  • x-salesforce-region
  • Content-Type
  • x-locale
  • x-region
  • Authorization

Ensure Content-Type is set to application/json in all requests.

The base URL and x-salesforce-region header value depend on the merchant's environment. Use the correct values to ensure successful API requests. Make sure that the region and locale values match the region and locale for the merchant.

EnvironmentProduction Endpoint (Non-Sandbox)Sandbox EndpointRequired x-salesforce-region Value
Productionhttps://api.salesforce.com/commerce/retailcloud/v1-alpha.1https://api.salesforce.com/commerce/retailcloud/v1-alpha.1/sandboxus-east-2
Staginghttps://stage.api.salesforce.com/commerce/retailcloud/v1-alpha.1https://stage.api.salesforce.com/commerce/retailcloud/v1-alpha.1/sandboxus-east-2
Testhttps://test.api.salesforce.com/commerce/retailcloud/v1-alpha.1https://test.api.salesforce.com/commerce/retailcloud/v1-alpha.1/sandboxus-west-2
Devhttps://dev.api.salesforce.com/commerce/retailcloud/v1-alpha.1https://dev.api.salesforce.com/commerce/retailcloud/v1-alpha.1/sandboxus-west-2

Example Request

This example targets a Production Sandbox environment.