Cart
The Cart object
idstringoptionalPublic identifier of the cart.
customer_idstringoptionalCustomer identifier associated with the cart.
currencycurrencyoptionalCart currency code.
subtotalintegeroptionalCart subtotal.
total_itemsintegeroptionalTotal quantity of items in the cart.
total_unique_itemsintegeroptionalNumber of unique cart line items.
itemsarray of objectsoptionalCart line items.
eventsarray of objectsoptionalCart event history.
discount_codestringoptionalPromo codes applied to the cart, comma separated. Prefer promo_codes.
promo_codesarray of stringsoptionalPromo codes applied to the cart with Apply Promotion Code to Cart. They are used automatically at checkout.
expires_attimestampoptionalTime the cart expires.
created_attimestampoptionalTime the cart was created.
updated_attimestampoptionalTime the cart was last updated.
{
"id": "cart_8Xk2mQ1",
"customer_id": "customer_4sW9kP2",
"currency": "USD",
"subtotal": 4200,
"total_items": 3,
"total_unique_items": 2,
"items": [],
"events": [],
"discount_code": "SUMMER25",
"promo_codes": [
"SUMMER25"
],
"expires_at": "2026-05-08T09:30:00Z",
"created_at": "2026-05-07T09:30:00Z",
"updated_at": "2026-05-07T09:30:00Z"
}/v1/cartsRetrieve or Create Cart
Retrieves the current cart or creates a new cart when no cart identifier is supplied. Use the returned cart ID for subsequent cart operations.
/v1/cartscurl https://api.fleetbase.io/v1/carts \
-H "Authorization: Bearer flb_live_…"/v1/cartsAdd Item to Cart
Adds a product to a cart and creates or updates the matching cart line item. Include quantity, variants, addons, scheduling, or store location details when needed.
quantityintegeroptionalQuantity of the product to add. Defaults to 1.
variantsarray of objectsoptionalSelected product variant data to store on the cart line item.
addonsarray of objectsoptionalSelected product addon data to store on the cart line item.
scheduled_attimestampoptionalScheduled fulfillment time for the line item.
store_locationstringoptionalPublic ID of a location belonging to the product's store. Network carts reject cross-store location substitution.
/v1/cartscurl -X POST https://api.fleetbase.io/v1/carts \
-H "Authorization: Bearer flb_live_…" \
-H "Content-Type: application/json" \
-d '{
"addons": [],
"quantity": 1,
"variants": []
}'/v1/carts/promotionsPreview Cart Promotions
Previews the discounts the cart currently qualifies for: the storefront's automatic promotions plus the promo codes applied to the cart. Pass pickup and service_quote so delivery discounts are priced. Customer rules (first order only, per-customer limits) are only checked when a Customer-Token is sent, and every rule is checked again at checkout.
Returns { "discount", "discount_subtotal", "discount_delivery", "applied": [...], "rejected": [...] }. Each applied entry has promotion, name, type, code, amount and delivery_amount (minor units). Each rejected entry is { "code", "reason" }.
pickupbooleanoptionalPrice the cart as a pickup order (no delivery discounts).
service_quotestringoptionalDelivery service quote public ID, used to price free delivery promotions.
/v1/carts/promotionscurl https://api.fleetbase.io/v1/carts/promotions?pickup=false&service_quote={{service_quote_id}} \
-H "Authorization: Bearer flb_live_…" \
-H "Customer-Token: {{customer_token}}"/v1/carts/promo-codeApply Promotion Code to Cart
Applies a promo code to the cart after checking that it can be used on it. Codes are case insensitive. On success it returns { "cart": Cart, "promotions": preview } (see Preview Cart Promotions) and stores the code in the cart's promo_codes; codes applied to a cart are used automatically at checkout.
A code that cannot be applied returns 400 with the reason, e.g. Promotion code "SUMMER" cannot be applied (invalid_code). and "reason": "invalid_code". Reasons: invalid_code, not_applicable, not_active, usage_limit_reached, customer_usage_limit_reached, budget_exhausted, currency_mismatch, first_order_only, min_subtotal, min_items, no_eligible_items, pickup_order, no_discount. A code that is valid but loses to a better combination of promotions is kept on the cart and reported in promotions.rejected as not_combinable.
codestringrequiredThe promo code to apply.
pickupbooleanoptionalPrice the cart as a pickup order when validating the code.
service_quotestringoptionalDelivery service quote public ID, for free delivery codes.
/v1/carts/promo-codecurl -X POST https://api.fleetbase.io/v1/carts/promo-code \
-H "Authorization: Bearer flb_live_…" \
-H "Content-Type: application/json" \
-H "Customer-Token: {{customer_token}}" \
-d '{
"code": "{{promo_code}}"
}'/v1/carts/promo-codeRemove Promotion Code from Cart
Removes a promo code from the cart and returns { "cart": Cart, "promotions": preview }. Removing a code that is not on the cart is not an error.
/v1/carts/promo-codecurl -X DELETE https://api.fleetbase.io/v1/carts/promo-code \
-H "Authorization: Bearer flb_live_…" \
-H "Customer-Token: {{customer_token}}"/v1/carts/{id}Retrieve a Cart
Retrieves an existing cart by its unique identifier. If the cart is still active, the response includes its current line items and totals.
/v1/carts/{id}curl https://api.fleetbase.io/v1/carts/{id} \
-H "Authorization: Bearer flb_live_…"/v1/cartsUpdate item in Cart
Updates a line item already in the cart. Send any of quantity, variants,
addons or scheduled_at; omitted fields are left unchanged. The response
returns the updated cart.
quantityintegeroptionalNumber of units to add or update.
variantsstringoptionalSelected product variant IDs or option values.
addonsstringoptionalSelected addon IDs or addon option values.
scheduled_attimestampoptionalISO8601 timestamp for scheduled fulfillment.
store_locationstringoptionalStore location ID used for fulfillment.
/v1/cartscurl -X PUT https://api.fleetbase.io/v1/carts \
-H "Authorization: Bearer flb_live_…" \
-H "Content-Type: application/json" \
-d '{
"quantity": 2
}'/v1/cartsRemove item from cart
Removes a line item or product from a cart. The response returns the updated cart after the item is removed.
/v1/cartscurl -X DELETE https://api.fleetbase.io/v1/carts \
-H "Authorization: Bearer flb_live_…"/v1/carts/{id}/emptyEmpty cart
Removes all line items from a cart. The response returns the emptied cart resource.
/v1/carts/{id}/emptycurl -X PUT https://api.fleetbase.io/v1/carts/{id}/empty \
-H "Authorization: Bearer flb_live_…"/v1/cartsDelete Cart
Delete Cart
/v1/cartscurl -X DELETE https://api.fleetbase.io/v1/carts \
-H "Authorization: Bearer flb_live_…"