Claude API n8n Automation Example: Step-by-Step Guide
If you're searching for a Claude API n8n automation example, you're probably trying to wire Claude into a workflow — summarizing form submissions, classifying support tickets, generating content from a database trigger, or enriching CRM records — without writing a standalone backend service. The good news is that n8n doesn't need a dedicated Claude node to do this. You can call Claude directly with n8n's built-in HTTP Request node, and this article walks through exactly how to set that up, including authentication, request structure, and common pitfalls.
The short version: you create an HTTP Request node, point it at the Claude (or Claude-compatible) API endpoint, pass your API key in the headers, send a JSON body with your prompt, and parse the response in a downstream node. Below is a full working example plus variations for multi-step workflows.
Why n8n + Claude Is a Common Pairing
n8n is popular for automation because it's self-hostable, visual, and connects to hundreds of services (Slack, Airtable, Postgres, Gmail, Notion) without code. Claude is popular for text generation, classification, extraction, and reasoning tasks that are hard to do with simple rules. Combining them means you can build pipelines like:
- New Airtable row → Claude summarizes it → Slack message posted
- Incoming email → Claude classifies intent → routed to the right team
- Webhook from a form → Claude drafts a reply → saved to CRM
- Scheduled trigger → Claude generates content → published to a CMS
None of this requires a custom server — n8n's node editor handles the orchestration, and Claude handles the language work.
Setting Up the HTTP Request Node
In n8n, add an HTTP Request node after your trigger. Configure it like this:
Method: POST URL: your Claude API endpoint Headers:
Content-Type: application/jsonAuthorization: Bearer YOUR_API_KEY
Body (JSON):
{
"model": "claude-3-5-sonnet",
"max_tokens": 500,
"messages": [
{
"role": "user",
"content": "Summarize this support ticket in two sentences: {{ $json.ticketText }}"
}
]
}
The {{ $json.ticketText }} is n8n expression syntax pulling data from the previous node — this is how you inject dynamic content from a trigger (webhook, database row, email) into the prompt.
Handling Authentication Cleanly
A common friction point with raw Claude API access in n8n is managing API keys, rate limits, and billing per project without building your own proxy layer. If you're running this workflow for a client or team, you don't want everyone sharing one raw key with no usage visibility.
This is where SubToAPI fits into an n8n setup: it turns your existing Claude access into a standard HTTPS API with its own scoped keys (sub_live_...), so each n8n workflow (or each client) can get its own key, and you can see usage per key from one dashboard instead of digging through logs. In the HTTP Request node, you'd just swap the endpoint and header:
{
"headers": {
"Authorization": "Bearer $SUBTOAPI_KEY",
"Content-Type": "application/json"
},
"url": "https://api.subtoapi.app/v1/messages"
}
Since the request/response shape follows the same /v1/messages structure documented in /docs/messages, you don't need to change your JSON body or how you parse the response — only the key and endpoint change. For teams running multiple automations, /pricing shows the per-seat plans if you want separate keys for separate workflows or clients.
Parsing the Response
Claude's response comes back as JSON with the generated text nested in a content array. In n8n, add a Set node or Code node after the HTTP Request node to extract it:
// Code node
const text = $input.first().json.content[0].text;
return [{ json: { summary: text } }];
Now summary is a clean field you can pass to the next node — Slack, Airtable, a database write, whatever your workflow needs.
A Complete Example Workflow
Here's a realistic end-to-end chain:
- Webhook node — receives a new support ticket payload
- HTTP Request node — sends ticket text to Claude, asks for category + summary
- Code node — parses Claude's JSON response into separate fields
- Switch node — routes based on category (billing, technical, general)
- Slack node — posts the summary to the relevant channel
This pattern generalizes to almost any text-processing automation: swap the webhook for a Gmail trigger, an Airtable trigger, or a cron schedule, and swap Slack for whatever output you need.
Multi-Step Prompts in a Single Workflow
For more complex automations — say, extract data, then validate it, then generate a follow-up — you can chain multiple HTTP Request nodes, each calling Claude with a different prompt and the previous step's output as context. This is slower than a single multi-turn call but keeps each step debuggable in the n8n UI, which matters a lot when you're troubleshooting a production automation.
If you need true multi-turn conversation state (not just chained one-off calls), you'll want to pass the full messages array — including prior turns — in each request, since the API itself is stateless between calls.
Common Issues and Fixes
- Timeouts on long prompts: increase the HTTP Request node's timeout setting; large
max_tokensresponses take longer. - Rate limit errors: add a Wait node or batch your trigger volume; scoped keys with visibility (like those from SubToAPI) make it easier to see which workflow is hitting limits.
- Malformed JSON in the body: use n8n's expression editor carefully — unescaped quotes in dynamic content break the JSON body. Wrap dynamic text with
JSON.stringify()in a Code node first if you're unsure. - No streaming support: n8n's HTTP Request node doesn't handle streaming responses well; for automations, request complete responses rather than streamed chunks. See /docs/streaming for when streaming is and isn't appropriate.
Getting Started
If you want to try this without managing raw API credentials or billing complexity, /signup gets you a SubToAPI key and free trial, and /docs/quickstart has the minimal request example to paste straight into an n8n HTTP Request node.
Questions
Does n8n have a native Claude node? Not a dedicated one as of now. You use the generic HTTP Request node with the Claude API endpoint, auth headers, and a JSON body — which works reliably and gives you full control over the request.
Can I use streaming responses in n8n workflows? Technically you can enable streaming on the API side, but n8n's HTTP Request node isn't built to consume streamed chunks well. For automations, request full (non-streamed) responses instead.
How do I avoid rate limit errors in a high-volume n8n automation? Batch your triggers, add Wait nodes between calls, and use separate scoped API keys per workflow so you can monitor usage independently rather than sharing one key across every automation.