---
schema_version: "1"
id: 40c44bc3982ef77f00ae16b5d5ce26838ffbbef21ead5c794158eace3f07ad98
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/custom-api-remote-includes.md
canonical_url: https://developer.salesforce.com/docs/commerce/pwa-kit-managed-runtime/guide/custom-api-remote-includes.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: fb72b35b638e0b202738f3a9136cf3962660e2cffee7af1bb39ba5edbfca4556
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. Currently, using more than 50 includes per request triggers a warning. In the future, this limit will be strictly enforced, causing errors. Stay within the threshold to avoid issues. Also, be aware that authentication and authorization are only performed for the main request, but **not** for the include requests.

- The `RestResponseMgr` method `createScapiRemoteInclude()` allows only SCAPI URLs.
- The `RestResponseMgr` method `createStorefrontControllerRemoteInclude()` allows only Controller URLs.

With B2C Commerce 24.2, build your own SCAPI responses and include responses from other sources, such as SCAPI System APIs or other Custom APIs, using Custom API Remote Includes.

**Example:** We create an API endpoint named `includeTest1`. A second API endpoint, `remoteInclude`, obtains the response from the `includeTest1` endpoint and adds it to the `includeArray` array as `includeArrayItem1`.

```javascript
exports.includeTest1 = function() {
  var data = {
    id: "includeTest1",
  };
  dw.system.RESTResponseMgr.createSuccess( data ).render();
}

exports.remoteInclude = function() {
  var includeArrayItem1 =
    dw.system.RESTResponseMgr.
    createScapiRemoteInclude( "custom", "sample", "v1", "includeTest1",
    dw.web.URLParameter( "siteId", "TestWapi" ) );

  var info = {
    id: "test-id",
    includeArray: [includeArrayItem1]
  };

  dw.system.RESTResponseMgr.createSuccess( info ).render();
}
```

**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)
