What we do
Tools
Industries
Department
How we workLet's talk →
Salesforce Commerce Cloud

SCAPI: The Salesforce B2C Commerce API, and How Its Auth Fits Together

SCAPI is the REST API for Salesforce B2C Commerce, the platform that used to be Demandware. It has two halves that authenticate differently: Shopper APIs for anything a customer does on the storefront, and Admin APIs for back-office work like orders, products and inventory. Most first-week confusion comes from mixing the two up.

SCAPI in three lines

Shopper APIs (product search, baskets, checkout, customer accounts) take a token from SLAS, the Shopper Login and API Access Service. Guest or registered shopper, the token is a JWT that lasts 30 minutes.

Admin APIs (orders, catalogs, inventory, promotions) take a token from Account Manager, using an API client's ID and secret with SALESFORCE_COMMERCE_API scopes.

Every call goes to your realm's short code host and names your organization ID, and Shopper calls also pass the siteId.

Business Manager Administration Site Development Salesforce Commerce API Settings

Which client and token for which job

What you are building Use Watch for
A headless storefront that runs in the browser (PWA Kit or your own SPA) A public SLAS client, with the authorization code flow and PKCE Refresh tokens are single use. Each refresh returns a new one, and the app has to store it, or the shopper's next refresh fails.
A storefront with a server in front of it (backend-for-frontend, full-stack app) A private SLAS client, with the secret kept on the server The secret must never reach the browser bundle. If it does, treat it as leaked and rotate it.
An ERP, OMS, PIM or warehouse integration with no shopper involved An Account Manager API client calling the Admin APIs Scopes. A token without the sfcc scope for the resource you call (orders, products, inventory) is rejected even when the client itself is valid.
Logic the standard endpoints don't cover A custom API in a cartridge, or a hook on an existing endpoint Custom APIs need an OAS 3.0 contract, an api.json mapping and a script whose function name matches the operationId. A mismatch fails quietly at registration.

Your first Shopper API call, start to finish

The fastest way to prove the setup works is a guest product search. If this call works, your short code, org ID, SLAS client and site are all wired correctly.

  1. 1

    Find your short code and organization ID

    Business Manager Administration Site Development Salesforce Commerce API Settings

    The short code is the start of your API host name. The organization ID usually starts with f_ecom_ and ends with your realm and instance. If the realm has never used SCAPI, request a short code here first.

    Watch for: a freshly requested short code can take up to 24 hours to work. Calls fail with DNS errors until then, which looks like a code bug and isn't.

  2. 2

    Create a SLAS client

    Use the SLAS Admin UI or SLAS Admin API to create a client for your site, choose public or private, list your redirect URIs, and give it the shopper scopes the storefront needs.

  3. 3

    Get a guest token

    Ask SLAS for a guest token. A private client can do this server to server with its secret. A public client goes through the authorize step with a PKCE code challenge, then trades the code for tokens.

  4. 4

    Call Shopper Search

    Send a product search to https://{shortCode}.api.commercecloud.salesforce.com/search/shopper-search/v1/organizations/{organizationId}/product-search with siteId and a q parameter, and the access token as a Bearer header.

    Watch for: the siteId must be a site the SLAS client was created for. A valid token for the wrong site still gets refused.

SCAPI errors that eat a day

Shoppers get logged out after the first refresh

How you'll know: Refresh works once, then fails with an invalid grant.

Fix: On a public client each refresh token can only be used once. Save the new refresh token from every response, and make sure two browser tabs aren't refreshing at the same moment.

Admin API calls return 403 with a valid token

How you'll know: The Account Manager token comes back fine, but every order or product call is forbidden.

Fix: Check the scope string. It needs SALESFORCE_COMMERCE_API with your tenant, plus the specific sfcc scope for that resource. Also check the API client is allowed on that organization in Account Manager.

Calls work on the sandbox, fail on production

How you'll know: Same code, same client, 401s or 404s in production.

Fix: Production has its own organization ID and often its own clients. Keep short code, org ID, client IDs and site IDs per environment in config, never hard-coded.

An integration polls orders every minute and gets throttled

How you'll know: 429 responses at busy times, missing orders in the ERP.

Fix: SCAPI enforces rate limits. Pull changed orders by date with paging, back off on 429s, and keep a cursor so a failed run picks up where it stopped instead of skipping orders.

SCAPI vs OCAPI

OCAPI

Open Commerce API, the original

  • Shop API for storefront calls, Data API for admin work.
  • Configured per instance in Business Manager with JSON permission settings.
  • Now marked deprecated by Salesforce.
  • Still what many long-running integrations call today.
SCAPI

B2C Commerce API, the current one

  • Shopper APIs for storefront calls, Admin APIs for admin work.
  • SLAS and Account Manager tokens with scopes, instead of OCAPI settings.
  • What PWA Kit and the Composable Storefront call.
  • Where Salesforce says new projects and major refactors should start.

Build anything new on SCAPI. For an OCAPI integration that works, move it when you're already changing it, and check SCAPI covers every call it makes before you plan the cutover.

When there is no endpoint at all

Some Business Manager work has no clean SCAPI or OCAPI equivalent: certain merchandising settings, some promotion setups, and anything an older site still does in custom pipeline code. If a workflow depends on one of those, no API client will do it.

Two ways out. If the data is reachable from the Script API, a custom API in a cartridge can expose it on your own terms. If it really only exists on a Business Manager screen, n-frames automates that screen with a headless browser, the same clicks a merchandiser would make, and posts the result back to whatever system is waiting. It's the fallback, not the first choice, and it gets monitored like any other integration.

For the storefront side of the same platform, see headless Salesforce Commerce Cloud.

Questions people ask

What's the difference between SCAPI and OCAPI?

SCAPI (the Salesforce B2C Commerce API) is the current REST API, split into Shopper and Admin APIs and authorized with SLAS and Account Manager tokens. OCAPI (Open Commerce API) is the older REST API from the Demandware era, split into Shop and Data APIs and configured per instance in Business Manager.

Is OCAPI being deprecated?

Yes. Salesforce now marks OCAPI as deprecated and tells teams to use SCAPI for all new projects and major refactoring. It hasn't published one retirement date for every OCAPI resource, so existing integrations keep working, but plan their move.

How do I authenticate with Salesforce Commerce Cloud's API?

It depends which half you call. Shopper APIs take a SLAS token, from a public client using PKCE or a private client using its secret. Admin APIs take an Account Manager token from an API client ID and secret with the right SALESFORCE_COMMERCE_API and sfcc scopes.

What was Demandware?

Demandware was the e-commerce platform Salesforce bought in 2016 and renamed Salesforce Commerce Cloud. You still see the name in Account Manager URLs, OCAPI paths, cartridge code and older job listings.

Can I add my own endpoints to SCAPI?

Yes, with custom APIs. You define the contract in OAS 3.0 inside a cartridge's rest-apis folder, map it in api.json, and implement it in a script. They're called like any other SCAPI endpoint, with the same token types.

Let's talk

Tell us the one thing your team does manually that eats up time. We read every message and reply within a day.