Get Line Items by ID
Return the items and configurable attributes based on item IDs.
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.
Trim Mode applies only to:
- getCartItemList
- getCartItemListById
See, Enabling Trim Mode
Communication (vlocity_cmt)
For API parameter names and descriptions, see Cart-Based API Swagger Reference.
| Response Format | JSON |
|---|---|
| Resource URL | /services/apexrest/{namespace}/v2/cpq/carts/{cart_ID}/items?id=80236000000Z0QNAA0,01t36000000pfcKAAQ&validate=true |
- 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.
To validate or price a bundle, pass the rootItemId instead of the itemId.
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).
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.
| 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.
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
/services/apexrest/vlocity_cmt/v2/cpq/carts/{cartId}/items?gciTrimMode=true&fields=Product2.Name,TotalPrice
Returns a lightweight payload (~24 fields vs 150+).
/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
/services/apexrest/vlocity_cmt/v2/cpq/carts/{cartId}/items?gciTrimMode=false
Returns full response regardless of org settings.