Triggering AI Agents

How to Trigger Claude Code Agents from Zapier, Make, or n8n with HTTP Request

One HTTP step hands repo work from your no-code workflow to a Claude Code agent and returns a session link.

Claude CodeZapierMaken8n

By Troy Tessalone · · 11 minutes

Triggering AI Agents

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

  1. Create the Claude Code task, add an API trigger, and copy the Fire URL and token.
  2. Write the task prompt so it acts on the payload your automation sends.
  3. Add an HTTP POST step with the three headers and a text body.
  4. Let the tool build the JSON so quotes and line breaks do not break it.
  5. Map claude_code_session_url into a notification or record.
  6. 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

  1. At claude.ai/code/routines, create a task with the repository, cloud environment, model, and only the connectors it needs.
  2. Add an API trigger, copy the Fire URL, and generate the token. Copy the token right away; it is shown once.
  3. 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

SettingValue
MethodPOST
URLThe task's Fire URL: https://api.anthropic.com/v1/claude_code/routines/trig_.../fire
HeaderAuthorization: Bearer sk-ant-oat01-...
Headeranthropic-version: 2023-06-01
Headeranthropic-beta: experimental-cc-routine-2026-04-01 (shown in the docs; the reference says it is optional)
HeaderContent-Type: application/json
Body{"text": "..."}, built from mapped fields, up to 65,536 characters
Responseclaude_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 fieldWhat to enter
ActionWebhooks by Zapier → POST (or Custom Request)
URLThe Fire URL
Payload Typejson
DataKey text, value: your mapped template
Wrap Request In ArrayNo
UnflattenNo
HeadersAuthorization = Bearer sk-ant-oat01-...; anthropic-version = 2023-06-01; anthropic-beta = experimental-cc-routine-2026-04-01
  1. 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.
  2. Add the Webhooks by Zapier POST action with the settings above, and build the text value from mapped fields.
  3. Test the step, then open the returned session URL to confirm the run started.
  4. 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 fieldWhat to enter
ModuleHTTP → Make a request
URL / MethodThe Fire URL / POST
HeadersAuthorization, anthropic-version, and anthropic-beta as above
Body typeRaw, content type JSON (application/json)
Request contentA JSON object with one text key; build the value safely (see below)
Parse responseYes, so later modules can map claude_code_session_url
  1. Start the scenario from your trigger module and add a filter for the events that matter.
  2. Add a JSON Create JSON module with a text field, or a data structure, and map your template into it.
  3. Add HTTP Make a request with the headers above and the JSON output as the body.
  4. Add an error handler route for 429 responses that stores the event for a later retry.
  5. Map claude_code_session_url into 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 fieldWhat to enter
NodeHTTP Request
Method / URLPOST / the Fire URL
AuthenticationGeneric credential type → Header Auth: name Authorization, value Bearer sk-ant-oat01-...
Send Headersanthropic-version and anthropic-beta as above
Send BodyJSON, using fields below: name text, value an expression with your template
OptionsLeave automatic retries off, or limit them to 429 and 503 (see below)
  1. Create a Header Auth credential so the token is stored as a credential, not in the node.
  2. Add the HTTP Request node after your trigger and an IF or Filter node.
  3. Set the body to JSON with a text field built from an expression.
  4. Use the node's error output to route 429s to a Wait node or a retry queue.
  5. Pass claude_code_session_url to 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-After and 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 seeLikely causeFix
401 authentication_errorToken missing, mistyped, or regeneratedRe-paste the token with the Bearer prefix
400 invalid_request_errorMissing anthropic-version, text over the limit, task pausedAdd the header, truncate text, resume the task
400 or garbled textHand-typed JSON broke on quotes or new linesLet the tool build the JSON
404 not_found_errorWrong Fire URL or deleted taskCopy the Fire URL again
429 rate_limit_errorHourly fire limit reachedWait for Retry-After; filter or batch triggers
Two runs for one eventTrigger fired twice or the step was retriedDeduplicate by event ID; avoid blind retries
Run starts but ignores your dataThe prompt does not reference the payloadTell 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.

Claude CodeZapierMaken8n

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.

Build Better Systems

Ready to automate with confidence?

Share your tools, process, and goals. Automation Ace can design the Zapier, AI, and automation setup that fits your business.

Start a Project →