FleetbaseFleetbase

Cart

Carts hold the products a storefront customer intends to purchase. Use cart endpoints to create or retrieve a cart, add or update line items, empty the cart, and prepare it for checkout.

The Cart object

A cart stores storefront products selected for checkout, including quantities, variants, addons, scheduling, and pricing totals.
Attributes
idstringoptional

Public identifier of the cart.

customer_idstringoptional

Customer identifier associated with the cart.

currencycurrencyoptional

Cart currency code.

subtotalintegeroptional

Cart subtotal.

total_itemsintegeroptional

Total quantity of items in the cart.

total_unique_itemsintegeroptional

Number of unique cart line items.

itemsarray of objectsoptional

Cart line items.

eventsarray of objectsoptional

Cart event history.

discount_codestringoptional

Discount code applied to the cart.

expires_attimestampoptional

Time the cart expires.

created_attimestampoptional

Time the cart was created.

updated_attimestampoptional

Time the cart was last updated.

The Cart object
{
  "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"
}
GET/v1/carts

Retrieve 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.

GET/v1/carts
curl https://api.fleetbase.io/v1/carts \
  -H "Authorization: Bearer flb_live_…"
POST/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.

Body parameters
quantityintegeroptional

Quantity of the product to add. Defaults to 1.

variantsarray of objectsoptional

Selected product variant data to store on the cart line item.

addonsarray of objectsoptional

Selected product addon data to store on the cart line item.

scheduled_attimestampoptional

Scheduled fulfillment time for the line item.

store_locationstringoptional

Public ID of the store location to associate with the line item.

POST/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": []
}'
GET/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.

GET/v1/carts/{id}
curl https://api.fleetbase.io/v1/carts/{id} \
  -H "Authorization: Bearer flb_live_…"
PUT/v1/carts/{id}/{line_item_id}

Update item in Cart

You can update all properties of the Zone.

Body parameters
quantityintegeroptional

Number of units to add or update.

variantsstringoptional

Selected product variant IDs or option values.

addonsstringoptional

Selected addon IDs or addon option values.

scheduled_attimestampoptional

ISO8601 timestamp for scheduled fulfillment.

store_locationstringoptional

Store location ID used for fulfillment.

PUT/v1/carts/{id}/{line_item_id}
curl -X PUT https://api.fleetbase.io/v1/carts/{id}/{line_item_id} \
  -H "Authorization: Bearer flb_live_…"
DELETE/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.

DELETE/v1/carts/{id}/{line_item_id}
curl -X DELETE https://api.fleetbase.io/v1/carts/{id}/{line_item_id} \
  -H "Authorization: Bearer flb_live_…"
PUT/v1/carts/{id}/empty

Empty cart

Removes all line items from a cart. The response returns the emptied cart resource.

PUT/v1/carts/{id}/empty
curl -X PUT https://api.fleetbase.io/v1/carts/{id}/empty \
  -H "Authorization: Bearer flb_live_…"
DELETE/v1/carts

Delete Cart

Delete Cart

DELETE/v1/carts
curl -X DELETE https://api.fleetbase.io/v1/carts \
  -H "Authorization: Bearer flb_live_…"
Cart | Fleetbase