# 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)](/docs/industries/cme/guide/comms-create-cart\_\_assettoorder-.md)
