Update a cart
const url = 'https://api.fleet.co/platform/v1/carts/42';const options = { method: 'PATCH', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"purchaser_id":1,"order_items":[{"product_id":101,"delivery_country":"FR","keyboard_layout":"FRENCH_AZERTY","user_id":12,"shipping_address_id":56}],"acquisition_mode":"LEASING"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request PATCH \ --url https://api.fleet.co/platform/v1/carts/42 \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "purchaser_id": 1, "order_items": [ { "product_id": 101, "delivery_country": "FR", "keyboard_layout": "FRENCH_AZERTY", "user_id": 12, "shipping_address_id": 56 } ], "acquisition_mode": "LEASING" }'Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”Order id
Example
42Request Body
Section titled “Request Body”object
Replaces every line of the cart
object
Catalog product id (product under a product group)
Example
101ISO 3166-1 alpha-2 delivery country code (e.g. FR). Cart line items must use a country where the catalog product is available.
Example
FRRequired when the catalog product uses a keyboard layout for pricing; omit when the product does not offer keyboard options.
Example
FRENCH_AZERTYOptional company employee to assign the device to; must be a user in the same company as the API token.
Example
12Optional delivery address id from the company’s saved addresses. When omitted, the cart or company default shipping address is used.
Example
56Reprices the cart’s lines in this mode. It also switches the acquisition mode of the whole company, so it is refused with CART_LOCKED while an approved quote froze any of the company’s carts.
Example
LEASINGResponses
Section titled “Responses”Updated cart
object
object
object
Catalog product id when the line is tied to a catalog product
Example
{ "data": { "devices": [ { "product_id": 101 } ] }}Validation or business rule error
Missing, invalid, or revoked API key
Example
UnauthorizedThe API key has READ scope; this operation needs WRITE
object
Example
{ "error": "INSUFFICIENT_SCOPE"}Not found
object
Example
{ "error": "CART_NOT_FOUND"}Cart is no longer editable for this operation
object
Example
{ "error": "ORDER_NOT_CART"}Rate limit exceeded. The RateLimit-* headers give the limit and the reset time.
Example
Too many requests, please try again later.Unexpected server error
object
Example
{ "error": "INTERNAL_ERROR"}Rate limiting is temporarily unavailable; retry with backoff
object
Example generated
{ "message": "example"}
