# POST /api/v1/orders/{order_id}/attach-contract-file

> Attach the executed contract file

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

## Description

Attach an uploaded executed-contract PDF (the `s3_key` from `POST /upload`, or a URL) to a sent or signed order, without changing its status. Completes the presign → upload → attach flow so countersign can freeze the document reference into the contract.

## Authentication

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

## Parameters

- `order_id` (path, string, required)

## Request body

Schema: `OrderAttachContractFileRequest`

- `signed_contract_file_url` (string · required) — S3 key or URL of the executed contract PDF.

## 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/{order_id}/attach-contract-file' \
  -H 'Authorization: Bearer dz_your_token' \
  -H 'x-business-id: YOUR_BUSINESS_ID' \
  -H 'Content-Type: application/json' \
  -d '{
  "signed_contract_file_url": "string"
}'
```

### JavaScript

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

### Python

```python
import httpx

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

payload = {
  "signed_contract_file_url": "string"
}

response = httpx.post("https://api.ondayzero.com/api/v1/orders/{order_id}/attach-contract-file", headers=headers, json=payload)
data = response.json()
```

## See also

- HTML version: https://www.ondayzero.com/docs/reference/orders/attach-contract-file
- OpenAPI slice: https://www.ondayzero.com/docs/reference/orders/attach-contract-file/openapi.json
- Other endpoints in **orders**: https://www.ondayzero.com/docs/reference/orders
