# POST /api/v1/orders/from-estimate/{estimate_id}

> Create order from estimate

- **Tag:** orders
- **Operation ID:** `create_order_from_estimate_api_v1_orders_from_estimate__estimate_id__post`

## Description

Convert a draft or accepted estimate into a new draft order. The customer, currency, description, and line items carry over (every line billed as a one-time `flat` fee); an optional `project_id` in the body attaches the order to a project. The estimate is marked converted and linked to the order — converting it a second time (or converting it to an invoice afterwards) is rejected.

## Authentication

Bearer token in `Authorization` header.
Required header: `x-business-id: <business uuid>`.

## Parameters

- `estimate_id` (path, string, required)

## Responses

### 201 — Successful Response

Schema: `app__core__success__SuccessEnvelope_OrderResponse___1`

- `success` (boolean)
- `message` (string)
- `code` (string)
- `data` (app__api__v1__schemas__orders__OrderResponse)

### 400 — Bad Request - Invalid input

### 401 — Unauthorized - Authentication required

### 403 — Forbidden - Insufficient permissions

### 404 — Not Found - Resource does not exist

### 422 — Validation Error

Schema: `HTTPValidationError`

- `detail` (array · ValidationError) → `ValidationError`
  - `loc` (array · string | integer · required)
  - `msg` (string · required)
  - `type` (string · required)
  - `input` (object)
  - `ctx` (object)

## Code samples

### cURL

```bash
curl -X POST 'https://api.ondayzero.com/api/v1/orders/from-estimate/{estimate_id}' \
  -H 'Authorization: Bearer dz_your_token' \
  -H 'x-business-id: YOUR_BUSINESS_ID' \
  -H 'Content-Type: application/json' \
  -d ''
```

### JavaScript

```javascript
const response = await fetch('https://api.ondayzero.com/api/v1/orders/from-estimate/{estimate_id}', {
  method: 'POST',
  headers: {
    Authorization: 'Bearer dz_your_token',
    'x-business-id': 'YOUR_BUSINESS_ID',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({}),
});
const data = await response.json();
```

### Python

```python
import httpx

headers = {
    "Authorization": "Bearer dz_your_token",
    "x-business-id": "YOUR_BUSINESS_ID",
}

payload = {}

response = httpx.post("https://api.ondayzero.com/api/v1/orders/from-estimate/{estimate_id}", headers=headers, json=payload)
data = response.json()
```

## See also

- HTML version: https://www.ondayzero.com/docs/reference/orders/create-order-from-estimate
- OpenAPI slice: https://www.ondayzero.com/docs/reference/orders/create-order-from-estimate/openapi.json
- Other endpoints in **orders**: https://www.ondayzero.com/docs/reference/orders
