# create_order

> Place a store order.

- Tier: W
- Required scope: write:billing + write:orders
- Annotations: idempotentHint
- Docs: https://api.inleed.com/tools/create-order

## Description

Place a store order. This costs money and does not charge on this call: it validates and prices the cart, then returns `{status:"confirmation_required", confirmationUrl, expiresAt, preview}`. Show the human the `confirmationUrl`; they review the price and approve in the Inleed client area. On approval a proforma invoice with a payment link is created — the order provisions only once that invoice is paid.

## Input schema

- `items` — object[] (required). The cart to order: the same items you priced with preview_order. At least one, at most 50.
  - `service_plan_id` — integer (required). The catalogue plan id to buy — a plan's servicePlanId from list_products or get_product.
  - `quantity` — integer. How many of this plan (1–99). Defaults to 1.
  - `domain` — string. The domain this line is for, where the product needs one, like example.com.
  - `addons` — object[]. Addon services ordered together with this line — exactly the addons you previewed.
    - `service_plan_id` — integer (required). The addon plan id — an options[].servicePlanId from get_addon_suggestions for this line's plan.
    - `quantity` — integer. How many of this addon (bounds come from get_addon_suggestions). Defaults to 1.
  - `config` — object. Per-product provisioning options — the same config you previewed. A key the product cannot use is refused.
    - `php_version` — string. Hosting lines only: the PHP version to provision with, e.g. 8.3.
    - `preinstall` — string. Hosting lines only: preinstall an application, e.g. wordpress.
    - `hostname` — string. VPS/dedicated lines only: the server hostname.
    - `operative_system` — string. VPS/dedicated lines only: the OS template name from list_vps_templates.
- `billing_address_id` — integer. Which billing profile to invoice. Omit to use the account default.
- `attempt_key` — string. An idempotency key you choose. Reusing it within an hour returns the same held order instead of creating a second one.

## Example call

```json
{
  "name": "create_order",
  "arguments": {
    "items": [
      {
        "service_plan_id": 1,
        "quantity": 1,
        "domain": "example.se",
        "addons": [
          {
            "service_plan_id": 1,
            "quantity": 1
          }
        ],
        "config": {
          "php_version": "8.3",
          "preinstall": "example.se",
          "hostname": "example.se",
          "operative_system": "example.se"
        }
      }
    ]
  }
}
```

