Connect Retool to Salesforce Commerce Cloud (SFCC) via a REST API Resource using OCAPI (Open Commerce API) or SCAPI (Salesforce Commerce API) with client credentials authentication. SFCC powers enterprise e-commerce storefronts; connecting it to Retool enables building order management dashboards, product catalog panels, and promotion management tools. Configure the Resource with your SFCC instance URL and OAuth 2.0 client credentials to query orders, products, customers, and inventory data.
| Fact | Value |
|---|---|
| Tool | Salesforce Commerce Cloud |
| Category | Marketing |
| Method | REST API Resource |
| Difficulty | Advanced |
| Time required | 45 minutes |
| Last updated | April 2026 |
Why connect Retool to Salesforce Commerce Cloud?
Salesforce Commerce Cloud powers the e-commerce operations of major retailers, but its Business Manager interface is designed for merchants and merchandisers, not for the operations and engineering teams who need to build custom internal tools. Retool bridges this gap by giving operations teams direct access to SFCC's order, product, customer, and inventory data through its REST APIs, enabling dashboards and workflows that are impossible within Business Manager's UI constraints.
The most impactful Retool use case for SFCC is an order management operations panel that customer service and fulfillment teams use for escalated orders. Rather than requiring CS agents to navigate Business Manager's complex interface, a Retool panel provides a streamlined search by order number, customer email, or tracking number, displaying the order's full status, item details, payment information, and fulfillment status in a clean view. Agents can process returns, update order statuses, and issue promotional codes from the same panel — all using Retool's permission-controlled interface rather than Business Manager's all-or-nothing access model.
SFCC provides two API systems: the older OCAPI (Open Commerce API) used by legacy integrations and the newer SCAPI (Salesforce Commerce API) which follows more modern REST conventions. SCAPI is the recommended choice for new integrations and provides access to orders, products, customer lists, catalogs, promotions, and inventory through a unified API layer. Both systems use OAuth 2.0 client credentials flow, and both are accessible as Retool REST API Resources once credentials are configured. Because SFCC also integrates deeply with Salesforce CRM, Retool dashboards can combine SFCC commerce data with CRM customer records for a unified customer 360 view.
Integration method
Salesforce Commerce Cloud connects via Retool's REST API Resource using either OCAPI (the older Open Commerce API) or SCAPI (the newer Salesforce Commerce API). Both use OAuth 2.0 client credentials flow for authentication — your client ID and client secret exchange for a short-lived access token, which is then used in the Authorization: Bearer header for all subsequent API calls. SFCC uses instance-specific URLs (e.g., {instance}.dx.commercecloud.salesforce.com for SCAPI), so your API base URL is unique to your organization. Retool proxies all requests server-side, keeping credentials off the browser and eliminating CORS issues.
Prerequisites
- A Salesforce Commerce Cloud account with API client access (configured in Business Manager or through Salesforce Partner Community)
- An SFCC API client ID and client secret (configured in Administration → Global Preferences → API Client Management in Business Manager)
- Your SFCC instance URL (e.g., your-instance.dx.commercecloud.salesforce.com for SCAPI or your-realm.commercecloud.salesforce.com for OCAPI)
- Your SFCC organization ID, site ID, and short code (found in Business Manager under Administration → Global Preferences)
- A Retool account with Resource creation permissions and access to Retool Workflows for token management
Step-by-step guide
Configure an SFCC API client and gather credentials
Salesforce Commerce Cloud API access requires registering an API client in Business Manager. Log in to Business Manager for your SFCC instance. Navigate to Administration → Global Preferences → API Client Management. If you do not see this option, your account may need administrator permissions — contact your SFCC administrator. Click Add a Client to register a new API client for your Retool integration. Fill in the Client Name (e.g., Retool Integration), select the appropriate API roles and scopes that match your use case. For an order management dashboard, you need at minimum: sfcc.orders (read order data), sfcc.orders.rw (read/write order data for status updates), sfcc.customers (read customer data), and sfcc.products (read product catalog). After saving, the system generates a Client ID and Client Secret — copy both immediately. Also note your SFCC organization configuration details: the Organization ID (begins with 'org' or 'f_ecom'), the Site ID (the specific storefront site you are integrating with), and the Short Code (a 4-8 character code visible in your instance URL). For SCAPI (recommended), the base URL pattern is https://{shortCode}.api.commercecloud.salesforce.com and the organization is included in each API path as /organizations/{organizationId}. For OCAPI, the URL pattern uses your realm directly. Store the Client ID, Client Secret, Organization ID, Site ID, and Short Code as Retool configuration variables — all marked as secret.
Pro tip: SFCC API client scopes follow a least-privilege model — only request the scopes your Retool dashboard actually needs. For a read-only reporting dashboard, use only read scopes (sfcc.orders, sfcc.customers, sfcc.products). For operational panels that update orders or inventory, add the corresponding read/write scopes. Overly broad scopes increase the security risk if credentials are ever compromised.
Expected result: You have an SFCC API client registered with appropriate scopes and have copied the client ID, client secret, organization ID, site ID, and short code to Retool configuration variables.
Obtain an SFCC OAuth access token
SFCC uses OAuth 2.0 client credentials flow. Before any SCAPI or OCAPI call, you must exchange your client credentials for an access token. For SCAPI, the token endpoint is https://account.demandware.com/dwsso/oauth2/access_token or https://{shortCode}.api.commercecloud.salesforce.com/shopper/auth/v1/organizations/{organizationId}/oauth2/token depending on the API version. Create a dedicated Retool REST API Resource named SFCC Token for the auth endpoint. Base URL: https://account.demandware.com. Add an Authorization header with value Basic {{ config.SFCC_BASIC_AUTH }} where SFCC_BASIC_AUTH is the Base64-encoded string of 'client_id:client_secret'. Use a JavaScript query to compute this: btoa(clientId + ':' + clientSecret) and store the result as the SFCC_BASIC_AUTH configuration variable. Add a Content-Type header: application/x-www-form-urlencoded (required for the token request). Create a query on the token Resource: Method POST, Path /dwsso/oauth2/access_token, Body type Form, with fields: grant_type = client_credentials. Run the query. SFCC returns a JSON object with access_token (a JWT string) and expires_in (typically 1800 seconds = 30 minutes — shorter than most OAuth providers). SFCC tokens expire in 30 minutes, so token refresh is more critical than for other APIs. Create a Retool Workflow that runs every 25 minutes on a schedule to refresh the token automatically and update the SFCC_ACCESS_TOKEN configuration variable.
1// JavaScript query to compute Basic Auth for SFCC token request2const clientId = retoolContext.configVars.SFCC_CLIENT_ID;3const clientSecret = retoolContext.configVars.SFCC_CLIENT_SECRET;4const basicAuth = btoa(clientId + ':' + clientSecret);56// Store the result as SFCC_BASIC_AUTH configuration variable7return {8 basic_auth: basicAuth,9 // Confirm the format is correct by checking that decoding gives back10 // your client_id:client_secret11 decoded_check: atob(basicAuth)12};Pro tip: SFCC access tokens expire in 30 minutes — much shorter than most APIs. Set your Retool Workflow token refresh to run every 25 minutes to ensure a fresh token is always available when users query the dashboard. If the token expires mid-session, queries will fail with 401 errors and users will need to wait for the next refresh cycle.
Expected result: A token exchange query successfully returns an SFCC access token. The token is stored in the SFCC_ACCESS_TOKEN configuration variable and a Retool Workflow is scheduled to refresh it every 25 minutes.
Configure the SFCC API Resource and query orders
Create the main SFCC API REST Resource in Retool. Click Add Resource → REST API. Name it Salesforce Commerce Cloud API. Base URL for SCAPI: https://{{ config.SFCC_SHORT_CODE }}.api.commercecloud.salesforce.com. In the Headers section, add Authorization with value Bearer {{ config.SFCC_ACCESS_TOKEN }}. Add Content-Type: application/json. Click Save. Now create your first meaningful query — order search. In a Retool app, create a new query using the SFCC API Resource. Method GET. For SCAPI orders, the path pattern is /order/shopper-orders/v1/organizations/{{ config.SFCC_ORG_ID }}/orders/{{ orderNumberInput.value }}. This retrieves a specific order by order number. For searching orders by date range or customer email (not available in all SFCC API versions as a single endpoint), you may need to use the OCAPI Data API at /s/-/dw/data/v24_3/orders endpoint with query parameters, or combine a customer search with order lookup. Add URL parameters: siteId: {{ config.SFCC_SITE_ID }}. Run a test query with a known order number from Business Manager to confirm authentication works. The response includes order details: order_no, status, order_total, currency, billing_address, shipping_address, product_items (array of line items), payment_instruments, and shipments.
1// JavaScript transformer for SFCC order detail response2const order = data || {};3const items = order.product_items || [];4const shipments = order.shipments || [];5const payments = order.payment_instruments || [];67return {8 order_number: order.order_no || '',9 status: order.status || '',10 order_date: order.creation_date || '',11 order_total: order.order_total12 ? `${order.currency_mnemonic || order.currency} ${parseFloat(order.order_total).toFixed(2)}`13 : 'N/A',14 currency: order.currency_mnemonic || order.currency || 'USD',15 customer_name: order.customer_info?.customer_name || '',16 customer_email: order.customer_info?.email || '',17 customer_no: order.customer_info?.customer_no || '',18 item_count: items.length,19 items_summary: items.map(item =>20 `${item.quantity}x ${item.product_name} (${item.product_id})`21 ).join('; '),22 shipping_method: shipments[0]?.shipping_method?.name || '',23 shipping_status: shipments[0]?.shipment_status || 'Not shipped',24 tracking_number: shipments[0]?.tracking_number || '',25 payment_method: payments[0]?.payment_card?.card_type26 || payments[0]?.payment_method_id27 || 'Unknown',28 payment_last_four: payments[0]?.payment_card?.number_last_digits || '',29 channel_type: order.channel_type || '',30 tax_total: order.tax_total31 ? parseFloat(order.tax_total).toFixed(2)32 : '0.00'33};Pro tip: SFCC SCAPI and OCAPI return different response field names for similar data. OCAPI uses snake_case with slightly different key names than SCAPI. Build your transformer based on the actual response you see in the Retool query result panel rather than documentation assumptions — field names vary by API version and SFCC configuration.
Expected result: The SFCC API Resource is configured and an order lookup query returns structured order data with customer information, line items, payment details, and shipment status. The transformer normalizes the complex SFCC response into a flat object for display.
Build the order management dashboard UI
With the order query working, build the order management UI. At the top of the canvas, add an order search area: a Text Input named orderNumberInput labeled Order Number, a Text Input for customer email lookup (trigger a customer search query that returns customer_no, then uses that to find orders), and a Button labeled Search Order. Below the search area, organize the content in two columns. Left column — Order Summary: display Stat components for order total, item count, and shipping status. Add a Tag component showing order status with color coding: green for Completed/Shipped, yellow for Processing, red for Cancelled. Add shipment tracking information including tracking number (with a clickable link to the carrier tracking page) and shipment status. Right column — Line Items Table: drag a Table component and bind it to a JavaScript query that extracts the product_items array from the order response. Columns: product ID, product name, quantity, unit price, and line item total. Below both columns, add a Payment Details section showing payment method, masked card number, and payment status. Add an Actions section at the bottom with buttons that trigger write operations: Return Order (POST to return endpoint), Update Status (PATCH to the order status endpoint), and Add Promotion Code (POST to coupon code endpoint). Wire each action button to a confirmation modal and a POST/PATCH query on the SFCC Resource. Add event handlers on success of each action to re-run the order lookup query and refresh all displayed data.
1// JavaScript query to extract line items from order response2// References the main order lookup query3const order = getOrder.data || {};4const items = order.product_items5 || getOrderRaw.data?.product_items6 || [];78return items.map(item => ({9 product_id: item.product_id || '',10 product_name: item.product_name || item.item_text || '',11 sku: item.item_id || '',12 quantity: item.quantity || 0,13 unit_price: item.price != null14 ? `${order.currency} ${parseFloat(item.price).toFixed(2)}`15 : 'N/A',16 total_price: item.price_after_order_discount != null17 ? `${order.currency} ${parseFloat(item.price_after_order_discount).toFixed(2)}`18 : item.adjusted_price != null19 ? `${order.currency} ${parseFloat(item.adjusted_price).toFixed(2)}`20 : 'N/A',21 gift: item.gift === true ? 'Yes' : 'No',22 position: item.position || 023}));Pro tip: SFCC's response for product_items uses price_after_order_discount for the line item total after promotions are applied, while price is the base unit price. Display both when building refund or return panels so CS agents can accurately calculate partial refund amounts for discounted orders.
Expected result: A complete SFCC order management dashboard shows: order summary Stats, a line items Table with product details, payment and shipping information, and action buttons for returns, status updates, and promotion codes. Searching by order number populates all sections simultaneously.
Add product catalog queries and Commerce-CRM integration
Extend the dashboard with product catalog access. Create a query at /product/shopper-products/v1/organizations/{{ config.SFCC_ORG_ID }}/products/{{ productIdInput.value }}?siteId={{ config.SFCC_SITE_ID }} for individual product lookups. For catalog browsing, use the OCAPI Data API at /s/-/dw/data/v24_3/catalogs/{{ catalogId }}/categories/{{ categoryId }}/products for category-level product listing. Build a Product Search section in the dashboard using a text input for product ID or name and a query that returns matching products with inventory levels, prices, and availability status. Display inventory per variant (size, color, etc.) in a nested Table. For Commerce-CRM integration, create a second Resource connecting to Salesforce CRM using the Salesforce native connector in Retool (Resources → Add Resource → Salesforce). Configure with your Salesforce org credentials. Create a JavaScript query that takes the customer email from the SFCC order and queries the Salesforce CRM for matching Contact or Lead records. Display the Salesforce account manager, customer segment, and open support cases alongside the SFCC order history. This combined view — commerce operations + CRM context — in a single Retool panel is the primary architectural advantage for organizations running both SFCC and Salesforce CRM. For enterprise teams building comprehensive SFCC + Salesforce CRM integration layers with custom Workflows for order synchronization, inventory alerts, and cross-system data reconciliation, RapidDev can architect and implement the full Retool solution.
1// SCAPI product search query configuration2// Method: GET3// Path: /product/shopper-products/v1/organizations/{{ config.SFCC_ORG_ID }}/products4// URL Parameters:5{6 "siteId": "{{ config.SFCC_SITE_ID }}",7 "ids": "{{ productIdInput.value }}",8 "allImages": "false",9 "perPricebook": "false",10 "expand": "availability,promotions,options,prices,variations"11}1213// JavaScript transformer for product response14const product = data?.data?.[0] || data || {};15const variants = product.variants || [];16const prices = product.price_ranges || product.price || {};1718return {19 product_id: product.id || '',20 name: product.name || '',21 description: product.short_description || '',22 brand: product.brand || '',23 primary_category: product.primary_category_id || '',24 status: product.online_flag ? 'Active' : 'Inactive',25 price: prices.min_price26 ? `$${parseFloat(prices.min_price).toFixed(2)}`27 : product.price28 ? `$${parseFloat(product.price).toFixed(2)}`29 : 'N/A',30 variant_count: variants.length,31 in_stock: product.inventory?.orderable !== false32};Pro tip: When building the SFCC + Salesforce CRM combined dashboard, use Retool's parallel query execution (set both queries to run on page load or both trigger simultaneously from the same button click) rather than sequential chaining — the SFCC order query and Salesforce CRM query are independent and running them in parallel halves the total load time.
Expected result: The dashboard includes a product lookup section showing product details and inventory alongside the order management panel. A Salesforce CRM section displays the customer's account information retrieved by email match, creating a unified commerce and CRM view for CS agents.
Common use cases
Order management and customer service dashboard
Build a Retool order management panel where CS agents search for orders by order number, customer email, or date range. Display order details including line items, payment method, shipping address, fulfillment status, and return history. Allow agents to issue refunds, update order statuses, and search for customers' full order history. Combine with Salesforce CRM data to show the customer's account rep and support case history alongside their purchase history.
Build a Retool SFCC order management dashboard with a search bar for order number or customer email. Show order details in a Container with line items Table, payment summary, shipping details, and current status. Add action buttons for processing returns, updating fulfillment status, and creating promotional codes. Link to the customer's Salesforce CRM record using the customer email as the join key.
Copy this prompt to try it in Retool
Product catalog and inventory operations panel
Create a Retool panel for merchandising operations: browse product catalogs, search inventory levels by SKU, update product attributes, and manage category assignments. Display products in a Table with inventory levels, price points, and category associations. Allow merchandisers to bulk-update product status (active/inactive) and price overrides for selected products. Show inventory alerts for products below a stock threshold.
Build a Retool SFCC product management panel that queries products by catalog with filters for category, inventory level, and status. Show a Table with product ID, name, price, inventory count, and active status. Add an inventory alerts section highlighting products with stock below 10 units. Include bulk status change functionality for selected rows using a dropdown and Apply button.
Copy this prompt to try it in Retool
Commerce + CRM unified customer dashboard
Combine SFCC customer purchase data with Salesforce CRM account data in a single Retool dashboard. When a Salesforce account is selected from one Table, the dashboard simultaneously queries SFCC for that customer's order history, lifetime value, product preferences, and return rate. Display both CRM attributes (account manager, contract value, segment) and commerce metrics (LTV, order frequency, average order value) in a unified customer profile view.
Build a Retool unified customer dashboard that queries Salesforce CRM for account data and SFCC for order history using customer email as the join key. Show CRM account details (rep, segment, contract) alongside commerce metrics (order count, LTV, last order date, top categories). Display the last 10 orders in a Table. Add a Chart showing monthly purchase value over the past 12 months.
Copy this prompt to try it in Retool
Troubleshooting
Token exchange returns 401 Unauthorized or 'invalid_client' error
Cause: The Basic Auth credentials for the token endpoint are incorrect — the client ID or client secret may have been entered incorrectly, or the API client in Business Manager does not have the correct scopes configured.
Solution: Verify the client ID and client secret in Business Manager under Administration → Global Preferences → API Client Management. Regenerate the client secret if needed. Confirm the Basic Auth string is correctly Base64-encoded as 'client_id:client_secret' (colon-separated). Check that the API client in Business Manager has the required scopes enabled for the API endpoints you are calling.
1// Verify Basic Auth encoding2const test = btoa('your_client_id:your_client_secret');3console.log(test);4// Decode to verify: atob(test) should equal 'your_client_id:your_client_secret'Order lookup returns 404 Not Found even for known valid order numbers
Cause: The SFCC site ID is missing or incorrect in the query URL parameter, or the SCAPI path format does not match your SFCC API version.
Solution: Ensure the siteId URL parameter matches the exact site ID configured in Business Manager (case-sensitive). Verify the organization ID format in the path matches your SFCC org configuration. Try the OCAPI endpoint format as an alternative: /s/{site_id}/dw/shop/v24_3/orders/{order_no} to confirm the credentials and site configuration are correct before debugging the SCAPI path.
API calls fail with 401 after working for 30 minutes — access token has expired
Cause: SFCC access tokens expire after 30 minutes. If the Retool Workflow for token refresh has not run or failed to update the configuration variable, all queries will fail with authentication errors.
Solution: Manually trigger the token exchange query to get a fresh token and verify it updates the SFCC_ACCESS_TOKEN configuration variable. Check the Retool Workflow logs to confirm it is running every 25 minutes and updating the variable correctly. Add error handling to the Workflow that sends a Slack alert if the token refresh fails, so the team knows to investigate before users are impacted.
Product query returns data but inventory levels show as unavailable or undefined
Cause: Inventory data is returned as a separate availability object in SFCC product responses, and the expand=availability parameter must be included in the request to populate it. Without this parameter, inventory fields are absent from the response.
Solution: Add expand=availability to the URL parameters of your product query. Inventory availability in SFCC is site-specific — ensure the correct siteId is passed so availability reflects the correct storefront's inventory allocation rather than a generic total.
Best practices
- Store all SFCC credentials (client ID, client secret, org ID, site ID, short code, and current access token) in Retool configuration variables marked as secret — SFCC API clients have broad data access and credential exposure is a serious security risk.
- Implement automated token refresh using a Retool Workflow scheduled every 25 minutes — SFCC tokens expire in 30 minutes, making token management critical for a reliable dashboard.
- Create separate SFCC API clients in Business Manager for different Retool dashboards (order management, product catalog, reporting) with the minimum required scopes for each — this limits the blast radius if any single credential is compromised.
- Use SCAPI (Salesforce Commerce API) for new integrations rather than OCAPI — SCAPI is Salesforce's modern API strategy and receives new features first, while OCAPI is in maintenance mode.
- Add the siteId parameter to every SFCC query — SFCC is multi-site capable and omitting siteId can return data from an unexpected site or cause 404 errors depending on the API endpoint's site-scoping behavior.
- Handle SFCC's monetary values carefully — prices are returned as floating point numbers in the order's currency, not in smallest units. Display them with .toFixed(2) formatting and the currency code from the order response.
- Combine SFCC order data with Salesforce CRM data using the customer email as the join key — this unified commerce + CRM view is the primary competitive advantage of connecting Retool to both Salesforce products simultaneously.
Alternatives
Salesforce CRM uses SOQL and a native Retool connector for contact and opportunity management, while Salesforce Commerce Cloud uses REST API for e-commerce operations — the two are complementary and often combined in the same Retool dashboard.
WooCommerce is an open-source e-commerce platform for SMBs with a simpler REST API, while Salesforce Commerce Cloud is enterprise-grade e-commerce for major retailers with a more complex authentication setup.
Magento (Adobe Commerce) is another enterprise e-commerce platform with a REST API and similar operational dashboard use cases, but differs in architecture — Magento uses token-based auth while SFCC uses OAuth 2.0 client credentials.
Frequently asked questions
What is the difference between OCAPI and SCAPI in Salesforce Commerce Cloud?
OCAPI (Open Commerce API) is the older API architecture in Salesforce Commerce Cloud, used by most existing integrations. SCAPI (Salesforce Commerce API) is the newer, modern REST API introduced around 2021 that follows current API design patterns and is Salesforce's strategic direction for SFCC. New integrations should use SCAPI when possible — it has cleaner authentication, better documentation, and receives new features first. Some capabilities are still only available in OCAPI during the transition period.
Why do SFCC access tokens expire so quickly compared to other APIs?
SFCC access tokens expire after 30 minutes (1800 seconds) by design — this is a security decision by Salesforce for an API that accesses sensitive commerce data including payment information and customer PII. The short expiry reduces the window of risk if a token is ever intercepted. Retool handles this with a scheduled Workflow that refreshes the token every 25 minutes, ensuring a valid token is always available for dashboard queries.
Can I access SFCC data for multiple storefronts from a single Retool dashboard?
Yes. SFCC is multi-site capable, and most API endpoints accept a siteId parameter to scope data to a specific storefront. Create a Select component in Retool populated with your SFCC site IDs, and wire its value to the siteId parameter in your queries. This allows a single dashboard to switch between storefronts — for example, US site, UK site, and Canada site — while using the same API credentials and Retool Resource.
Is Retool's Salesforce native connector compatible with Salesforce Commerce Cloud?
No. Retool's native Salesforce connector is designed for Salesforce CRM (Sales Cloud, Service Cloud) and uses SOQL for querying standard and custom CRM objects. Salesforce Commerce Cloud is a separate product with its own REST API (OCAPI/SCAPI) and does not use SOQL. Commerce Cloud requires a REST API Resource in Retool, not the native Salesforce connector. You can use both in the same Retool app — Salesforce connector for CRM data and a REST API Resource for Commerce Cloud data.
How do I find my SFCC short code and organization ID?
Your SFCC short code is a 4-8 character identifier visible in your SCAPI URLs and in Business Manager. Navigate to Business Manager → Administration → Global Preferences → Account Settings or check the URL of your SFCC instance — it is typically embedded in the domain. The organization ID is visible in Business Manager under Administration → Global Preferences → Salesforce Commerce API Settings, where it appears as the Organization field and typically starts with 'f_ecom_' followed by a long identifier.
Talk to an Expert
Our team has built 600+ apps. Get personalized help with your project.
Book a free consultation