# Start automation run

> Starts an active automation of the trigger type api_call for one contact. Call it without plan_id for the preview, then with the plan_id and a different Idempotency-Key. If the start fails, the plan stays valid.

Last updated: 2026-10-25. Source: https://docs.smartchat.marketing/en/api/reference/automations/create_automation_run/

Starts an active automation of the trigger type api_call for one contact. Call it without plan_id for the preview, then with the plan_id and a different Idempotency-Key. If the start fails, the plan stays valid.

`POST /v1/automations/{automation_id}/runs`

| | |
|---|---|
| Permission | `automations:run` ([all permissions](https://docs.smartchat.marketing/en/api/permissions/)) |
| Risk | Send (reaches other people) |
| Idempotency-Key | Required ([how it works](https://docs.smartchat.marketing/en/concepts/idempotency/)) |
| Safe to repeat | Safe to repeat with the same Idempotency-Key: the first answer comes back and nothing is done twice. |
| Rate limit class | `send` (120 requests per minute per key) |
| Confirmation | Preview first, then the call with the plan ID |
| MCP tool | [`run_automation`](https://docs.smartchat.marketing/en/mcp/tools/run_automation/) |
| Since version | 2026-10-25 |

## What it does

- Sends WhatsApp messages to contacts.
- Needs a confirmation step (a preview first).
- Safe to repeat with the same Idempotency-Key.

> **Important** Messages are only sent to contacts who may receive them. The server checks the opt-in, never sends to unsubscribed contacts, respects the 24-hour window and uses approved templates only. See [Sending safely](https://docs.smartchat.marketing/en/security/).

## Request

**Header**

| Name | Required | Description |
|---|---|---|
| `Authorization` | yes | `Bearer <key>` |
| `Idempotency-Key` | yes | A unique value for this operation, for example a UUID (1 to 255 visible ASCII characters). |

**Path parameters**

| Name | Type | Description |
|---|---|---|
| `automation_id` | string | Automation ID. |

**Body** (JSON)

| Name | Type | Required | Description |
|---|---|---|---|
| `contact` | object | yes | The contact. A phone number or an email is needed. |
| `contact.phone` | string | no | Phone number in E.164 format. up to 16 characters; format e164 |
| `contact.email` | string | no | Email address. up to 254 characters; format email |
| `contact.name` | string | no | Name of the contact. up to 120 characters |
| `data` | object | no | Values for the {{variables}} the automation uses (up to 30 fields; names the automation does not use or the system reserves are refused; values up to 100 characters, no line break, no web address). The preview shows whether the contact is new. |
| `plan_id` | string | no | Plan ID from the preview call. Without it you get the preview. |

## Examples

**curl**

```bash
curl -X POST "https://api.smartchat.marketing/v1/automations/aut_0f8c1a2e4b7d4c3e9a5b6d7e8f901234/runs" \
  -H "Authorization: Bearer $SMARTCHAT_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
  "contact": {
    "phone": "+4915112345678",
    "name": "Mia"
  }
}'
```

**Python**

```python
import os
import uuid
import requests

response = requests.post(
    "https://api.smartchat.marketing/v1/automations/aut_0f8c1a2e4b7d4c3e9a5b6d7e8f901234/runs",
    headers={
        "Authorization": "Bearer " + os.environ["SMARTCHAT_API_KEY"],
        "Idempotency-Key": str(uuid.uuid4()),
    },
    json={
        "contact": {
            "phone": "+4915112345678",
            "name": "Mia",
        },
    },
)
response.raise_for_status()
print(response.json())
```

**TypeScript**

```typescript
const response = await fetch("https://api.smartchat.marketing/v1/automations/aut_0f8c1a2e4b7d4c3e9a5b6d7e8f901234/runs", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.SMARTCHAT_API_KEY}`,
    "Idempotency-Key": crypto.randomUUID(),
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "contact": {
      "phone": "+4915112345678",
      "name": "Mia"
    }
  }),
});
if (!response.ok) throw new Error(await response.text());
console.log(await response.json());
```

Response (201):


```json
{
  "object": "automation_run_plan",
  "plan_id": "pln_9f8e7d6c5b4a43210fedcba987654321",
  "expires_at": "2026-10-30T09:51:07Z",
  "automation_id": "aut_0f8c1a2e4b7d4c3e9a5b6d7e8f901234",
  "trigger": "api_call",
  "contact": {
    "phone": "+4915112345678"
  },
  "new_contact": true,
  "steps": 3
}
```

## Response

Status 201. Every response has the headers `Request-Id`, `SmartChat-Version` and `X-RateLimit-*`.

## Errors

| Code | Status | When |
|---|---|---|
| [`idempotency_key_invalid`](https://docs.smartchat.marketing/en/errors/#idempotency_key_invalid) | 400 | The 'Idempotency-Key' header must be 1 to 255 visible ASCII characters. |
| [`idempotency_key_required`](https://docs.smartchat.marketing/en/errors/#idempotency_key_required) | 400 | This call needs an 'Idempotency-Key' header. |
| [`plan_required`](https://docs.smartchat.marketing/en/errors/#plan_required) | 400 | This action needs a plan_id from a preview. |
| [`api_key_expired`](https://docs.smartchat.marketing/en/errors/#api_key_expired) | 401 | This API key has expired. |
| [`api_key_invalid`](https://docs.smartchat.marketing/en/errors/#api_key_invalid) | 401 | This API key is not valid. |
| [`api_key_revoked`](https://docs.smartchat.marketing/en/errors/#api_key_revoked) | 401 | This API key was revoked. |
| [`authentication_required`](https://docs.smartchat.marketing/en/errors/#authentication_required) | 401 | No API key was sent. Send 'Authorization: Bearer <key>'. |
| [`insufficient_scope`](https://docs.smartchat.marketing/en/errors/#insufficient_scope) | 403 | This key lacks a required permission. |
| [`ip_not_allowed`](https://docs.smartchat.marketing/en/errors/#ip_not_allowed) | 403 | This IP address is not allowed for this key. |
| [`automation_not_found`](https://docs.smartchat.marketing/en/errors/#automation_not_found) | 404 | No automation with this ID exists in this account. |
| [`plan_not_found`](https://docs.smartchat.marketing/en/errors/#plan_not_found) | 404 | No plan with this ID exists. |
| [`automation_not_active`](https://docs.smartchat.marketing/en/errors/#automation_not_active) | 409 | A run needs an active automation. |
| [`conflict`](https://docs.smartchat.marketing/en/errors/#conflict) | 409 | The state of the object does not allow this. |
| [`idempotency_in_progress`](https://docs.smartchat.marketing/en/errors/#idempotency_in_progress) | 409 | A request with this idempotency key is still running. |
| [`plan_already_used`](https://docs.smartchat.marketing/en/errors/#plan_already_used) | 409 | The plan was already used. |
| [`plan_changed`](https://docs.smartchat.marketing/en/errors/#plan_changed) | 409 | The content or audience changed after the preview. |
| [`plan_mismatch`](https://docs.smartchat.marketing/en/errors/#plan_mismatch) | 409 | The plan belongs to another account, key, action or request. |
| [`plan_expired`](https://docs.smartchat.marketing/en/errors/#plan_expired) | 410 | The plan is older than 10 minutes. |
| [`idempotency_key_reused`](https://docs.smartchat.marketing/en/errors/#idempotency_key_reused) | 422 | This idempotency key was already used with a different request. |
| [`validation_failed`](https://docs.smartchat.marketing/en/errors/#validation_failed) | 422 | A field is not valid. |
| [`rate_limited`](https://docs.smartchat.marketing/en/errors/#rate_limited) | 429 | Too many requests. Wait and try again. |
| [`internal_error`](https://docs.smartchat.marketing/en/errors/#internal_error) | 500 | Something went wrong on our side. |

All errors use [one format](https://docs.smartchat.marketing/en/concepts/errors-overview/).
