Claude API n8n Workflow Integration Guide
n8n doesn't ship with a native Claude node, so the fastest way to integrate Claude into an n8n workflow is through the HTTP Request node, pointed at either Anthropic's Messages API or a compatible gateway. This guide walks through the exact node configuration, credential setup, request body, and response parsing so you can drop Claude into any automation — ticket triage, content generation, data extraction, Slack replies — without writing custom code nodes.
The short version: create an HTTP Request node, set the method to POST, point it at the API endpoint, add your API key as a header, send a JSON body with your model and messages, then use a Set or Code node to extract the text from the response. The rest of this article covers each step and the common failure points people hit along the way.
Why there's no native Claude node
n8n's core nodes cover popular SaaS tools, but LLM providers change their APIs often enough that community nodes lag behind. Anthropic's Messages API is simple and well-documented, which makes the HTTP Request node a better fit anyway — you get full control over headers, body shape, and error handling without waiting on a plugin update.
Setting up the HTTP Request node
Add an HTTP Request node to your workflow and configure it as follows:
- Method: POST
- URL: your Claude API endpoint
- Authentication: Header Auth (stored as an n8n credential, not pasted in plain text)
- Body Content Type: JSON
If you're calling Anthropic directly, you'll need an x-api-key header and an anthropic-version header. If you're using a proxy like SubToAPI that exposes a standard Authorization: Bearer key, setup is simpler — one header, no version string to manage:
Authorization: Bearer {{$credentials.subtoapi.apiKey}}
Content-Type: application/json
Request body
In the Body (JSON) field, build the payload using n8n expressions to pull data from earlier nodes:
{
"model": "claude-sonnet-4-5",
"max_tokens": 1024,
"messages": [
{
"role": "user",
"content": "={{$json.inputText}}"
}
]
}
Anything upstream — a webhook payload, a row from a spreadsheet, a Slack message — can feed inputText into the prompt. For more complex prompts, use a Function or Code node before the HTTP Request node to assemble the full messages array, including system prompts and prior turns, as a JSON string you reference with an expression.
Storing credentials correctly
Never hardcode an API key in the URL or body. In n8n, go to Credentials > New > Header Auth, set the header name (x-api-key or Authorization) and the value, and attach that credential to the HTTP Request node's Authentication section. This keeps the key out of workflow exports, which matters if you share workflows between team members or commit them to version control.
If you're managing Claude access for a small team, a gateway that issues scoped application keys avoids sharing one raw Anthropic key across every workflow. SubToAPI lets you generate a sub_live_... key per workflow or per teammate from a dashboard, so you can revoke one n8n automation's access without touching the others. See /docs/quickstart for the setup steps.
Parsing the response
Claude's response is a JSON object where the generated text lives inside a content array. Add a Set node (or a small Code node) after the HTTP Request node to extract it:
// Code node
const content = $input.first().json.content;
const text = content
.filter(block => block.type === "text")
.map(block => block.text)
.join("\n");
return [{ json: { text } }];
This gives you a clean text field to pass into the next node — a Slack message, a database write, an email send, whatever the workflow needs.
Handling errors and retries
LLM calls fail for reasons that aren't your fault: rate limits, transient network issues, oversized prompts. In the HTTP Request node settings, enable Retry On Fail with a short backoff (2–3 retries, a few seconds apart). For rate limit errors specifically, check the response status code in an IF node and route 429s to a Wait node before retrying, rather than failing the whole workflow.
If your workflow runs frequently — polling a queue, processing webhooks in bulk — centralizing retry and rate-limit logic behind a single endpoint avoids rebuilding the same error-handling branches in every n8n workflow. SubToAPI handles retries and backoff on its side and exposes usage metadata per request, so you can log token counts straight from the response without extra API calls. Details are in /docs/messages.
Streaming in n8n
n8n's HTTP Request node isn't built for consuming Server-Sent Events, so for most n8n automations you'll want non-streaming responses — send the full prompt, wait for the complete reply, then continue the workflow. If a downstream step genuinely needs token-by-token output (e.g., piping into a live chat UI), that's better handled by a dedicated service outside n8n; see /docs/streaming for how streaming works when you do need it.
A practical example: triaging support tickets
A common n8n + Claude pattern:
- Trigger: webhook receives a new support ticket
- HTTP Request node: send ticket text to Claude with a system prompt asking for category, priority, and a one-line summary
- Code node: parse the JSON response into structured fields
- Switch node: route by category to the right Slack channel or queue
- Set node: write the summary and priority into your helpdesk tool via another HTTP Request or native node
This replaces manual triage with a workflow that runs in seconds per ticket, and every step is visible and editable in the n8n canvas — no custom backend required.
Choosing where the key lives
For solo projects, an Anthropic key pasted into one n8n credential is fine. For teams running multiple workflows against Claude, a gateway with per-key limits and a shared dashboard makes auditing easier — you can see which workflow is driving spend without digging through n8n execution logs. Plans start at €9/month for a solo setup; see /pricing for team and scale options.
Questions
Does n8n have a built-in Claude node? No. There's no official Claude/Anthropic node in n8n as of now. Use the HTTP Request node with the Messages API endpoint and your API key in a header credential.
Can I use variables from previous nodes in the Claude prompt? Yes. Reference any upstream field with n8n expressions, e.g. ={{$json.fieldName}}, directly inside the JSON body of the HTTP Request node.
How do I avoid hardcoding my API key in the workflow? Create a Header Auth credential in n8n's Credentials section and attach it to the HTTP Request node's Authentication settings — the key is stored securely and excluded from workflow exports.