---
schema_version: "1"
id: 234809d72614659bd1db76acc4f96e75c20ecaaad056dae14ac308befaa7b028
title: Apply Template
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/industries/cme/guides/comms-apply-template.md
canonical_url: https://developer.salesforce.com/docs/industries/cme/guide/comms-apply-template.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 79eb3c210a3485717f63f52fb3a8773722b689c2aafb4a828e46a87552015783
products:
  - Communications, Media, Energy and Utilities APIs (Managed Package)
  - Industries Developer Documentation
---
# Apply Template

Applies an existing Sales Configuration Template to a target Quote or Order by cloning the template cart’s line items.

## Resource Information

- **Resource URL:** `/services/apexrest/<namespace>/v1/cpq/templates/{templateId}/apply/{cartId}`
- **HTTP Method:** POST
- **Content-Type:** application/json
- **Response Format:** JSON

## URL Parameters

| Parameter  | Type   | Required | Description                                                 |
| ---------- | ------ | -------- | ----------------------------------------------------------- |
| templateId | String | Yes      | The SalesConfigTemplate\_\_c record ID.                     |
| cartId     | String | Yes      | The target Quote or Order ID to receive the template items. |

## Request Body

| Parameter  | Type    | Required | Description                                                                    |
| ---------- | ------- | -------- | ------------------------------------------------------------------------------ |
| asyncMode  | Boolean | No       | Set to true to run the clone operation asynchronously. Default: false.         |
| pricing    | Boolean | No       | Set to true to execute pricing after applying the template. Default: false.    |
| validation | Boolean | No       | Set to true to execute validation after applying the template. Default: false. |

## Example REST Request

`POST /services/apexrest/vlocity_cmt/v1/cpq/templates/a1Bxx0000004XyzDEF/apply/0Q0xx0000009AbcGHI`

```
{
  "asyncMode": false,
  "pricing": true,
  "validation": true
}
```

## Example REST Response

Success Response (200): Sync Mode

```
{
  "success": true,
  "errorCode": "INVOKE-200",
  "error": "OK",
  "result": {
    "messages": [],
    "records": [
      {
        "cartId": "0Q0xx0000009AbcGHI",
      }
    ]
  }
}

```

Success Response (200): Async Mode

```
{
  "success": true,
  "errorCode": "INVOKE-200",
  "error": "OK",
  "result": {
    "messages": [],
    "records": [
      {
        "cartId": "0Q0xx0000009AbcGHI",
        "jobId":"7071T00000ABCDEFGH"
      }
    ]
  }
}


```
