# POST /api/v1/advisory-firms/{firm_id}/templates/{template_id}/deploy

> Deploy a firm template to selected client businesses

- **Tag:** advisory-firm-templates
- **Operation ID:** `deploy_firm_template_api_v1_advisory_firms__firm_id__templates__template_id__deploy_post`

## Description

Bulk-applies the template to each business in ``business_ids``. COA templates use ``LedgerService.apply_coa``; bank-rule templates create new ``BankRule`` rows (duplicates by name are treated as skips so re-deploying is idempotent); review-checklist templates are recorded informationally.

## Authentication

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

## Parameters

- `firm_id` (path, string, required)
- `template_id` (path, string, required)

## Request body

Schema: `FirmTemplateDeployRequest`

- `business_ids` (array · string · required) — Business IDs to deploy the template to.

## Responses

### 201 — Successful Response

Schema: `FirmTemplateDeployResponse`

- `template_id` (string · required)
- `kind` (string · required)
- `applied` (array · FirmTemplateDeployResultRow) → `FirmTemplateDeployResultRow`
  - `business_id` (string · required)
  - `summary` (object)
  - `error` (string)
- `failed` (array · FirmTemplateDeployResultRow) → `FirmTemplateDeployResultRow`
  - `business_id` (string · required)
  - `summary` (object)
  - `error` (string)
- `skipped` (array · FirmTemplateDeployResultRow) → `FirmTemplateDeployResultRow`
  - `business_id` (string · required)
  - `summary` (object)
  - `error` (string)
- `applied_count` (integer)
- `failed_count` (integer)
- `skipped_count` (integer)

### 401 — Unauthorized - Authentication required

### 403 — Forbidden - Insufficient permissions

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

### 422 — Validation Error - Invalid data format

## Code samples

### cURL

```bash
curl -X POST 'https://api.ondayzero.com/api/v1/advisory-firms/{firm_id}/templates/{template_id}/deploy' \
  -H 'Authorization: Bearer dz_your_token' \
  -H 'x-business-id: YOUR_BUSINESS_ID' \
  -H 'Content-Type: application/json' \
  -d '{
  "business_ids": []
}'
```

### JavaScript

```javascript
const response = await fetch('https://api.ondayzero.com/api/v1/advisory-firms/{firm_id}/templates/{template_id}/deploy', {
  method: 'POST',
  headers: {
    Authorization: 'Bearer dz_your_token',
    'x-business-id': 'YOUR_BUSINESS_ID',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
  "business_ids": []
}),
});
const data = await response.json();
```

### Python

```python
import httpx

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

payload = {
  "business_ids": []
}

response = httpx.post("https://api.ondayzero.com/api/v1/advisory-firms/{firm_id}/templates/{template_id}/deploy", headers=headers, json=payload)
data = response.json()
```

## See also

- HTML version: https://www.ondayzero.com/docs/reference/advisory-firm-templates/deploy-firm-template
- OpenAPI slice: https://www.ondayzero.com/docs/reference/advisory-firm-templates/deploy-firm-template/openapi.json
- Other endpoints in **advisory-firm-templates**: https://www.ondayzero.com/docs/reference/advisory-firm-templates
