---
schema_version: "1"
id: d2e4f74a42c9860143eb3c3c395893e6820fb0ca598e952d19a38cc3def54b0f
title: Base URL and Request Formation
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/commerce-cloud/commerce-api/guides/base-url.md
canonical_url: https://developer.salesforce.com/docs/commerce/pwa-kit-managed-runtime/guide/base-url.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 1c3ab0f15a9d9417bab63bc9d7eb1f64aace05044061ed2e13f5e9ce1c0f7686
products:
  - Composable Storefront
  - Salesforce APIs
---
# Base URL and Request Formation

Before you start working with B2C Commerce APIs, you must understand the configuration of the base URL and the specific parameters for your instance.

This guide covers how to construct well-formed requests to the B2C Commerce API with all required parameters. To identify your specific configuration information needed in your URLs, refer to the Configuration Values section.

## Base URL Pattern

The base URL for all requests to the B2C Commerce API follows a pattern to help you identify your B2C Commerce instance and direct your request to the correct API family. To understand the pattern, let’s look at the base URL with placeholders (enclosed in curly braces) for the parts of the URL that vary according to your instance and API family:

```text
https://{shortCode}.api.commercecloud.salesforce.com/{apiFamily}/{apiName}/v1/organizations/{organizationId}/
```

**note:** Make sure to specify `v1` for the version, unless you are working with the Shopper Baskets API. For the Shopper Baskets API, specify `v1` or `v2`, as applicable.

Replace the placeholders with these example values:

| Placeholder        | Value              |
| ------------------ | ------------------ |
| `{shortCode}`      | `kv7kzm78`         |
| `{apiFamily}`      | `product`          |
| `{apiName}`        | `shopper-products` |
| `{organizationId}` | `f_ecom_zzte_053`  |

With example values, the base URL looks like this:

```text
https://kv7kzm78.api.commercecloud.salesforce.com/product/shopper-products/v1/organizations/f_ecom_zzte_053/
```

The short code and organization ID in our examples belong to the demo sandbox. How to look up these values for your own B2C Commerce instance is discussed in the next section.

## Configuration Values

For each B2C Commerce instance that uses the B2C Commerce API, gather a set of configuration values related to that instance. These configuration values are required to complete the setup process and to formulate API requests.

A typical set of configuration values looks like this:

| Configuration Value | Example         |
| ------------------- | --------------- |
| Organization ID     | f_ecom_zzte_053 |
| Short code          | kv7kzm78        |
| Site ID             | RefArch         |

This guide provides more details on each configuration value and shows you where to find them.

### Organization ID

The organization ID is a short string that identifies a B2C Commerce instance. Each instance gets its own unique organization ID, such as `f_ecom_zzte_053`.

To look up the organization ID for an instance through Business Manager, you must have the Business Manager Administrator role in Account Manager and know the Business Manager URL for the instance.

A Business Manager URL looks like this:

```text
https://zzte-053.dx.commercecloud.salesforce.com/on/demandware.store/Sites-Site
```

To look up the organization ID:

1. Go to the Business Manager URL for your instance.
2. Log in using your Account Manager credentials.
3. Click App Launcher ![App Launcher](https://developer.salesforce.com/docs/media/shared/appLauncher.png) and then select **Administration** > **Site Development** > **Salesforce Commerce API Settings**.

The organization ID is displayed on the page. Copy and paste it in a location that is easy to refer to later.

![Site Development settings with Short code and Organization ID examples](https://developer.salesforce.com/docs/media/commerce-api/commerce-api-configuration-values-2.jpg)

#### Realm ID

A realm describes a set of B2C Commerce instances, including both primary and secondary instances. The realm ID is part of the organization ID. It’s a four-character string that comes after the second underscore (`_`) in the organization ID. For example, if the organization ID is `f_ecom_zzte_053`, then the realm ID is `zzte`. To learn more about realms, see [Concepts and Terminology](https://help.salesforce.com/s/articleView?id=cc.b2c_platform_overview.htm&type=5) in the B2C Commerce documentation.

#### Instance ID

The instance ID identifies an instance within a realm. It’s a three-character string that comes after the third underscore in the organization ID. For example, if the organization ID is `f_ecom_zzte_053`, then the instance ID is `053`.

Different types of instances follow different ID patterns:

- For production, staging, or development instances, the instance IDs are `prd`, `stg`, or `dev`, respectively.
- For on-demand sandboxes, the instance ID is a three-digit number that increases as more sandboxes are created.
- For POD sandboxes, the format of the instance ID is `sXX`, where `XX` is a number between from 01 to 99.

#### Tenant ID

A B2C Commerce instance is considered a “tenant” when it's associated with a supporting system, such as the Shopper Login and API Access Service (SLAS). To associate an instance with a system like SLAS, identify the instance with a tenant ID. A tenant ID begins with a four-character realm ID, followed by an underscore (`_`) and an instance ID.

For Omnichannel Inventory (OCI) updates, retrieve the tenant ID from OCI. See [Salesforce Omnichannel Inventory Implementation Guide for B2C Commerce.](https://resources.docs.salesforce.com/latest/latest/en-us/sfdc/pdf/salesforce_omnichannel_inventory_implementation_guide.pdf)

These are example tenant IDs for various types of instances:

| Instance Type     | Realm ID | Instance ID | Tenant ID |
| ----------------- | -------- | ----------- | --------- |
| Staging           | bcgl     | stg         | bcgl_stg  |
| On-demand sandbox | zzte     | 053         | zzte_053  |
| POD sandbox       | zzrf     | s01         | zzrf_s01  |

### Short Code

The short code is an eight-character string that's assigned to a realm for routing purposes. It’s concatenated with `api.commercecloud.salesforce.com` to create the API host name for your API calls, for example: `u8ak193h.api.commercecloud.salesforce.com`.

The short code applies to the entire realm, across all instances.

To look up the short code for your realm:

1. Go to the Business Manager URL for your instance.
2. Log in using your Account Manager credentials.
3. Click App Launcher ![App Launcher](https://developer.salesforce.com/docs/media/shared/appLauncher.png) and then select **Administration** > **Site Development** > **Salesforce Commerce API Settings**.
4. If you’ve never used the B2C Commerce API in your realm, click **Request Short Code**. It can take up to 24 hours for the short code to propagate through the CDN and all the routing systems in your configuration.

<!-- REVIEW(SME): Confirm the current Business Manager button label and menu path. Engineering's 26.7 release note refers to a "Get Short Code" button under "Administration > Commerce API Settings", while these steps use "Request Short Code" under "Administration > Site Development > Salesforce Commerce API Settings". Reconcile if the UI changed. -->

![Short code in pending status](https://developer.salesforce.com/docs/media/commerce-api/commerce-api-configuration-values-1.jpg)

**note:** Starting in B2C Commerce 26.7, on-demand sandbox (ODS) realms can have their own dedicated short code, generated the same way as for other realms. Previously, ODS realms shared a common short code (`kv7kzm78`), which continues to work. If you use SLAS hybrid authentication or encounter the error `Cannot construct SLAS session-bridge URL: no ACTIVE SCAPI short code found for this organization`, generate a dedicated short code to resolve the issue. For more information, see [Generate a Short Code and Create an API Client ID](https://help.salesforce.com/s/articleView?id=cc.b2c_generate_a_shortcode_and_api_client_id.htm&type=5) in Salesforce Help.

### Site ID

The site ID is the name of the site (sometimes called a “channel”) for which you want to access data. For example: `RefArch` or `SiteGenesis`.

To see a list of sites in Business Manager:

1. Go to the Business Manager URL for your instance.
2. Log in using your Account Manager credentials.
3. Click App Launcher ![App Launcher](https://developer.salesforce.com/docs/media/shared/appLauncher.png) and then select **Administration** > **Sites** > **Manage Sites**.

See [Create a Site in Business Manager](https://developer.salesforce.com/docs/commerce/b2c-commerce/guide/b2c-managing-sites-for-dev.html) in the B2C Commerce documentation.

### Version

For shopper baskets, specify `v1` or `v2`, as applicable.

For all other APIs, specify `v1`.

## Endpoint Example

To get product information for product ID `25695327M` on the `RefArchGlobal` site, combine the base URL with the [getProduct](https://developer.salesforce.com/docs/commerce/commerce-api/references?meta=shopper-products:getProduct) endpoint.

```text
https://kv7kzm78.api.commercecloud.salesforce.com/product/shopper-products/v1/organizations/f_ecom_zzte_053/products/25695327M?siteId=RefArchGlobal
```

Notice that the name of the endpoint, `getProduct`, doesn’t appear in the URL. The `getProduct` string is only used as an identifier for the endpoint in the documentation. The URL for that endpoint is formulated by adding `products/{productID}` to the base URL.

## Query Parameters

The full URL in our endpoint example also includes a required query parameter, `siteId`, to the query string.

Many endpoints have required query parameters. For the Shopper APIs, the `siteId` parameter is often required.

## Other Endpoint Requirements

To make a valid request, a well-formed URL isn't sufficient. Most endpoints have additional requirements for HTTP headers and the request body (usually in the form of a JSON object). Always check the [API specification](https://developer.salesforce.com/docs/commerce/commerce-api/references) to learn the exact requirements of each endpoint.

## Next Steps

To set up an API client for API access, gather the configuration values for your B2C Commerce instances, and refer to [Authorization](https://developer.salesforce.com/docs/commerce/pwa-kit-managed-runtime/guide/authorization.md). This setup differs for Shopper APIs and SCAPI Admin APIs.

To learn from other Commerce API users, see the [Community](https://developer.salesforce.com/docs/commerce/pwa-kit-managed-runtime/guide/community.md) guide.

See also:

- [SLAS](https://developer.salesforce.com/docs/commerce/pwa-kit-managed-runtime/guide/slas.md)
- [Security](https://developer.salesforce.com/docs/commerce/pwa-kit-managed-runtime/guide/security.md)
- [Performance](https://developer.salesforce.com/docs/commerce/pwa-kit-managed-runtime/guide/performance.md)
