# Update a cart

**PATCH** `/carts/{order_id}`

## Parameters

### `order_id` (_path_, required)

Order id

- **Type:** `string`
- **Example:** `"42"`
- **Constraints:** pattern `^[1-9]\d*$`

## Request body

**application/json**

_Schema ref:_ `#/components/schemas/PatchCartBody` (PatchCartBody)

```json
{
  "type": "object",
  "properties": {
    "purchaser_id": {
      "type": "integer",
      "minimum": 0,
      "exclusiveMinimum": true
    },
    "order_items": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "product_id": {
            "type": "integer",
            "minimum": 0,
            "exclusiveMinimum": true,
            "description": "Catalog product id (`products.id`; product under a product group)",
            "example": 101
          },
          "delivery_country": {
            "type": "string",
            "description": "ISO 3166-1 alpha-2 delivery country code (e.g. FR). Filters catalog by available_countries; cart line items must use a country allowed for the catalog product.",
            "example": "FR"
          },
          "keyboard_layout": {
            "type": "string",
            "enum": [
              "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"
            ],
            "description": "Required when the catalog product uses a keyboard layout for pricing; omit when the product does not offer keyboard options.",
            "example": "FRENCH_AZERTY"
          },
          "user_id": {
            "type": "integer",
            "minimum": 0,
            "exclusiveMinimum": true,
            "description": "Optional company employee to assign the device to; must be a user in the same company as the API token.",
            "example": 12
          },
          "shipping_address_id": {
            "type": "integer",
            "minimum": 0,
            "exclusiveMinimum": true,
            "description": "Optional delivery address id from the company's saved addresses. When omitted, the cart or company default shipping address is used.",
            "example": 56
          }
        },
        "required": [
          "product_id",
          "delivery_country"
        ]
      },
      "minItems": 1
    },
    "acquisition_mode": {
      "type": "string",
      "enum": [
        "LEASING",
        "BUY"
      ],
      "description": "LEASING vs one-time purchase (BUY). For catalog pricing, LEASING selects monthly lease; BUY selects purchase price.",
      "example": "LEASING"
    }
  }
}
```

## Responses

### 200

Updated cart

**application/json**

_Schema ref:_ `#/components/schemas/GetCartResponse` (GetCartResponse)

```json
{
  "type": "object",
  "properties": {
    "data": {
      "type": "object",
      "properties": {
        "id": {
          "type": "integer"
        },
        "purchaser_id": {
          "type": "integer",
          "nullable": true
        },
        "num_devices": {
          "type": "integer",
          "nullable": true
        },
        "rent": {
          "type": "string",
          "nullable": true
        },
        "currency": {
          "type": "string",
          "nullable": true
        },
        "devices": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "id": {
                "type": "integer"
              },
              "name": {
                "type": "string",
                "nullable": true
              },
              "rent": {
                "type": "string",
                "nullable": true
              },
              "product_id": {
                "type": "integer",
                "nullable": true,
                "description": "Catalog product id (`products.id`) when the line is tied to a catalog product",
                "example": 101
              }
            },
            "required": [
              "id",
              "name",
              "rent",
              "product_id"
            ]
          }
        }
      },
      "required": [
        "id",
        "purchaser_id",
        "num_devices",
        "rent",
        "currency",
        "devices"
      ]
    }
  },
  "required": [
    "data"
  ]
}
```

### 400

Validation or business rule error

**application/json**

_Schema ref:_ `#/components/schemas/PatchCartBadRequestResponse` (PatchCartBadRequestResponse)

```json
{
  "anyOf": [
    {
      "type": "object",
      "properties": {
        "error": {
          "type": "string"
        }
      },
      "required": [
        "error"
      ]
    },
    {
      "type": "object",
      "properties": {
        "error": {
          "type": "string",
          "enum": [
            "KEYBOARD_LAYOUT_REQUIRED",
            "INVALID_PURCHASER",
            "INVALID_USER",
            "INVALID_ADDRESS"
          ]
        }
      },
      "required": [
        "error"
      ]
    }
  ]
}
```

### 403

Forbidden

**application/json**

_Schema ref:_ `#/components/schemas/OrderWriteForbiddenErrorResponse` (OrderWriteForbiddenErrorResponse)

```json
{
  "type": "object",
  "properties": {
    "error": {
      "type": "string",
      "enum": [
        "INSUFFICIENT_SCOPE"
      ]
    }
  },
  "required": [
    "error"
  ]
}
```

### 404

Not found

**application/json**

_Schema ref:_ `#/components/schemas/PatchCartNotFoundErrorResponse` (PatchCartNotFoundErrorResponse)

```json
{
  "type": "object",
  "properties": {
    "error": {
      "type": "string",
      "enum": [
        "CART_NOT_FOUND",
        "COMPANY_NOT_FOUND",
        "DELIVERY_COUNTRY_NOT_FOUND",
        "PRODUCT_NOT_FOUND",
        "PRODUCT_PRICING_UNAVAILABLE"
      ]
    }
  },
  "required": [
    "error"
  ]
}
```

### 409

Cart is no longer editable for this operation

**application/json**

_Schema ref:_ `#/components/schemas/PatchCartConflictErrorResponse` (PatchCartConflictErrorResponse)

```json
{
  "type": "object",
  "properties": {
    "error": {
      "type": "string",
      "enum": [
        "ORDER_NOT_CART"
      ]
    }
  },
  "required": [
    "error"
  ]
}
```

### 500

Internal error

**application/json**

_Schema ref:_ `#/components/schemas/OrderInternalErrorResponse` (OrderInternalErrorResponse)

```json
{
  "type": "object",
  "properties": {
    "error": {
      "type": "string",
      "enum": [
        "INTERNAL_ERROR"
      ]
    }
  },
  "required": [
    "error"
  ]
}
```

## Security

```json
[
  {
    "bearerAuth": []
  }
]
```

**bearerAuth:** Bearer token using a Fleet platform API key (flt_sk_…).

---

_Generated from the OpenAPI specification for raw Markdown / tooling use._
