# Start an API-triggered workflow

Starts an API-triggered workflow.

```http
POST https://api.pozy.ai/v1/workflows/{workflowId}/trigger
```

- Area: Automations / Workflows
- Auth: Authorization: Bearer pz_live_...

## Path parameters

- `workflowId` (string, required)

## Request body

Content type: `application/json`

- `conversationId`, string
- `contactId`, string
- `to`, string
- `variables`, object

## Example request

```bash
curl -X POST "https://api.pozy.ai/v1/workflows/6e299f518f373bfd669857c4/trigger" \
  -H "Authorization: Bearer $POZY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "conversationId": "6e525f3820fc636aa96d2ee9",
  "contactId": "642d31f43531ce7d44aa5013",
  "to": "+14155550123",
  "variables": {}
}'
```

```ts
const res = await fetch("https://api.pozy.ai/v1/workflows/6e299f518f373bfd669857c4/trigger", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.POZY_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    conversationId: "6e525f3820fc636aa96d2ee9",
    contactId: "642d31f43531ce7d44aa5013",
    to: "+14155550123",
    variables: {}
  }),
});
const data = await res.json();
if (!res.ok) throw new Error(data?.error ?? `Request failed with status ${res.status}`);
console.log(data);
```

```python
import os
import requests

resp = requests.post(
    "https://api.pozy.ai/v1/workflows/6e299f518f373bfd669857c4/trigger",
    headers={"Authorization": f"Bearer {os.environ['POZY_API_KEY']}"},
    json={
        "conversationId": "6e525f3820fc636aa96d2ee9",
        "contactId": "642d31f43531ce7d44aa5013",
        "to": "+14155550123",
        "variables": {},
    },
    timeout=30,
)
resp.raise_for_status()
print(resp.json())
```

## Response 201

- `executionId`, string, required

```json
{
  "executionId": "6c1d5173be24d1f9e4e6f57f"
}
```
