Skip to content

Create a cart

POST
/carts
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" }'
Media typeapplication/json
object
purchaser_id
required

User id of the purchaser (company employee)

integer
order_items
required

Line items to add to the cart

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
acquisition_mode

LEASING: monthly lease. BUY: one-time purchase.

string
default: LEASING
Allowed values: LEASING BUY

Example

LEASING

Cart created

Media typeapplication/json
object
data
required
object
order_id
required
integer

Example generated

{
"data": {
"order_id": 1
}
}

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: COMPANY_NOT_FOUND DELIVERY_COUNTRY_NOT_FOUND PRODUCT_NOT_FOUND PRODUCT_PRICING_UNAVAILABLE

Example

{
"error": "COMPANY_NOT_FOUND"
}

Cart already exists

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

Example

{
"error": "CART_ALREADY_EXISTS"
}

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"
}