from line 5
55---
66
77<Warning>
8 This is an experimental API. Request and response shapes, rate limits, and token semantics might change. Breaking changes ship behind new dated beta header versions, and the two previous header versions continue to work so that callers have time to migrate.
8 This is an experimental API. Request and response shapes, rate limits, and token semantics might change.
99</Warning>
1010
1111[Claude Code](https://code.claude.com/docs) is Anthropic's agentic coding tool. [Claude Code on the web](https://code.claude.com/docs/en/claude-code-on-the-web) runs Claude Code sessions on Anthropic-managed cloud infrastructure at claude.ai/code, and a [routine](https://code.claude.com/docs/en/routines) is a saved configuration there: a prompt, one or more repositories, and connectors, packaged so it can run unattended on a schedule, in response to GitHub events, or when called over HTTP.
from line 25
2525| SDK support | None | Available in all [client SDKs](https://platform.claude.com/docs/en/cli-sdks-libraries/overview) |
2626| Billing | Claude Code subscription usage on claude.ai | Claude Platform usage |
2727| Path namespace | `/v1/claude_code/...` | `/v1/...` |
28| Stability | Experimental; requires `anthropic-beta: experimental-cc-routine-2026-04-01` | Stable or standard beta |
28| Stability | Experimental | Stable or standard beta |
2929
3030## Before you begin
3131
from line 42
4242POST https://api.anthropic.com/v1/claude_code/routines/{routine_id}/fire
4343```
4444
45Every request must include the `anthropic-beta: experimental-cc-routine-2026-04-01` header. Requests without it return `400 invalid_request_error`.
46
4745The Claude Code web UI provides the full URL alongside the token when you add an API trigger, so most integrations store both as secrets and call the endpoint directly. The following examples show a shell call and a GitHub Actions step that triggers the routine on CI failure.
4846
4947```bash cURL
from line 48
5048curl -X POST https://api.anthropic.com/v1/claude_code/routines/$ROUTINE_ID/fire \
5149 -H "Authorization: Bearer $ROUTINE_TOKEN" \
5250 -H "anthropic-version: 2023-06-01" \
53 -H "anthropic-beta: experimental-cc-routine-2026-04-01" \
5451 -H "Content-Type: application/json" \
5552 -d '{"text": "Sentry alert SEN-4521 fired in prod. Stack trace attached."}'
5653```
from line 61
6461 curl -X POST "$ROUTINE_FIRE_URL" \
6562 -H "Authorization: Bearer $ROUTINE_FIRE_TOKEN" \
6663 -H "anthropic-version: 2023-06-01" \
67 -H "anthropic-beta: experimental-cc-routine-2026-04-01" \
6864 -H "Content-Type: application/json" \
6965 -d "{\"text\": \"CI failed: $GITHUB_WORKFLOW run $GITHUB_RUN_ID on $GITHUB_REF\"}"
7066```
from line 69
7369
7470### Headers
7571
76| Name | Required | Description |
77| ------------------- | -------------------- | ---------------------------------------------------------------------------------------------------- |
78| `Authorization` | Yes | `Bearer <token>`. The per-routine token created in the Claude Code web UI, prefixed `sk-ant-oat01-`. |
79| `anthropic-beta` | Yes | Must include `experimental-cc-routine-2026-04-01`. |
80| `anthropic-version` | Yes | The [API version](https://platform.claude.com/docs/en/api/versioning), for example `2023-06-01`. |
81| `Content-Type` | When body is present | `application/json`. |
72| Name | Required | Description |
73| ------------------- | -------------------- | --------------------------------------------------------------------------------------------------------------- |
74| `Authorization` | Yes | `Bearer <token>`. The per-routine token created in the Claude Code web UI, prefixed `sk-ant-oat01-`. |
75| `anthropic-version` | Yes | The [API version](https://platform.claude.com/docs/en/api/versioning). `2023-06-01` is the only accepted value. |
76| `Content-Type` | When body is present | `application/json`. |
8277
78Older integrations that send an `anthropic-beta: experimental-cc-routine-2026-04-01` header are unaffected: the endpoint accepts requests with and without it.
79
8380### Path parameters
8481
8582| Name | Type | Description |
from line 123
126123}
127124```
128125
129| HTTP status | Error type | Cause |
130| ----------- | ----------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
131| 400 | `invalid_request_error` | Missing or invalid `anthropic-beta` header, `text` exceeds 65,536 characters, or the routine is paused (see [Edit and control routines](https://code.claude.com/docs/en/routines#edit-and-control-routines)). |
132| 401 | `authentication_error` | No bearer token in the `Authorization` header, or the token does not match this routine. |
133| 403 | `permission_error` | The account or organization does not have access to this endpoint. |
134| 404 | `not_found_error` | The routine does not exist. |
135| 429 | `rate_limit_error` | The account's routine run limit or usage limit has been reached. The response includes a `Retry-After` header indicating when the window resets. |
136| 500 | `api_error` | An unexpected server error. Retry with exponential backoff; if the error persists, contact support with the request ID. |
137| 503 | `overloaded_error` | The service is temporarily overloaded. Retry after a short delay. The Claude Platform returns 529 for this error type; this endpoint returns 503. |
126| HTTP status | Error type | Cause |
127| ----------- | ----------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
128| 400 | `invalid_request_error` | Missing or unsupported `anthropic-version` header, `text` exceeds 65,536 characters, or the routine is paused (see [Edit and control routines](https://code.claude.com/docs/en/routines#edit-and-control-routines)). |
129| 401 | `authentication_error` | No bearer token in the `Authorization` header, or the token does not match this routine. |
130| 403 | `permission_error` | The account or organization does not have access to this endpoint. |
131| 404 | `not_found_error` | The routine does not exist. |
132| 429 | `rate_limit_error` | An hourly fire limit for the routine or the account has been reached. The response includes a `Retry-After` header indicating when the window resets. |
133| 500 | `api_error` | An unexpected server error. Retry with exponential backoff; if the error persists, contact support with the request ID. |
134| 503 | `overloaded_error` | The service is temporarily overloaded. Retry after a short delay. The Claude Platform returns 529 for this error type; this endpoint returns 503. |
138135
139136## Authentication
140137
from line 145
148145
149146## Rate limits
150147
151Routine runs count against a per-account daily allowance that varies by plan, and the resulting sessions draw down the same Claude Code subscription usage as interactive sessions. When either limit is reached, the endpoint returns `429 rate_limit_error` with a `Retry-After` header. Organizations with extra usage enabled continue past the included allowance on metered overage.
148API fires are limited per hour: each routine accepts up to 30 fires per hour (shared across API fires, the **Run now** button in the web UI, and one-shot re-arms), and each account can make up to 100 API fires per hour across all routines. The resulting sessions draw down the same Claude Code subscription usage as interactive sessions. When a limit is reached, the endpoint returns `429 rate_limit_error` with a `Retry-After` header.
152149
153View your remaining daily runs at [claude.ai/code/routines](https://claude.ai/code/routines). To learn how routine usage interacts with subscription limits and extra usage billing, see [Usage and limits](https://code.claude.com/docs/en/routines#usage-and-limits) in the Claude Code documentation.
150To learn how routine usage interacts with subscription limits and extra usage billing, see [Usage and limits](https://code.claude.com/docs/en/routines#usage-and-limits) in the Claude Code documentation.
154151
155152## SDK support
156153
from line 156
159156## See also
160157
161158* [Automate work with routines](https://code.claude.com/docs/en/routines) in the Claude Code documentation
162* [Beta headers](https://platform.claude.com/docs/en/api/beta-headers)
163159* [Errors](https://platform.claude.com/docs/en/api/errors)
164160