---
schema_version: "1"
id: 930e5607c6cdb90f8ee2c368fd153ce10330c5d11fd8581d5579cd1fd2c0402c
title: Remote Includes
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/commerce-cloud/commerce-api/guides/remote-includes.md
canonical_url: https://developer.salesforce.com/docs/commerce/pwa-kit-managed-runtime/guide/remote-includes.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 3c9121075379770d434e6d5850066e5156f52bf75825dd38d2cfe675a33c61d8
products:
  - Composable Storefront
  - Salesforce APIs
---
# Remote Includes

**important:** Use Remote Includes wisely, especially in combination with caching. Too many cache misses from Remote Includes will negatively affect the system performance. Also, be aware that authentication and authorization are only performed for the main request, but **not** for the include requests.

With B2C Commerce 25.1, extend API responses by including responses from other sources using Remote Includes.

Include a response from a SCAPI [Custom API](https://developer.salesforce.com/docs/commerce/commerce-api/guide/custom-apis.html) or [System API](https://developer.salesforce.com/docs/commerce/commerce-api/references/about-commerce-api/about.html), for example to provide additional product details.

**Example 1:** The hook `dw.ocapi.shop.product.modifyGETResponse` is used to customize the product response. A Custom API endpoint, `remoteInclude`, delivers a sample which is added to the product with the custom property `c_remote`.

```javascript
exports.remoteInclude = function() {
  var info = {
    id: "test-id"
  };
  dw.system.RESTResponseMgr.createSuccess(info).render();
}
```

```javascript
exports.modifyGETResponse = function(scriptProduct, doc) {
  var include = dw.system.RESTResponseMgr.createScapiRemoteInclude('custom', 'my-api', 'v1', 'remoteInclude');
    doc.c_remote = {
      value: [ include ]
    };
}
```

**Example 2:** The hook `dw.ocapi.shop.product.modifyGETResponse` is used to customize the product response. It is enhanced with promotion data which is added to the product with the custom property `c_remote`.

```javascript
exports.modifyGETResponse = function(scriptProduct, doc) {
  var include = dw.system.RESTResponseMgr.createScapiRemoteInclude('pricing', 'shopper-promotions', 'v1', 'promotions', dw.web.URLParameter("siteId", "MySite"), dw.web.URLParameter("ids", "my-first-promotion,my-second-promotion"));
    doc.c_remote = {
      value: [ include ]
    };
}
```

**note:** Add multiple remote includes in the array to create complex and powerful responses.

**important:** - The `RestResponseMgr` method `createScapiRemoteInclude()` allows only SCAPI URLs.
- The `RestResponseMgr` method `createStorefrontControllerRemoteInclude()` allows only Controller URLs.

Cross-API requests (for example, including a Controller response within a Custom API or SCAPI hook) are not possible.

For additional information and examples, see [RemoteInclude](https://salesforcecommercecloud.github.io/b2c-dev-doc/docs/current/scriptapi/html/index.html?target=class_dw_system_RemoteInclude.html) and [Passing Data Between Hooks.](https://developer.salesforce.com/docs/commerce/commerce-api/guide/extensibility_via_hooks.html#pass-data-between-hooks)
