A practical field guide from Automation Ace.
Short answer: to trigger a Claude Code agent from Zapier, Make, or n8n, create a Claude Code scheduled task (formerly a routine) with an API trigger, then add an HTTP step that POSTs to the task's Fire URL with Authorization: Bearer <token>, anthropic-version: 2023-06-01, and a JSON body of {"text": "..."} built from your trigger's fields. In Zapier use Webhooks by Zapier POST, in Make use the HTTP Make a request module, and in n8n use the HTTP Request node. The response gives you a session URL to post back to Slack, a ticket, or a table.
Claude Code scheduled tasks and their fire endpoint were in research preview at the time of writing. Check the official API reference for the current request shape.
Short answer
- Create the Claude Code task, add an API trigger, and copy the Fire URL and token.
- Write the task prompt so it acts on the payload your automation sends.
- Add an HTTP POST step with the three headers and a
textbody. - Let the tool build the JSON so quotes and line breaks do not break it.
- Map
claude_code_session_urlinto a notification or record. - Deduplicate events and avoid blind retries: each call starts a new run.
Why trigger Claude Code from an automation
Your automation platform already knows when things happen: a bug report lands in the help desk, a form asks for a site change, a ticket gets a label, a weekly report is due. Claude Code knows how to work in a repository. Connecting them lets a no-code workflow hand repo work to an agent that clones the code, investigates, and opens a pull request for review.
- Help desk → bug triage: a tagged ticket starts a diagnosis and a draft fix.
- Form → content change: a marketing request starts a pull request on the website repo.
- Slack → on-demand task: a message or reaction starts a run and posts the session link back.
- CRM or project tool → integration change: a new customer starts a config or onboarding PR.
Deciding which steps belong to the workflow and which to the agent? See AI agents vs automations.
Step 1: Set up the Claude Code task
- At claude.ai/code/routines, create a task with the repository, cloud environment, model, and only the connectors it needs.
- Add an API trigger, copy the Fire URL, and generate the token. Copy the token right away; it is shown once.
- Write a prompt that expects the automation's payload:
You are the support-to-engineering agent for the web app repository.
Each run is started by an automation that sends a bug report in the
routine-fire-payload block. Using that report:
1. Try to locate the code path involved.
2. Write a short diagnosis: likely cause, files involved, confidence.
3. If the fix is small and clear, open a draft pull request that links
the ticket number. Otherwise, open a GitHub issue with your diagnosis.
4. Before creating anything, search for an open PR or issue that already
mentions this ticket number. If one exists, add a comment instead.
Never merge, deploy, or contact the customer.
The full API walkthrough, including the response and error codes, is in how to trigger Claude Code agents via API.
Step 2: Know the request you are building
| Setting | Value |
|---|---|
| Method | POST |
| URL | The task's Fire URL: https://api.anthropic.com/v1/claude_code/routines/trig_.../fire |
| Header | Authorization: Bearer sk-ant-oat01-... |
| Header | anthropic-version: 2023-06-01 |
| Header | anthropic-beta: experimental-cc-routine-2026-04-01 (shown in the docs; the reference says it is optional) |
| Header | Content-Type: application/json |
| Body | {"text": "..."}, built from mapped fields, up to 65,536 characters |
| Response | claude_code_session_id and claude_code_session_url |
Step 3: Design the text payload
The endpoint accepts one freeform text field and does not parse it. A labeled plain-text template is easier for the agent to read than raw JSON, and it survives mapping:
Bug report from support (ticket #{{ticket_id}})
Customer: {{customer_email}}
Plan: {{plan}}
Reported: {{created_at}}
Summary: {{subject}}
Details:
{{description}}
Links: {{ticket_url}}
- Include IDs and links so the agent can reference the source and so you can deduplicate.
- Trim long fields; the limit is 65,536 characters and longer input costs more usage.
- Leave out secrets and unnecessary personal data.
- The text arrives marked as untrusted, which helps if a customer's message contains instructions aimed at the agent. The saved prompt decides what to do with it.
Zapier: Webhooks by Zapier
| Zapier field | What to enter |
|---|---|
| Action | Webhooks by Zapier → POST (or Custom Request) |
| URL | The Fire URL |
| Payload Type | json |
| Data | Key text, value: your mapped template |
| Wrap Request In Array | No |
| Unflatten | No |
| Headers | Authorization = Bearer sk-ant-oat01-...; anthropic-version = 2023-06-01; anthropic-beta = experimental-cc-routine-2026-04-01 |
- Pick your trigger (new ticket, new form entry, new Slack message) and add a Filter step so only the events you want call Claude Code.
- Add the Webhooks by Zapier POST action with the settings above, and build the
textvalue from mapped fields. - Test the step, then open the returned session URL to confirm the run started.
- Add a Slack, email, or ticket comment step that maps
claude_code_session_url.
Keep the token out of shared Zap descriptions, and restrict who can edit the Zap. More on the webhook action: API by Zapier vs Webhooks by Zapier, passing data in webhook requests, and app API request actions.
Make: HTTP module
| Make field | What to enter |
|---|---|
| Module | HTTP → Make a request |
| URL / Method | The Fire URL / POST |
| Headers | Authorization, anthropic-version, and anthropic-beta as above |
| Body type | Raw, content type JSON (application/json) |
| Request content | A JSON object with one text key; build the value safely (see below) |
| Parse response | Yes, so later modules can map claude_code_session_url |
- Start the scenario from your trigger module and add a filter for the events that matter.
- Add a JSON Create JSON module with a
textfield, or a data structure, and map your template into it. - Add HTTP Make a request with the headers above and the JSON output as the body.
- Add an error handler route for 429 responses that stores the event for a later retry.
- Map
claude_code_session_urlinto Slack, a ticket, or a data store record.
See how to call any API with the Make HTTP module and Make scenario error handling.
n8n: HTTP Request node
| n8n field | What to enter |
|---|---|
| Node | HTTP Request |
| Method / URL | POST / the Fire URL |
| Authentication | Generic credential type → Header Auth: name Authorization, value Bearer sk-ant-oat01-... |
| Send Headers | anthropic-version and anthropic-beta as above |
| Send Body | JSON, using fields below: name text, value an expression with your template |
| Options | Leave automatic retries off, or limit them to 429 and 503 (see below) |
- Create a Header Auth credential so the token is stored as a credential, not in the node.
- Add the HTTP Request node after your trigger and an IF or Filter node.
- Set the body to JSON with a
textfield built from an expression. - Use the node's error output to route 429s to a Wait node or a retry queue.
- Pass
claude_code_session_urlto a Slack or ticket node.
Choosing between the three? See Zapier vs Make vs n8n.
Building the JSON safely
The most common failure is a hand-typed JSON body that breaks when a mapped field contains a quote or a line break. Let each tool build the JSON for you:
Zapier Webhooks by Zapier POST with Payload Type "json" and a Data key
of "text" builds and escapes the JSON for you.
Make Add JSON > Create JSON with a data structure that has one "text"
field, map your template into it, and send its output as the
HTTP module's request content. Avoid typing the JSON by hand.
n8n Use Send Body > JSON > Using Fields Below with a "text" field, or
in raw JSON mode let an expression build the whole body:
{{ JSON.stringify({ text: `Ticket ${$json.id}: ${$json.subject}\n\n${$json.body}` }) }}
Using the response
- Post the session URL back to where the request came from, so people can watch the run or continue it.
- Store the session ID with the source record to link the ticket and the run.
- Do not wait for the result in the workflow. The call returns when the session starts; the agent may take minutes. Have the prompt deliver the outcome (pull request, issue comment, Slack message through a connector).
- Close the loop with a second automation: for example, a GitHub “new pull request” trigger that updates the original ticket.
Duplicates, retries, and rate limits
- No idempotency: each successful call starts a new session, so a duplicate trigger means a duplicate run.
- Deduplicate first: store the event ID in a table or data store and skip ones you have seen; see webhook deduplication and reprocessing without duplicates.
- Retry only when no run started: retry 429 after
Retry-Afterand 503 after a short wait. After a 500 or a timeout, check the task's History before retrying. - Mind the limits: at the time of writing, 30 fires per hour per task (shared with Run now) and 100 API fires per hour per account. Filter and batch noisy triggers.
- Make the agent's work safe to repeat: the prompt checks for an existing PR or issue first.
Platform-neutral patterns are in how to trigger an AI agent from an API or webhook.
Troubleshooting
| What you see | Likely cause | Fix |
|---|---|---|
| 401 authentication_error | Token missing, mistyped, or regenerated | Re-paste the token with the Bearer prefix |
| 400 invalid_request_error | Missing anthropic-version, text over the limit, task paused | Add the header, truncate text, resume the task |
| 400 or garbled text | Hand-typed JSON broke on quotes or new lines | Let the tool build the JSON |
| 404 not_found_error | Wrong Fire URL or deleted task | Copy the Fire URL again |
| 429 rate_limit_error | Hourly fire limit reached | Wait for Retry-After; filter or batch triggers |
| Two runs for one event | Trigger fired twice or the step was retried | Deduplicate by event ID; avoid blind retries |
| Run starts but ignores your data | The prompt does not reference the payload | Tell the prompt to use the routine-fire-payload block |
Want the same task to run on a timer too? See running the same Claude Code agent on a schedule and on demand.
To get notified when those runs finish, see Slack, email, and push notifications for Claude Code scheduled tasks.
The same pattern works for ChatGPT; see from webhook to workspace agent with Zapier, Make, or n8n.
Frequently asked questions
Can I trigger Claude Code from Zapier?
Yes. Create a Claude Code scheduled task with an API trigger, then add a Webhooks by Zapier POST action to its Fire URL with Payload Type json, a Data key of text, and headers for Authorization: Bearer with the token and anthropic-version. The response includes a session URL you can map into later steps.
How do I call a Claude Code routine from Make?
Use the HTTP Make a request module with method POST, the Fire URL, the Authorization, anthropic-version, and anthropic-beta headers, and a JSON body with a text field. Build the JSON with a Create JSON module or data structure so mapped values are escaped.
How do I trigger Claude Code from n8n?
Use the HTTP Request node with POST to the Fire URL, a Header Auth credential for Authorization: Bearer and the token, an anthropic-version header, and a JSON body with a text field built from an expression.
Why does my Claude Code run ignore the data my automation sends?
The text arrives wrapped in a routine-fire-payload block that is marked as untrusted, and Claude does not act on it unless the saved prompt says to. Update the task prompt to tell Claude to use the details in that block.
How do I stop duplicate Claude Code runs from my automation?
The fire endpoint has no idempotency key, so deduplicate events by ID before calling it, avoid blind automatic retries, retry only 429 and 503 responses, check the task history before retrying after a 500 or timeout, and have the prompt check for existing pull requests or issues.
Disclaimer: Claude Code scheduled tasks (formerly routines) and their API are in research preview, and agent platforms, endpoints, limits, and features change quickly; details reflect public documentation and coverage at the time of writing, so confirm current details with each provider before building. Automation Ace is not affiliated with the companies named here. This article may include links to apps, products, or services; some links may be affiliate links, which means Automation Ace may earn a commission at no extra cost to you.