Skip to content

Validate cart

POST
/carts/{order_id}/validate
curl --request POST \
--url https://api.fleet.co/platform/v1/carts/42/validate \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "purchaser_id": 12, "signatory_id": 34, "expected_device_ids": [ 101, 102 ], "require_signatory_role": true }'
order_id
required

Order id

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

Example

42
Media typeapplication/json
object
purchaser_id
required

User id of the purchaser (company employee) for this order after validation

integer

Example

12
signatory_id

User id of the person who will sign the contract (must be a company employee). Defaults to the purchaser when omitted. Deprecated: a signatory without is_signatory is still granted it here; set is_signatory on the user first, as this will be required in a future version.

integer

Example

34
expected_device_ids

Ids of the cart’s devices the purchaser reviewed. When set, validation fails with CART_CHANGED unless the cart holds exactly these devices.

Array<integer>
>= 1 items

Example

[
101,
102
]
require_signatory_role

When true, validation fails with SIGNATORY_REQUIRED unless the signatory already has is_signatory, instead of granting it.

boolean

Example

true

Validated

Media typeapplication/json
object
data
required
object
order_id
required
integer
client_status
required

Order progress after validation

string
Allowed values: RECEIVED BEING_PROCESSED FINANCING_REQUEST DOC_REQUIRED SIGNING PROCESSING SHIPPED RECEPTION_TO_CONFIRM ONGOING_ORDER PENDING_DECISION EQUIPMENT_TO_SEND ARCHIVED FAILED UNKNOWN

Example

{
"data": {
"client_status": "RECEIVED"
}
}

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

INSUFFICIENT_SCOPE for an API key with READ scope, or COMPANY_SELF_EMPLOYED for a sole trader, which Fleet does not serve

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

Example

{
"error": "INSUFFICIENT_SCOPE"
}

Not found

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

Example

{
"error": "COMPANY_NOT_FOUND"
}

Conflict

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

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