b2c-custom-api-development

Design and deploy Custom SCAPI endpoints for B2C Commerce.

51|16|Updated Oct 31, 2025
One-click install
npx skills add https://github.com/SalesforceCommerceCloud/b2c-developer-tooling --skill b2c-custom-api-development
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: b2c-custom-api-development
Source: https://github.com/SalesforceCommerceCloud/b2c-developer-tooling/tree/main/skills/b2c/skills/b2c-custom-api-development
Command: npx skills add https://github.com/SalesforceCommerceCloud/b2c-developer-tooling --skill b2c-custom-api-development

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Develop Custom SCAPI endpoints for Salesforce B2C Commerce by enabling REST endpoints backed by custom script logic. This skill guides you through creating contracts, implementing endpoint logic, and mapping endpoints to scripts within a cartridge.

Core Features & Use Cases

  • API Contract (schema.yaml): Define an OpenAPI 3.0 contract with security, parameters, and paths for your custom API.
  • Implementation (script.js): Export public handler functions that interact with the B2C Script API and return RFC 9457 compliant responses.
  • Mapping (api.json): Bind endpoints to specific implementations for deployment.
  • Cartridge Structure: Organize files under rest-apis/{api-name}/ containing api.json, schema.yaml, and script.js.
  • Use Case: Create a new custom API for order lookups and expose it as a REST endpoint.

Quick Start

Create cartridge structure at rest-apis/{api-name}/ with api.json, schema.yaml, and script.js. Define the contract in schema.yaml, implement logic in script.js, and bind endpoints in api.json. Deploy and activate with the b2c CLI (e.g., b2c code deploy ./my-cartridge --reload) and verify registration status with b2c scapi custom status --tenant-id <tenant-id>.

Frequently Asked Questions about b2c-custom-api-development

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I create a custom SCAPI endpoint for B2C Commerce?

To create a custom SCAPI endpoint for B2C Commerce, organize files in a cartridge under rest-apis/{api-name}/, define the OpenAPI contract in schema.yaml, implement logic in script.js, and bind endpoints in api.json.

What is the api.json file used for in B2C Commerce custom APIs?

The api.json file is used to map and bind custom SCAPI endpoints to their specific script implementations within a B2C Commerce cartridge for deployment.

How do I deploy and verify custom REST endpoints using the b2c CLI?

Deploy custom REST endpoints using the b2c CLI with the command b2c code deploy ./my-cartridge --reload, then verify registration status by running b2c scapi custom status --tenant-id <tenant-id>.

Can I define OpenAPI 3.0 contracts for Salesforce B2C Commerce custom APIs?

Yes, you can define an OpenAPI 3.0 contract for Salesforce B2C Commerce custom APIs by specifying security, parameters, and paths in the schema.yaml file within your cartridge structure.

How should custom API responses be formatted in B2C Commerce script.js files?

Custom API responses in B2C Commerce script.js files should be formatted as RFC 9457 compliant responses, with public handler functions interacting with the B2C Script API to return the results.

Do I need a specific cartridge structure to build custom SCAPI endpoints?

Yes, building custom SCAPI endpoints requires a specific cartridge structure where files are organized under rest-apis/{api-name}/, containing the api.json, schema.yaml, and script.js files.