sfcc-ocapi-scapi

sfcc-ocapi-scapi is a skill for Claude Code, Codex from finsilabs/awesome-ecommerce-skills. It costs 34 tokens per session (3,634 once invoked), scanned B, original, MIT.

A guide to Salesforce Commerce Cloud's APIs for building storefronts and mobile shopping applications separately from the commerce system. OCAPI is the older API family, while SCAPI is the newer one.

In plain words
What is it for?
It is for building headless storefronts, mobile apps, Salesforce PWA Kit integrations, order-management tools, and customer authentication flows.
Why use it?
It helps developers connect custom shopping experiences to product catalogs, carts, checkout, customers, and orders.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one. Also seen: mentions Codex; mentions Gemini CLI; mentions OpenCode.

Good fit It is for building headless storefronts, mobile apps, Salesforce PWA Kit integrations, order-management tools, and customer authentication flows.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/finsilabs/awesome-ecommerce-skills/sfcc-ocapi-scapi
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add finsilabs/awesome-ecommerce-skills --skill sfcc-ocapi-scapi
Clone the repo
git clone --depth 1 https://github.com/finsilabs/awesome-ecommerce-skills

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for sfcc-ocapi-scapi

README.md
[![agentmods](https://agentmods.dev/badge/skills/finsilabs/awesome-ecommerce-skills/sfcc-ocapi-scapi/github.svg)](https://agentmods.dev/skills/finsilabs/awesome-ecommerce-skills/sfcc-ocapi-scapi)
Your own site
<a href="https://agentmods.dev/skills/finsilabs/awesome-ecommerce-skills/sfcc-ocapi-scapi"><img src="https://agentmods.dev/badge/skills/finsilabs/awesome-ecommerce-skills/sfcc-ocapi-scapi/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for sfcc-ocapi-scapi

Your own site · 80×15
<a href="https://agentmods.dev/skills/finsilabs/awesome-ecommerce-skills/sfcc-ocapi-scapi"><img src="https://agentmods.dev/badge/skills/finsilabs/awesome-ecommerce-skills/sfcc-ocapi-scapi.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 34 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,634 The whole file, excluding the scripts and references it only reads on demand.
Security scan B 2 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00034 $0.03634
Opus 5 $0.00017 $0.01817
Sonnet 5 $0.00007 $0.00727
Haiku 4.5 $0.00003 $0.00363

Measured 7d ago against content hash eee4f765f10f, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-10, from the pricing page.

Security

Grade B, and why

sfcc-ocapi-scapi scanned grade B with 2 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 7d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Sends data to an external URLmediumData exfiltration

A POST to an outside endpoint may be telemetry or may be exfiltration; either way the mod talks to somewhere, and you should know where.

const response = await fetch("https://account.demandware.com/dwsso/oauth2/access_token", { method: "POST",

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

const authResponse = await fetch(authorizeUrl.toString(), { redirect: "manual" });
skills/platform-salesforce-cc/sfcc-ocapi-scapi/SKILL.md · 411 lines

How it starts

The opening of the file, as written. The whole thing — 411 lines — stays where its author put it; the contents beside it link to each section on GitHub.

SFCC OCAPI and Shopper APIs

Overview

Salesforce B2C Commerce provides two API families: the legacy Open Commerce API (OCAPI) using Basic Auth or OAuth and the modern Commerce API (SCAPI/Shopper APIs) using SLAS (Shopper Login and API Access Service) tokens. SCAPI is the recommended approach for headless storefronts, PWA Kit, and third-party integrations. OCAPI remains the primary Data API for server-side admin operations (product import, order management, promotion management). The Composable Storefront (formerly PWA Kit) is built entirely on SCAPI.

When to Use This Skill

  • When building a headless B2C storefront using SFCC as the commerce backend
  • When implementing the Salesforce PWA Kit (Composable Storefront) with custom API calls
  • When integrating a mobile app with SFCC product catalog, cart, and checkout
  • When building server-side order management integrations using OCAPI Data API
  • When migrating an existing OCAPI integration to the newer SCAPI endpoints
  • When implementing SLAS token management for customer authentication flows

Core Instructions

  1. Understand the API landscape

    API Auth Use Case
    SCAPI Shopper APIs SLAS guest/customer token Headless storefront, product search, cart, checkout
    OCAPI Shop API Basic/OAuth Storefront operations from trusted server contexts
    OCAPI Data API Client credentials Admin operations: product import, order management, promotions
    SCAPI Admin APIs Client credentials Modern admin operations (gradually replacing OCAPI Data API)

    Base URL pattern: https://{shortCode}.api.commercecloud.salesforce.com/

  2. Authenticate with SLAS (Shopper Login and API Access Service)

    // lib/sfcc-auth.ts
    const SLAS_BASE = `https://${process.env.SFCC_SHORT_CODE}.api.commercecloud.salesforce.com/shopper/auth/v1`;
    const ORG_ID = process.env.SFCC_ORG_ID!; // f_ecom_xxx format
    const CLIENT_ID = process.env.SFCC_SLAS_CLIENT_ID!;
    
    // Step 1: Get PKCE code challenge for guest token
    function generateCodeChallenge(): { verifier: string; challenge: string } {
      const nodeCrypto = require("crypto");
      const verifier = nodeCrypto.randomBytes(32).toString("hex");
      const hash = nodeCrypto.createHash("sha256").update(verifier).digest("base64url");
      return { verifier, challenge: hash };
    }
    
    // Get a guest access token
    export async function getGuestToken(): Promise<{ access_token: string; refresh_token: string }> {
      const { verifier, challenge } = generateCodeChallenge();
    
      // Step 1: Authorize (get auth code)
      const authorizeUrl = new URL(`${SLAS_BASE}/organizations/${ORG_ID}/oauth2/authorize`);
      authorizeUrl.searchParams.set("client_id", CLIENT_ID);
      authorizeUrl.searchParams.set("channel_id", process.env.SFCC_SITE_ID!);
      authorizeUrl.searchParams.set("redirect_uri", process.env.SFCC_SLAS_REDIRECT_URI!);
      authorizeUrl.searchParams.set("response_type", "code");
      authorizeUrl.searchParams.set("code_challenge", challenge);
      authorizeUrl.searchParams.set("hint", "guest");
    
      // SFCC returns a redirect — extract the code from the Location header
      const authResponse = await fetch(authorizeUrl.toString(), { redirect: "manual" });
      const location = authResponse.headers.get("location") ?? "";
      const code = new URL(location).searchParams.get("code") ?? "";
    
      // Step 2: Exchange code for token
      const tokenResponse = await fetch(
        `${SLAS_BASE}/organizations/${ORG_ID}/oauth2/token`,
        {
          method: "POST",
          headers: { "Content-Type": "application/x-www-form-urlencoded" },
          body: new URLSearchParams({
            grant_type: "authorization_code_pkce",
            code,
            code_verifier: verifier,
            client_id: CLIENT_ID,
            redirect_uri: process.env.SFCC_SLAS_REDIRECT_URI!,
            channel_id: process.env.SFCC_SITE_ID!,
          }),
        }
      );
    
      return tokenResponse.json();
    }
    
    // Refresh an access token
    export async function refreshToken(refreshToken: string) {
      const response = await fetch(`${SLAS_BASE}/organizations/${ORG_ID}/oauth2/token`, {
        method: "POST",
        headers: { "Content-Type": "application/x-www-form-urlencoded" },
        body: new URLSearchParams({
          grant_type: "refresh_token",
          refresh_token: refreshToken,
          client_id: CLIENT_ID,
        }),
      });
      return response.json();
    }
    

Read the full file on GitHub · 411 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 7d ago First seen · 411 lines · 34 tokens per session scan B eee4f765f10f

Subscribe to this mod's changes

sfcc-ocapi-scapi is a skill published in the GitHub repository finsilabs/awesome-ecommerce-skills (52 stars, last pushed 6mo ago), licensed MIT. It adds 34 tokens to every session and 3,634 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it B with 2 findings (sends data to an external url, makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.

Related

Other skills, from other repositories

b2c-custom-job-steps

Create custom job steps for B2C Commerce batch processing. Use this skill whenever the user needs to write a batch job, data export script, scheduled cleanup task, or any server-side processing that runs on a schedule. Also use when they ask about steptypes.json, chunk-oriented vs task-oriented job steps…

SalesforceCommerceCloud/b2c-developer-tooling · 148 tokens

b2c-business-manager-extensions

Build Business Manager extension cartridges with custom admin tools, menu items, and dialog actions. Use this skill whenever the user needs to create bm cartridges, add menu actions or dialog buttons in BM, configure bmextensions.xml, or extend admin pages with form overlays. Also use when customizing the BM interface…

SalesforceCommerceCloud/b2c-developer-tooling · 90 tokens

b2c-custom-api-development

Develop Custom SCAPI REST endpoints with api.json routes, schema.yaml definitions, and OAuth scope configuration. Use this skill whenever the user needs to create a custom API on the Commerce platform, define OpenAPI 3.0 schemas for request/response, structure the rest-apis cartridge folder, or debug endpoint…

SalesforceCommerceCloud/b2c-developer-tooling · 152 tokens

b2c-metadata

Define custom attributes, custom object types, and site preferences for B2C Commerce using metadata XML. Use this skill whenever the user needs to add a field to products, orders, or customers, create a new custom object type, set up site preferences, or extend the B2C data model. Also use when they ask about…

SalesforceCommerceCloud/b2c-developer-tooling · 118 tokens

b2c-scapi-admin

Build backend integrations that sync data between B2C Commerce and external systems like ERPs, OMS, WMS, or CRMs using SCAPI Admin APIs. Use this skill whenever the user needs to pull or push orders, products, inventory, or customer data programmatically from a backend service, set up server-to-server authentication…

SalesforceCommerceCloud/b2c-developer-tooling · 142 tokens

b2c-scapi-shopper

Call Shopper Commerce APIs (SCAPI) from headless storefronts and composable commerce apps. Use this skill whenever the user is building with PWA Kit, Storefront Next (SFNext), or a headless frontend and needs to search products, manage baskets, submit orders, access customer data, or set shopper context. Also use when…

SalesforceCommerceCloud/b2c-developer-tooling · 118 tokens