Return cart items and their configurable attributes based on specified criteria.
-
Item name, description, and price
-
Configurable attributes for the item
-
Links to further actions
-
Messages per item
GET /v2/cpq/carts/{cart_ID}/items?query={query}&lastRecordId=(n)&pagesize={n}&filters={filter}&fields={field1,field2}&validate={true/false}&price={true/false}
note: - If the value for pagesize parameter is not provided, it defaults to 20. To fetch or price more than 20 items, specify pagesize explicitly.
- Customers can search for specific products even with over 10,000
PriceListEntryrecords if the these conditions are met.- The product must be orderable.
- Filter parameters should not contain underscores.
- Only Product2-related fields can be queried or filtered.
Fieldset as a parameter for this API is not supported. If the fieldset parameter is passed, a runtime error occurs.
This API can be called either through REST or through Apex remote calls. The default value for the price parameter is true. If price=false is not specified, pricing is executed by default. Specify price=false if you do not want to execute pricing.
In Salesforce Industries Communications, Media, and Energy Fall '20 and later releases, the getCarts validate parameter has a default value of _True*, so the API will return validation messages. If validate=false is not specified, validation messages are returned by default. Specify validate=false in the UI if you do not want to receive validation messages.
This API supports the guest user enhancements that Salesforce introduced with the Winter ‘21 release. To encrypt and decrypt data for guest users, use the UserSecurity class with this API. See Guest User Technical Details.
For additional information, see UserSecurity Class and CPQ and Digital Commerce Changes for Guest Users.
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
GCITrimFieldsToIncludefield set in Salesforce
All other fields are removed from the response. Structural nodes such as PricebookEntry, Product2, and productChildItemDefinition are always preserved.
important: Trim Mode applies only to:
- getCartItemList
- getCartItemListById
See, Enabling Trim Mode.
Remote Method
getCartsItems
REST Handler
APIItemsCartsCpqV2
Apex Remote Service
CpqAppHandler
Apex Remote Input Map
{
methodName: getCartsItems,
cartId: 801360000008 eNU,
query: "iphone",
lastItemId: "01t36000000pfcKAAQ",
pagesize: 20,
includeAttachment: false,
fields: fields = Quantity,
vlocity_cmt__RecurringCharge__c,
vlocity_cmt__OneTimeTotal__c,
vlocity_cmt__BillingAccountId__r.Name,
vlocity_cmt__ServiceAccountId__r.Name,
vlocity_cmt__PremisesId__r.Name
filter: vlocity_cmt__ServiceAccountId__c: 991360000008 eNU_991360000008eNY,
vlocity_cmt__BillingAccount__c: 01 t36000000pfcKAAQ_01t36000000pfcKAAQ
}
cartId = 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 Format | JSON |
|---|---|
| Resource URL | /services/apexrest/{namespace}/v2/cpq/carts/{cart_ID}/items?query={query}&lastRecordId=(n)&pagesize={n}&filters={filter}&fields={field1,field2}&validate={true/false}&price={true/false} |
Example Request
GET
/services/apexrest/vlocity_cmt/v2/cpq/carts/80141000000Cg8H/items?pagesize=5
Example Response
{
"totalSize": 1,
"messages": [],
"records": [{
"messages": [],
"actions": {
"addtocart": {
"rest": {
"params": {
"includeAttachment": false,
"pagesize": 5,
"lastRecordId": null,
"query": null,
"items": [{
"parentId": "80241000000HalcAAC",
"quantity": 1,
"itemId": "01u41000001QPtsAAG"
}]
},
"method": "POST",
"link": "/services/apexrest/vlocity_cmt/v2/cpq/carts/80141000000Cg8HAAS/items"
},
"remote": {
"params": {
"price": true,
"validate": true,
"includeAttachment": false,
"pagesize": 5,
"lastRecordId": null,
"query": null,
"items": [{
"parentId": "80241000000HalcAAC",
"quantity": 1,
"itemId": "01u41000001QPtsAAG"
}],
"cartId": "80141000000Cg8HAAS",
"methodName": "postCartsItems"
}
},
"client": {
"params": {}
}
},
"updateitems": {
"rest": {
"params": {
"fields": null,
"price": true,
"validate": true,
"filters": null,
"includeAttachment": false,
"pagesize": 5,
"lastRecordId": null,
"query": null,
"items": [{
"itemId": "80241000000HalcAAC"
}]
},
"method": "PUT",
"link": "/services/apexrest/vlocity_cmt/v2/cpq/carts/80141000000Cg8HAAS/items"
},
"remote": {
"params": {
"fields": null,
"price": true,
"validate": true,
"filters": null,
"includeAttachment": false,
"pagesize": 5,
"lastRecordId": null,
"query": null,
"items": [{
"itemId": "80241000000HalcAAC"
}],
"cartId": "80141000000Cg8HAAS",
"methodName": "putCartsItems"
}
},
"client": {
"params": {}
}
},
"deleteitem": {
"rest": {
"params": {},
"method": "DELETE",
"link": "/services/apexrest/vlocity_cmt/v2/cpq/carts/80141000000Cg8HAAS/items/80241000000HalcAAC?pagesize=5&includeAttachment=false&validate=true&price=true"
},
"remote": {
"params": {
"price": true,
"validate": true,
"filters": null,
"includeAttachment": false,
"pagesize": 5,
"lastRecordId": null,
"query": null,
"id": "80241000000HalcAAC",
"cartId": "80141000000Cg8HAAS",
"methodName": "deleteCartsItems"
}
},
"client": {
"params": {}
}
},
"cloneitem": {
"rest": {
"params": {
"items": [{
"itemId": "80241000000HalcAAC"
}]
},
"method": "POST",
"link": "/services/apexrest/vlocity_cmt/v2/cpq/carts/80141000000Cg8HAAS/items/clone"
},
"remote": {
"params": {
"id": "80241000000HalcAAC",
"cartId": "80141000000Cg8HAAS",
"methodName": "cloneItems"
}
},
"client": {
"params": {}
}
},
"modifyattributes": {
"rest": {
"params": {
"fields": null,
"items": [{
"itemId": "80241000000HalcAAC"
}]
},
"method": "PUT",
"link": "/services/apexrest/vlocity_cmt/v2/cpq/carts/80141000000Cg8HAAS/items/80241000000HalcAAC/itemattributes"
},
"remote": {
"params": {
"fields": null,
"items": [{
"itemId": "80241000000HalcAAC"
}],
"itemId": "80241000000HalcAAC",
"cartId": "80141000000Cg8HAAS",
"methodName": "putItemAttributes"
}
},
"client": {
"params": {}
}
}
},
"displaySequence": -1,
"Id": {
"value": "80241000000HalcAAC",
"messages": [],
"label": "Order Product ID",
"hidden": false,
"fieldName": "Id",
"editable": false,
"dataType": "ID",
"actions": {}
},
"Pricebook2Id": "01s41000005dPYQAA2",
"Product2Id": "01t41000000sYaSAAU",
"UnitPrice": {
"value": 1.00,
"messages": [],
"label": "Unit Price",
"hidden": false,
"fieldName": "UnitPrice",
"editable": true,
"dataType": "CURRENCY",
"actions": {}
},
"Name": "GC 2",
"IsActive": true,
"Product2": {
"attributes": {
"type": "Product2",
"url": "/services/data/v38.0/sobjects/Product2/01t41000000sYaSAAU"
},
"Id": "01t41000000sYaSAAU",
"Name": "GC 2",
"vlocity_cmt__IsConfigurable__c": false,
"vlocity_cmt__Type__c": "None",
"vlocity_cmt__SubType__c": "None",
"RecordTypeId": "012410000006OWUAA2",
"vlocity_cmt__JSONAttribute__c": null
},
"productId": "01t41000000sYaSAAU",
"defaultQuantity": 1.0,
"minQuantity": 0.0,
"maxQuantity": 99999.0,
"groupMinQuantity": 0,
"groupMaxQuantity": 99999,
"sequenceNumber": 1.00,
"productChildItemDefinition": {
"attributes": {
"type": "vlocity_cmt__ProductChildItem__c",
"url": "/services/data/v38.0/sobjects/vlocity_cmt__ProductChildItem__c/a2541000000G0AGAA0"
},
"Id": "a2541000000G0AGAA0",
"Name": "Root PCI",
"vlocity_cmt__IsVirtualItem__c": false,
"vlocity_cmt__Quantity__c": 1,
"vlocity_cmt__MaxQuantity__c": 99999,
"vlocity_cmt__MinQuantity__c": 0,
"vlocity_cmt__MaximumChildItemQuantity__c": 99999,
"vlocity_cmt__MinimumChildItemQuantity__c": 0,
"vlocity_cmt__IsOverride__c": false,
"vlocity_cmt__ParentProductId__c": "01t41000000sYaSAAU",
"vlocity_cmt__ChildLineNumber__c": "1",
"vlocity_cmt__SeqNumber__c": 1.00,
"vlocity_cmt__CollapseHierarchy__c": false,
"vlocity_cmt__IsRootProductChildItem__c": true,
"vlocity_cmt__ParentProductId__r": {
"attributes": {
"type": "Product2",
"url": "/services/data/v38.0/sobjects/Product2/01t41000000sYaSAAU"
},
"Id": "01t41000000sYaSAAU",
"Name": "GC 2"
}
},
"productHierarchyPath":"01t41000000sYaSAAU",
"name": "GC 2",
"isVirtualItem": false,
"itemType": "lineItem",
"PricebookEntryId": {
"value": "01u41000001QPtsAAG",
"messages": [],
"label": "Price Book Entry ID",
"hidden": false,
"fieldName": "PricebookEntryId",
"editable": false,
"dataType": "REFERENCE",
"actions": {}
},
"Quantity": {
"value": 1.00,
"messages": [],
"label": "Quantity",
"hidden": false,
"fieldName": "Quantity",
"editable": true,
"dataType": "DOUBLE",
"actions": {}
},
"vlocity_cmt__OneTimeTotal__c": {
"value": 1.00,
"messages": [],
"label": "One Time Total",
"hidden": false,
"fieldName": "vlocity_cmt__OneTimeTotal__c",
"editable": false,
"dataType": "CURRENCY",
"actions": {}
},
"vlocity_cmt__RecurringTotal__c": {
"value": 0.00,
"messages": [],
"label": "Recurring Total",
"hidden": false,
"fieldName": "vlocity_cmt__RecurringTotal__c",
"editable": false,
"dataType": "CURRENCY",
"actions": {}
},
"vlocity_cmt__ProvisioningStatus__c": {
"value": "New",
"messages": [],
"label": "Provisioning Status",
"hidden": false,
"fieldName": "vlocity_cmt__ProvisioningStatus__c",
"editable": false,
"dataType": "STRING",
"actions": {}
},
"vlocity_cmt__BillingAccountId__c": "00141000007uyWYAAY",
"vlocity_cmt__ServiceAccountId__c": "00141000007uyWYAAY",
"vlocity_cmt__ProductHierarchyPath__c": {
"value": "01t41000000sYaSAAU",
"messages": [],
"label": "Product Hierarchy Path",
"hidden": false,
"fieldName": "vlocity_cmt__ProductHierarchyPath__c",
"editable": true,
"dataType": "STRING",
"actions": {}
},
"vlocity_cmt__LineNumber__c": {
"value": "0001",
"messages": [],
"label": "LineNumber",
"hidden": true,
"fieldName": "vlocity_cmt__LineNumber__c",
"editable": true,
"dataType": "STRING",
"actions": {}
},
"vlocity_cmt__RootItemId__c": {
"value": "80241000000HalcAAC",
"messages": [],
"label": "RootItemId",
"hidden": true,
"fieldName": "vlocity_cmt__RootItemId__c",
"editable": true,
"dataType": "STRING",
"actions": {}
},
"ListPrice": {
"value": 1.00,
"messages": [],
"label": "List Price",
"hidden": false,
"fieldName": "ListPrice",
"editable": false,
"dataType": "CURRENCY",
"actions": {}
},
"vlocity_cmt__OneTimeCharge__c": {
"value": 1.00,
"messages": [],
"label": "One Time Charge",
"hidden": false,
"fieldName": "vlocity_cmt__OneTimeCharge__c",
"editable": false,
"dataType": "CURRENCY",
"actions": {}
},
"vlocity_cmt__OneTimeCalculatedPrice__c": {
"value": 1.00,
"messages": [],
"label": "One Time Calculated Price",
"hidden": false,
"fieldName": "vlocity_cmt__OneTimeCalculatedPrice__c",
"editable": true,
"dataType": "CURRENCY",
"actions": {}
},
"vlocity_cmt__OneTimeManualDiscount__c": {
"value": 0.00,
"messages": [],
"label": "One Time Manual Discount",
"hidden": false,
"fieldName": "vlocity_cmt__OneTimeManualDiscount__c",
"editable": true,
"dataType": "PERCENT",
"actions": {}
},
"vlocity_cmt__RecurringCharge__c": {
"value": 0.00,
"messages": [],
"label": "Recurring Charge",
"hidden": false,
"fieldName": "vlocity_cmt__RecurringCharge__c",
"editable": false,
"dataType": "CURRENCY",
"actions": {}
},
"vlocity_cmt__RecurringCalculatedPrice__c": {
"value": 0.00,
"messages": [],
"label": "Recurring Calculated Price",
"hidden": false,
"fieldName": "vlocity_cmt__RecurringCalculatedPrice__c",
"editable": true,
"dataType": "CURRENCY",
"actions": {}
},
"vlocity_cmt__RecurringManualDiscount__c": {
"value": 0.00,
"messages": [],
"label": "Recurring Manual Discount",
"hidden": false,
"fieldName": "vlocity_cmt__RecurringManualDiscount__c",
"editable": true,
"dataType": "PERCENT",
"actions": {}
},
"PricebookEntry": {
"attributes": {
"type": "PricebookEntry",
"url": "/services/data/v38.0/sobjects/PricebookEntry/01u41000001QPtsAAG"
},
"Id": "01u41000001QPtsAAG",
"Product2Id": "01t41000000sYaSAAU",
"Pricebook2Id": "01s41000005dPYQAA2",
"Product2": {
"attributes": {
"type": "Product2",
"url": "/services/data/v38.0/sobjects/Product2/01t41000000sYaSAAU"
},
"Id": "01t41000000sYaSAAU",
"Name": "GC 2",
"vlocity_cmt__Type__c": "None",
"vlocity_cmt__IsConfigurable__c": false
}
},
"vlocity_cmt__ServiceAccountId__r": {
"attributes": {
"type": "Account",
"url": "/services/data/v38.0/sobjects/Account/00141000007uyWYAAY"
},
"Id": "00141000007uyWYAAY",
"Name": "Telco test"
},
"vlocity_cmt__BillingAccountId__r": {
"attributes": {
"type": "Account",
"url": "/services/data/v38.0/sobjects/Account/00141000007uyWYAAY"
},
"Id": "00141000007uyWYAAY",
"Name": "Telco test"
},
"vlocity_cmt__InCartQuantityMap__c": {
"value": null,
"messages": [],
"label": "InCartQuantityMap",
"hidden": false,
"fieldName": "vlocity_cmt__InCartQuantityMap__c",
"editable": true,
"dataType": "TEXTAREA",
"actions": {}
},
"vlocity_cmt__JSONAttribute__c": {
"value": null,
"messages": [],
"label": "JSONAttribute",
"hidden": false,
"fieldName": "vlocity_cmt__JSONAttribute__c",
"editable": true,
"dataType": "TEXTAREA",
"actions": {}
},
"vlocity_cmt__ParentItemId__c": {
"value": null,
"messages": [],
"label": "ParentItemId",
"hidden": true,
"fieldName": "vlocity_cmt__ParentItemId__c",
"editable": true,
"dataType": "STRING",
"actions": {}
},
"vlocity_cmt__RecurringDiscountPrice__c": {
"value": null,
"messages": [],
"label": "Recurring Discount Price",
"hidden": false,
"fieldName": "vlocity_cmt__RecurringDiscountPrice__c",
"editable": false,
"dataType": "CURRENCY",
"actions": {}
}
}]
}
See Also
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 = truein 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).
important: - 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.
- Out-of-the-box CPQ UI components and standard integrations expect the complete set of response fields. Enabling
GCITrimModeat the org level can cause these components and integrations to fail unless all required fields are explicitly included using thefieldsrequest parameter or theGCITrimFieldsToIncludefield set.
Precedence Rules
| API Parameter | Config Setting | Result |
|---|---|---|
| TRUE | any | Trim ON |
| FALSE | any | Trim OFF |
| not provided | TRUE | Trim ON |
| not provided | false / unset | Trim 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.