Skip to content

Add items to a cart

POST
/carts/{order_id}/items
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 } ] }'
order_id
required

Order id

string
/^[1-9]\d*$/

Example

42
Media typeapplication/json
object
order_items
required

Line items to add to the cart; its current lines are kept

Array<object>
>= 1 items
object
product_id
required

Catalog product id (product under a product group)

integer

Example

101
delivery_country
required

ISO 3166-1 alpha-2 delivery country code (e.g. FR). Cart line items must use a country where the catalog product is available.

string

Example

FR
keyboard_layout

Required when the catalog product uses a keyboard layout for pricing; omit when the product does not offer keyboard options.

string
Allowed values: FRENCH_AZERTY SPANISH_QWERTY ITALIAN_QWERTY INTERNATIONAL_ENGLISH_QWERTY GERMAN_QWERTZ PORTUGUESE_QWERTY ENGLISH_QWERTY SWISS_QWERTZ AMERICAN_ENGLISH_QWERTY CANADIAN_ENGLISH_QWERTY DUTCH_QWERTY SWEDISH_QWERTY NORWEGIAN_QWERTY DANISH_QWERTY FINNISH_QWERTY OTHER

Example

FRENCH_AZERTY
user_id

Optional company employee to assign the device to; must be a user in the same company as the API token.

integer

Example

12
shipping_address_id

Optional delivery address id from the company’s saved addresses. When omitted, the cart or company default shipping address is used.

integer

Example

56

Updated cart

Media typeapplication/json
object
data
required
object
id
required
integer
purchaser_id
required
integer
nullable
num_devices
required
integer
nullable
rent
required
string
nullable
currency
required
string
nullable
devices
required
Array<object>
object
id
required
integer
name
required
string
nullable
rent
required
string
nullable
product_id
required

Catalog product id when the line is tied to a catalog product

integer
nullable

Example

{
"data": {
"devices": [
{
"product_id": 101
}
]
}
}

Validation or business rule error

Media typeapplication/json
Any of:
object
message
required

Every validation failure, comma-separated

string
type
required
string
Allowed values: validation_error
error
required
string
Allowed values: validation_error

Example

{
"message": "Required, must be an ISO 3166-1 alpha-2 country code",
"type": "validation_error",
"error": "validation_error"
}

Missing, invalid, or revoked API key

Media typetext/plain
string

Example

Unauthorized

The API key has READ scope; this operation needs WRITE

Media typeapplication/json
object
error
required
string
Allowed values: INSUFFICIENT_SCOPE

Example

{
"error": "INSUFFICIENT_SCOPE"
}

Resource not found

Media typeapplication/json
object
error
required
string
Allowed values: CART_NOT_FOUND COMPANY_NOT_FOUND DELIVERY_COUNTRY_NOT_FOUND PRODUCT_NOT_FOUND PRODUCT_PRICING_UNAVAILABLE

Example

{
"error": "CART_NOT_FOUND"
}

Not a cart, or frozen by an approved quote

Media typeapplication/json
object
error
required
string
Allowed values: ORDER_NOT_CART CART_LOCKED

Example

{
"error": "ORDER_NOT_CART"
}

Rate limit exceeded. The RateLimit-* headers give the limit and the reset time.

Media typetext/plain
string

Example

Too many requests, please try again later.

Unexpected server error

Media typeapplication/json
object
error
required
string
Allowed values: INTERNAL_ERROR

Example

{
"error": "INTERNAL_ERROR"
}

Rate limiting is temporarily unavailable; retry with backoff

Media typeapplication/json
object
message
required
string

Example generated

{
"message": "example"
}