---
schema_version: "1"
id: 6ab2e15d4445351606f3fddc6bcb0cd217abb173ef9d7a8252e8911329e3876d
title: Create Cart
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/industries/cme/guides/comms-create-cart.md
canonical_url: https://developer.salesforce.com/docs/industries/cme/guide/comms-create-cart.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: ab5d4b005e87f6086637b2ccda5127720ef503e7f8f39da77f594f00214e8d1a
products:
  - Communications, Media, Energy and Utilities APIs (Managed Package)
  - Industries Developer Documentation
---
# Create Cart

Create an opportunity, order, or quote based on the header object.

```nolang
POST /v2/carts
```


## Remote Method

```nolang
createCart
```

## REST Handler

```nolang
CpqCreateCartActionV2
```

## Apex Remote Service

```nolang
CpqAppHandler
```


## Apex Remote Input Maps

**note:** Opportunity

```nolang
{
 "methodName": "createCart",
 "objectType": "Opportunity"
 "inputFields": [{
  "Name": "TestOpportunity"
 }, {
  "StageName": "Prospecting"
 }, {
  "CloseDate": "3/19/2020"
 }, {
  "AccountId": "00141000009erCBAAY"
 }],
 "subaction": "createOppty",
 "fields": "Id,Name,StageName"
}
```

**note:** Order

```nolang
{
 "methodName": "createCart",
 "objectType": "Order",
 "inputFields": [{
  "effectivedate": "12/7/2019"
 }, {
  "status": "Draft"
 }, {
  "Name": "Telco"
 }, {
  "AccountId": "00141000009erCBAAY"
 }],
 "subaction": "createOrder",
 "fields": "Id,Name,EffectiveDate"
}
```

**note:** Quote

```nolang
{
 "methodName": "createCart",
 "objectType": "Quote",
 "inputFields": [{
  "OpportunityId": "6DG678HD234"
 }, {
  "Name": "Telco"
 }, {
  "AccountId": "00141000009erCBAAY"
 }],
 "subaction": "createQuote",
 "fields": "Id,Name"
}
```

## Package

Communication (vlocity_cmt)


## API Parameters and response format

For API parameter names and descriptions, see [Industries Configure, Price, Quote Web APIs v2 Documentation](https://developer.salesforce.com/docs/industries/cme/references/cpq?meta=Summary).

By default, you can only create carts for active accounts. If the account is in a status besides active, add this filter to your request: `"filters": "Account.vlocity_cmt__Status__c:Inactive_Active_Pending"`.

## Resource Information

| Response Format | JSON                                      |
| --------------- | ----------------------------------------- |
| Resource URL    | `/services/apexrest/{namespace}/v2/carts` |


## Example Requests

**note:** Opportunity

In this example, the status of the account isn't Active. Therefore, we also specify `"filters": "Account.vlocity_cmt__Status__c:Inactive_Active_Pending"` in the request.

```nolang
POST /services/apexrest/vlocity_cmt/v2/carts
Body:
{
  "inputFields": [
    {
      "Name": "Headless CPQ Oppty"
    },
    {
      "StageName": "Prospecting"
    },
    {
      "CloseDate": "6/19/2020"
    },
    {
      "AccountId": "0011U00000W6H9p"
    }
  ],
  "filters": "Account.vlocity_cmt__Status__c:Inactive_Active_Pending",
  "subaction": "createOppty",
  "fields": "Id,Name,StageName"
}

```

**note:** Order

```nolang
POST /services/apexrest/vlocity_cmt/v2/carts
Body:
{
  "methodName": "createCart",
  "objectType": "Order",
  "inputFields": [
    {
      "effectivedate": "12/03/2019"
    },
    {
      "status": "Draft"
    },
    {
      "Name": "Headless CPQ Order"
    },
    {
      "AccountId": "0011U00000W6GvB"
    }
  ],
  "subaction": "createOrder",
  "fields": "Id,Name,EffectiveDate"
}

```

**note:** Quote

```nolang
POST /services/apexrest/vlocity_cmt/v2/carts
Body:
{
  "methodName": "createCart",
  "objectType": "Quote",
  "inputFields": [
    {
      "OpportunityId": "0061U000008fIUK"
    },
    {
      "Name": "Headless CPQ Quote"
    }
  ],
  "subaction": "createQuote",
  "fields": "Id,Name"
}


```

**note:** Asset to Order

```nolang
POST /services/apexrest/vlocity_cmt/v2/carts
Body:
{
  "subaction":"assetToOrder",
  "id":"01t36000000pfcKAAQ,02i6A000000YEXN",
  "accountId":"0016A0000072D3y",
  "requestDate":"2019-12-01"
}

```

**See Also**

- [Create Cart (assetToOrder)](https://developer.salesforce.com/docs/industries/cme/guide/comms-create-cart__assettoorder-.md)
