Get Cart Items

Return cart items and their configurable attributes based on specified criteria.

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.

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

See, Enabling Trim Mode.

Communication (vlocity_cmt)

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

Response FormatJSON
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}

See Also

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.

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.

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.