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_codestringoptionalDiscount code applied to the cart.
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": null,
"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/carts/{id}/{product_id}Add 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 the store location to associate with the line item.
/v1/carts/{id}/{product_id}curl -X POST https://api.fleetbase.io/v1/carts/{id}/{product_id} \
-H "Authorization: Bearer flb_live_…" \
-H "Content-Type: application/json" \
-d '{
"addons": [],
"quantity": 1,
"scheduled_at": "scheduled_at_value_here",
"store_location": "store_location_value_here",
"variants": []
}'/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/carts/{id}/{line_item_id}Update item in Cart
You can update all properties of the Zone.
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/carts/{id}/{line_item_id}curl -X PUT https://api.fleetbase.io/v1/carts/{id}/{line_item_id} \
-H "Authorization: Bearer flb_live_…"/v1/carts/{id}/{line_item_id}Remove item from cart
Removes a line item or product from a cart. The response returns the updated cart after the item is removed.
/v1/carts/{id}/{line_item_id}curl -X DELETE https://api.fleetbase.io/v1/carts/{id}/{line_item_id} \
-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_…"