---
title: "Add a trigger (webhook | chain)"
method: POST
path: "/v1/schedules/{schedule_id}/triggers"
tags: ["triggers"]
---

# Add a trigger (webhook | chain)

`POST /v1/schedules/{schedule_id}/triggers`

For `webhook`, create and exact bounded Idempotency-Key replay responses include the same HMAC `webhook_secret`; GET/list never expose it. It is encrypted at rest for verification/replay recovery, so store your copy securely. Chain triggers support a max depth of 5.

## Headers

- `Idempotency-Key` string

## Request body

- TriggerCreateRequest
  - `kind` 'webhook' | 'chain', required
  - `source_schedule_id` string, nullable
  - `event` 'on_complete' | 'on_failure' | 'on_any'
  - `pass_output` boolean
  - `rate_limit_per_minute` integer
  - `enabled` boolean

## Response `200`

Trigger created.

- TriggerResponse
  - `id` string, required
  - `schedule_id` string, required
  - `kind` string, required
  - `enabled` boolean, required
  - `created_at` string, date-time, required
  - `webhook_url` string, nullable
  - `webhook_secret` string, nullable — HMAC secret. Returned on creation and identical idempotent replays. Stored only as versioned AES-GCM ciphertext.
  - `email_address` string, nullable
  - `source_schedule_id` string, nullable
  - `event` string, nullable

## Other responses

- `400` — Invalid request body or parameters.
- `401` — Missing, invalid, or revoked API key. Pass `X-API-Key: sk-coasty-live-...` (or test).
- `403` — API key lacks the required scope or tier-feature is unavailable on the caller's plan.
- `404` — Resource not found in this key's namespace.
- `409` — The resource state conflicts with this operation.
- `413` — The request body exceeds the endpoint limit.
- `422` — The JSON shape is valid but one or more values violate the endpoint contract.
- `429` — Rate or concurrency limit exceeded.
- `500` — Unexpected server error. Retry with exponential backoff.
- `502` — An upstream dependency returned an invalid response.
- `503` — A required service is temporarily unavailable.
- `504` — An upstream dependency timed out.

---

[API](https://skmtc.net/coasty/apis/coasty-public-api.md) · [All operations](https://skmtc.net/coasty/apis/coasty-public-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/coasty/coasty-public-api/revisions/f50d93b0d8a1/schema)
