Get Started with the B2C Commerce API

The B2C Commerce API (SCAPI) is a set of RESTful APIs for building storefronts, merchant tools, and integrations on the B2C Commerce platform. It also goes by "Salesforce Commerce API" or just "Commerce API." For B2C Commerce customers, the API is available at no extra cost.

To browse the endpoints, see the API Reference. To learn how SCAPI fits into the B2C Commerce stack, see Composable Storefront and SCAPI.

The following two curl commands are all you need to get started. They use a SLAS private client to get a guest token, then fetch a product from the demo sandbox.

Replace {client_id} and {client_secret} with your SLAS private client credentials. (To create a SLAS client, see Authorization for Shopper APIs.)

The response includes an access_token:

Use the access_token from Step 1 to fetch a product:

A successful response returns product details as JSON:

Other ways to get started:

I want to...Start here
Build a storefrontComposable Storefront uses the Shopper APIs exclusively.
Build backend or admin toolsUse the SCAPI Admin APIs with an Account Manager token.
Extend existing API behaviorAdd custom logic with Hooks.
Create new API endpointsBuild Custom APIs under the SCAPI framework.
Migrate from OCAPISee Why Use SCAPI Instead of OCAPI.

If you don't have a B2C Commerce instance, try the demo sandbox used in the example above. It's also used in the Quick Start.

To set up your own instance:

  1. Determine your environment (dev, staging, or production), or create an on-demand sandbox.
  2. Look up your configuration values: Base URL and Request Formation.
  3. Set up API access: Authorization.

SCAPI consists of two API types, plus open-source SDKs and a developer tooling ecosystem. The API type you use depends on your application.

Shopper APIsAdmin APIs
PurposeCustomer-facing (browsing, cart, checkout)Merchant-facing (product, order, inventory management)
AuthenticationSLAS (OAuth 2.1)Account Manager
ScaleHigh-scale, supports anonymous usersModerate usage
AccessRead-only (exceptions: Baskets, Orders)Read and write
NamingAPI names start with "Shopper"No naming convention
PackageDescriptionDocs
commerce-sdkNode.js (server-side or CLI)Docs
commerce-sdk-isomorphicIsomorphic (server + browser)Docs
@salesforce/commerce-sdk-reactReact hooks for SCAPIDocs

For other languages, use the SCAPI Postman Collection or the API specs in commerce-sdk.

To explore SCAPI from your IDE using AI assistants, use the B2C DX MCP Server (Developer Preview).

The following information is important when preparing for production use.

  • SCAPI requests are rate limited to ensure availability.
  • Shopper APIs must respond within 10 seconds; Admin APIs within 60 seconds. See Timeouts and Limits.
  • Request and response bodies have size limits. See Timeouts and Limits.
  • Shopper API requests are routed by USID. Don't reuse the same USID for many guest shoppers.
  • For staging with vanity domains, set up eCDN for Staging.
  • For cross-origin browser access, configure CORS.

Use correlation IDs to match requests to responses. Include a correlation-id header in your request and the response returns it as x-correlation-id. See View SCAPI Logs and Track Requests.

Make sure that your code can handle nonbreaking changes to the API, such as new fields, new optional parameters, or changes to error messages.

SCAPI is updated regularly with new features, bug fixes, and improvements. Updates are announced in Salesforce Status and the SCAPI Release Notes. Some features require specific B2C Commerce versions.

For the full list of nonbreaking change types and the deployment schedule, see the B2C Commerce Deployment Schedule.

Subscribe to availability updates on Salesforce Status. During maintenance, SCAPI returns maintenance responses. For load management details, see Load Shedding and Rate Limiting.

  • For detailed use cases and examples, see Develop.
  • To explore endpoint specifications, see the API Reference.
  • For cross-cutting topics (authentication, caching, hooks, personalization), see General Guidance.