Add items to a cart
const url = 'https://api.fleet.co/platform/v1/carts/42/items';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"order_items":[{"product_id":101,"delivery_country":"FR","keyboard_layout":"FRENCH_AZERTY","user_id":12,"shipping_address_id":56}]}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.fleet.co/platform/v1/carts/42/items \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "order_items": [ { "product_id": 101, "delivery_country": "FR", "keyboard_layout": "FRENCH_AZERTY", "user_id": 12, "shipping_address_id": 56 } ] }'Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”Order id
Example
42Request Body
Section titled “Request Body”object
Line items to add to the cart; its current lines are kept
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
56Responses
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"}Resource not found
object
Example
{ "error": "CART_NOT_FOUND"}Not a cart, or frozen by an approved quote
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"}
