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:
- Run a complete example (including token acquisition) with the Commerce SDK: Quick Start
- Explore APIs interactively: SCAPI Postman Collection
- Use the B2C CLI to verify instance connectivity: B2C CLI, MCP and Tooling SDK
| I want to... | Start here |
|---|---|
| Build a storefront | Composable Storefront uses the Shopper APIs exclusively. |
| Build backend or admin tools | Use the SCAPI Admin APIs with an Account Manager token. |
| Extend existing API behavior | Add custom logic with Hooks. |
| Create new API endpoints | Build Custom APIs under the SCAPI framework. |
| Migrate from OCAPI | See 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:
- Determine your environment (dev, staging, or production), or create an on-demand sandbox.
- Look up your configuration values: Base URL and Request Formation.
- 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 APIs | Admin APIs | |
|---|---|---|
| Purpose | Customer-facing (browsing, cart, checkout) | Merchant-facing (product, order, inventory management) |
| Authentication | SLAS (OAuth 2.1) | Account Manager |
| Scale | High-scale, supports anonymous users | Moderate usage |
| Access | Read-only (exceptions: Baskets, Orders) | Read and write |
| Naming | API names start with "Shopper" | No naming convention |
| Package | Description | Docs |
|---|---|---|
commerce-sdk | Node.js (server-side or CLI) | Docs |
commerce-sdk-isomorphic | Isomorphic (server + browser) | Docs |
@salesforce/commerce-sdk-react | React hooks for SCAPI | Docs |
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.