Create a cart
const url = 'https://api.fleet.co/platform/v1/carts';const options = { method: 'POST', 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 POST \ --url https://api.fleet.co/platform/v1/carts \ --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”Request Body
Section titled “Request Body”object
User id of the purchaser (company employee)
Line items to add to 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
56LEASING: monthly lease. BUY: one-time purchase.
Example
LEASINGResponses
Section titled “Responses”Cart created
object
object
Example generated
{ "data": { "order_id": 1 }}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": "COMPANY_NOT_FOUND"}Cart already exists
object
Example
{ "error": "CART_ALREADY_EXISTS"}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"}
