Get Line Items by ID

Return the items and configurable attributes based on item IDs.

1GET /v2/cpq/carts/{cart_ID}/items?id={item_ID},{item_ID}&validate={true|false}

Get Cart Items Trim Mode 

Trim Mode is an optimization feature that reduces the payload size of the GetCartItems API response. Instead of returning the full set of cart item fields, Trim Mode restricts the response to only what is explicitly required.

When enabled, the API response includes these:

  • A fixed set of 22 default fields (identity, hierarchy, and status)
  • Fields specified via the fields query parameter
  • Fields defined in the GCITrimFieldsToInclude field set in Salesforce

All other fields are removed from the response. Structural nodes such as PricebookEntry, Product2, and productChildItemDefinition are always preserved.

Trim Mode applies only to:

  • getCartItemList
  • getCartItemListById

Important

See, Enabling Trim Mode

Remote Method 

1getCartsItemsById

REST Handler 

1APIItemsCartsCpqV2

Apex Remote Service 

1CpqAppHandler

Apex Remote Input Map 

1{
2  methodName:getCartsItemsById,
3  cartId:801360000008eNU,
4  id:01t36000000pfcKAAQ,01t36000000pfcKAAQ
5}
6cartId = order.Id, opportunity.Id, quote.Id

Package 

Communication (vlocity_cmt)

API Parameters and Response Format 

For API parameter names and descriptions, see Cart-Based API Swagger Reference.

Resource Information 

Response FormatJSON
Resource URL/services/apexrest/{namespace}/v2/cpq/carts/{cart_ID}/items?id=80236000000Z0QNAA0,01t36000000pfcKAAQ&validate=true

Example Request 

1GET
2/services/apexrest/vlocity_cmt/v2/cpq/carts/80136000000aSTqAAM/items?id=80236000000Z0QNAA0,01t36000000pfcKAAQ&validate=true

Example Result 

  • An entire result can be thousands of lines long. This example has been truncated.
  • If a child line item Id is passed in the input request, then the whole bundle is returned in the response.

Note

1{
2  "totalSize": 1,
3  "messages": [],
4  "records": [
5    {
6      "messages": [],
7      "actions": {
8        "addtocart": {
9          "rest": {
10            "params": {
11              "items": [
12                {
13                  "quantity": 1,
14                  "parentId": "8021I00000186qVQAQ",
15                  "itemId": "01u1I000000wj9IQAQ"
16                }
17              ],
18              "cartId": "8011I000000KN9dQAG",
19              "price": true,
20              "validate": true,
21              "includeAttachment": false,
22              "pagesize": 10,
23              "lastRecordId": null,
24              "query": null
25            },
26            "method": "POST",
27            "link": "/services/apexrest/vlocity_cmt/v2/cpq/carts/8011I000000KN9dQAG/items"
28          },
29          "remote": {
30            "params": {
31              "methodName": "postCartsItems",
32              "items": [
33                {
34                  "quantity": 1,
35                  "parentId": "8021I00000186qVQAQ",
36                  "itemId": "01u1I000000wj9IQAQ"
37                }
38              ],
39              "cartId": "8011I000000KN9dQAG",
40              "price": true,
41              "validate": true,
42              "includeAttachment": false,
43              "pagesize": 10,
44              "lastRecordId": null,
45              "query": null
46            }
47          },
48          "client": {
49            "params": {}
50          }
51        },
52        "updateitems": {
53          "rest": {
54            "params": {
55              "items": [
56                {
57                  "itemId": "8021I00000186qVQAQ"
58                }
59              ],
60              "filters": null,
61              "fields": "vlocity_cmt__BillingAccountId__c, vlocity_cmt__ServiceAccountId__c, Quantity, vlocity_cmt__RecurringTotal__c, vlocity_cmt__OneTimeTotal__c, vlocity_cmt__OneTimeManualDiscount__c, vlocity_cmt__RecurringManualDiscount__c, vlocity_cmt__ProvisioningStatus__c, vlocity_cmt__RecurringCharge__c, vlocity_cmt__OneTimeCharge__c, ListPrice, vlocity_cmt__ParentItemId__c, vlocity_cmt__BillingAccountId__r.Name, vlocity_cmt__ServiceAccountId__r.Name, vlocity_cmt__PremisesId__r.Name, vlocity_cmt__InCartQuantityMap__c",
62              "cartId": "8011I000000KN9dQAG",
63              "price": true,
64              "validate": true,
65              "includeAttachment": false,
66              "pagesize": 10,
67              "lastRecordId": null,
68              "query": null
69            },
70            "method": "PUT",
71            "link": "/services/apexrest/vlocity_cmt/v2/cpq/carts/8011I000000KN9dQAG/items"
72          },
73          "remote": {
74            "params": {
75              "methodName": "putCartsItems",
76              "items": [
77                {
78                  "itemId": "8021I00000186qVQAQ"
79                }
80              ],
81              "filters": null,
82              "fields": "vlocity_cmt__BillingAccountId__c, vlocity_cmt__ServiceAccountId__c, Quantity, vlocity_cmt__RecurringTotal__c, vlocity_cmt__OneTimeTotal__c, vlocity_cmt__OneTimeManualDiscount__c, vlocity_cmt__RecurringManualDiscount__c, vlocity_cmt__ProvisioningStatus__c, vlocity_cmt__RecurringCharge__c, vlocity_cmt__OneTimeCharge__c, ListPrice, vlocity_cmt__ParentItemId__c, vlocity_cmt__BillingAccountId__r.Name, vlocity_cmt__ServiceAccountId__r.Name, vlocity_cmt__PremisesId__r.Name, vlocity_cmt__InCartQuantityMap__c",
83              "cartId": "8011I000000KN9dQAG",
84              "price": true,
85              "validate": true,
86              "includeAttachment": false,
87              "pagesize": 10,
88              "lastRecordId": null,
89              "query": null
90            }
91          },
92          "client": {
93            "params": {}
94          }
95        },
96        "deleteitem": {
97          "rest": {
98            "params": {},
99            "method": "DELETE",
100            "link": "/services/apexrest/vlocity_cmt/v2/cpq/carts/8011I000000KN9dQAG/items/ 8021I00000186qVQAQ?pagesize=10&includeAttachment=false& validate=true&price=true&cartId=8011I000000KN9dQAG&fields= vlocity_cmt__BillingAccountId__c, vlocity_cmt__ServiceAccountId__c, Quantity, vlocity_cmt__RecurringTotal__c, vlocity_cmt__OneTimeTotal__c, vlocity_cmt__OneTimeManualDiscount__c, vlocity_cmt__RecurringManualDiscount__c, vlocity_cmt__ProvisioningStatus__c, vlocity_cmt__RecurringCharge__c, vlocity_cmt__OneTimeCharge__c, ListPrice, vlocity_cmt__ParentItemId__c, vlocity_cmt__BillingAccountId__r.Name, vlocity_cmt__ServiceAccountId__r.Name, vlocity_cmt__PremisesId__r.Name, vlocity_cmt__InCartQuantityMap__c & id = 8021I00000186qVQAQ"
101          },
102          "remote": {
103            "params": {
104              "methodName": "deleteCartsItems",
105              "id": "8021I00000186qVQAQ",
106              "filters": null,
107              "fields": "vlocity_cmt__BillingAccountId__c, vlocity_cmt__ServiceAccountId__c, Quantity, vlocity_cmt__RecurringTotal__c, vlocity_cmt__OneTimeTotal__c, vlocity_cmt__OneTimeManualDiscount__c, vlocity_cmt__RecurringManualDiscount__c, vlocity_cmt__ProvisioningStatus__c, vlocity_cmt__RecurringCharge__c, vlocity_cmt__OneTimeCharge__c, ListPrice, vlocity_cmt__ParentItemId__c, vlocity_cmt__BillingAccountId__r.Name, vlocity_cmt__ServiceAccountId__r.Name, vlocity_cmt__PremisesId__r.Name, vlocity_cmt__InCartQuantityMap__c",
108              "cartId": "8011I000000KN9dQAG",
109              "price": true,
110              "validate": true,
111              "includeAttachment": false,
112              "pagesize": 10,
113              "lastRecordId": null,
114              "query": null
115            }
116          },
117          "client": {
118            "params": {}
119          }
120        },
121        "configdelete": {
122          "rest": {
123            "params": {},
124            "method": null,
125            "link": null
126          },
127          "remote": {
128            "params": {
129              "methodName": "configDeleteItem",
130              "id": "8021I00000186qVQAQ",
131              "cartId": "8011I000000KN9dQAG"
132            }
133          },
134          "client": {
135            "params": {}
136          }
137        },
138        "cloneitem": {
139          "rest": {
140            "params": {
141              "items": [
142                {
143                  "itemId": "8021I00000186qVQAQ"
144                }
145              ],
146              "id": "8021I00000186qVQAQ",
147              "cartId": "8011I000000KN9dQAG"
148            },
149            "method": "POST",
150            "link": "/services/apexrest/vlocity_cmt/v2/cpq/carts/8011I000000KN9dQAG/items/ clone"
151          },
152          "remote": {
153            "params": {
154              "methodName": "cloneItems",
155              "items": [
156                {
157                  "itemId": "8021I00000186qVQAQ"
158                }
159              ],
160              "id": "8021I00000186qVQAQ",
161              "cartId": "8011I000000KN9dQAG"
162            }
163          },
164          "client": {
165            "params": {}
166          }
167        },
168        "modifyattributes": {
169          "rest": {
170            "params": {
171              "items": [
172                {
173                  "itemId": "8021I00000186qVQAQ"
174                }
175              ],
176              "filters": null,
177              "itemId": "8021I00000186qVQAQ",
178              "id": "8021I00000186qVQAQ",
179              "cartId": "8011I000000KN9dQAG"
180            }
181          }
182        }
183      }
184    }
185  ]
186}

To validate or price a bundle, pass the rootItemId instead of the itemId.

Note

Enabling Trim Mode 

Option 1: Per-Request (Recommended for Controlled Adoption)

Enable Trim Mode for specific API calls using a query parameter: /services/apexrest/vlocity_cmt/v2/cpq/carts/{cartId}/items?gciTrimMode=true /services/apexrest/vlocity_cmt/v2/cpq/carts/{cartId}/items?gciTrimMode=true&fields=UnitPrice,vlocity_cmt\_\_OneTimeCost\_\_c

Use this approach for:

  • Targeted integrations
  • Specific UI components
  • Testing and gradual rollout

Option 2: Org-Wide Configuration

Enable Trim Mode globally via CPQ configuration:

  • Set gciTrimMode = true in CPQ Configuration Setup. This applies to all GetCartItems API calls across the organization.
  • Configure field set:
    • Product2.Name
    • UnitPrice
    • TotalPrice
    • Description All responses include default fields, field set fields, and additional fields via fields parameter (if provided).

Trim Mode removes fields from the API response. Any code, UI, or integration that depends on those fields will break unless the fields are explicitly requested.

Important

Precedence Rules 

API ParameterConfig SettingResult
TRUEanyTrim ON
FALSEanyTrim OFF
not providedTRUETrim ON
not providedfalse / unsetTrim OFF

The API parameter always takes precedence. Use gciTrimMode = false to override org-wide settings per request.

Default Fields (Always Included) 

These 22 fields are always present when trim mode is on, without needing to request them:

Id, RootItemId, ParentItemId, AssetReferenceId, LineNumber, Product2Id, PricebookEntryId, OrderId, QuoteId, OpportunityId, Quantity, Status, Action, IsRootItem, ProductHierarchyPath, ProductHierarchyGroupKeyPath, BillingAccountId, ServiceAccountId, InCartQuantityMap, CpqMessageData, CpqCardinalityMessage, CpqPricingMessage

Usage Examples 

Minimal Cart (Mobile Optimization) 

/services/apexrest/vlocity_cmt/v2/cpq/carts/{cartId}/items?gciTrimMode=true&fields=Product2.Name,TotalPrice

Returns a lightweight payload (~24 fields vs 150+).

Cost Analysis Dashboard 

/services/apexrest/vlocity_cmt/v2/cpq/carts/{cartId}/items?gciTrimMode=true&fields=UnitPrice,vlocity_cmt__OneTimeCost__c,vlocity_cmt__RecurringCost__c,vlocity_cmt__OneTimeMargin__c

Override Org-Wide Trim Mode 

/services/apexrest/vlocity_cmt/v2/cpq/carts/{cartId}/items?gciTrimMode=false

Returns full response regardless of org settings.