n8n Community Tutorial — Written for beginner to intermediate n8n users
Screenshot note: Some images are “n8n-inspired” mockups, not exact screen captures of your n8n environment—but they should still help you follow the lesson. Hint, hint, n8n Design Team… I’m not saying the UI needs a red-carpet entrance, but I would click that button.
Introduction
Chaining API calls is one of the most common patterns you will use in n8n. Once you get it, you can connect almost any two services that have an API.
The idea is simple. You make one API call to get some data. Then you use part of that data to make a second API call. Each step feeds the next.
Most people do not get stuck on the concept. They get stuck on one specific moment: finding the right value inside the first API response and placing it correctly into the second request. That is what this tutorial focuses on.
By the end, you will know the pattern well enough to repeat it for any API, in any workflow.
What Does “Chaining API Calls” Mean?
Think of it like passing a note down a line of people. The first person writes something down and hands it to the next. The next person reads it, adds to it, and passes it on.
In n8n, the flow looks like this:
- Step 1: API Call 1 gets data from a service.
- Step 2: n8n reads that data and picks out the piece you need.
- Step 3: API Call 2 uses that piece as part of its request.
- Step 4: The workflow keeps going.
Here is the basic pattern written out:
Trigger → HTTP Request 1 → Inspect Output → Map Field → HTTP Request 2 → Result
The part beginners most often skip is “Inspect Output → Map Field.” That middle step is where you read what the first API sent back and decide what to pass forward. This tutorial walks you through that step in detail.
Example Scenario
This example uses a free public API, so you can follow along without signing up for anything.
The workflow does two things:
- The first API call fetches a user record. The response includes a user ID.
- The second API call uses that user ID to fetch the user’s posts.
The specific API does not matter. The pattern is the same whether you are working with a CRM, a project tool, an e-commerce platform, or anything else.
Practice API: JSONPlaceholder is free, requires no account, and returns realistic JSON. It is a good place to try this tutorial before using a real API.
Nodes Used in This Tutorial
You do not need many nodes for this pattern. Here is what each one does:
Manual Trigger — Runs the workflow when you click a button. Good for testing.
HTTP Request node — Sends a request to an API and returns what the API sends back. You will use one per API call.
Edit Fields / Set node — Lets you keep only the fields you need and rename them if you want. Useful for cleaning up messy responses before passing data to the next step.
Code node (optional) — Lets you write JavaScript for more complex transformations. Try the Set node first. Only use the Code node when the Set node is not enough.
IF node (optional) — Checks whether a value exists before moving forward. Prevents the workflow from failing silently when something is missing.
Step-by-Step Tutorial
Step 1: Add a Manual Trigger
Open your n8n canvas. Add a Manual Trigger node.
This node has no settings to configure. It just gives you a button to run the workflow while you are building it. That way you do not have to wait for a schedule or an incoming webhook every time you want to test.
Step 2: Add the First HTTP Request Node
Add an HTTP Request node and connect it to the Manual Trigger.
Inside the node, fill in:
- Method: GET (or whatever the API requires)
- URL: the full address of the API endpoint you want to call
- Authentication: if the API needs a key or token, add it here
Using JSONPlaceholder, your URL would be:
https://jsonplaceholder.typicode.com/users/1
Click Execute Node. The output should appear in the panel on the right.
If you get an error, check the URL first. Then check authentication. Do not move to Step 3 until this node runs successfully.
Tip: The official n8n HTTP Request node docs explain every setting and authentication type: docs.n8n.io/integrations/builtin/core-nodes/n8n-nodes-base.httprequest/
Step 3: Inspect the Output
After the node runs, click the Output tab. You will see the JSON that the API sent back.
Read it. Find the field you need to pass to the next API call.
For example, if the response looks like this:
{
"id": 1,
"name": "Leanne Graham",
"email": "leanne@example.com"
}
The field you want is id, and its value is 1.
Sometimes the field is nested inside another object. For example:
{
"user": {
"id": 42,
"name": "Alex"
},
"status": "active"
}
Here, id is inside the user object. You will need to reflect that in your expression in the next step.
Tip: If the JSON looks like one long line and is hard to read, paste it into jsonformatter.curiousconcept.com to make it easier to scan.
Step 4: Use an Expression to Reference the Previous Node’s Data
What is an expression?
An expression is a short piece of code that n8n runs when the workflow executes. It pulls a value from an earlier node so you do not have to type it in by hand.
All expressions use double curly braces: {{ }}
To get the id field from the previous node’s output:
{{ $json.id }}
This says: look at the JSON from the previous node, and get the value of id.
If the field is nested, follow the path:
{{ $json.user.id }}
This says: look inside the user object in the JSON, and get the id from there.
How to enter an expression in n8n
When you are filling in a field inside any node, look for a small toggle or icon that switches the field from a fixed value to an expression. Click it, then type your expression. Depending on your version of n8n, you may see a live preview of the resolved value as you type.
Tip: If you are not sure of the exact path, click the expression editor icon. It lets you browse the output of previous nodes and click on a field to insert the correct path automatically. The look of this editor has changed across n8n versions, so check the docs for your version if things look different.
For a full explanation of how data mapping works in n8n, see: docs.n8n.io/data/data-mapping/
Step 5: Add the Second HTTP Request Node
Add a second HTTP Request node and connect it to the first one.
Use an expression to pass the value from the first response into this request. Here are the three most common places to put it:
Option A: In the URL path
https://api.example.com/users/{{ $json.id }}/posts
Option B: As a query parameter
In the node settings, add a query parameter:
Name: userId
Value: {{ $json.id }}
Option C: In the JSON body
For POST or PUT requests:
{
"userId": "{{ $json.id }}"
}
Run the node. If the value passed correctly, the response should match the specific user or record from the first call.
Watch out: If the response contains an error about an invalid ID, or the result does not match what you expected, go back and check Steps 3 and 4. The expression path is usually the cause.
Step 6: Clean Up the Data with an Edit Fields / Set Node
Most API responses include fields you do not need. Passing everything forward makes the workflow harder to read and harder to debug.
Add an Edit Fields (Set) node between your two HTTP Request nodes. Use it to keep only the fields you need and rename them if that helps.
For example, if the first API returns:
{
"id": 1,
"name": "Leanne",
"address": { ... },
"company": { ... },
"phone": "555-0100"
}
And you only need id and name, set the output to just those two fields. Your expressions in the second node will be simpler, and anyone reading the workflow later will immediately understand what data is being passed.
Tip: Keeping data lean at each step is a habit, not something n8n does for you automatically. It takes a few extra clicks, but it makes workflows much easier to maintain.
Step 7: Test Just Two Calls First
Get two API calls working before you add a third.
Run the full workflow. Check the output of each node one at a time. Make sure the value from the first call is arriving correctly in the second call’s response.
Then, and only then, add the next step.
Watch out: Adding many steps before testing is one of the most common mistakes beginners make. When the workflow fails, it is much harder to find the problem if you have not confirmed each step along the way.
Step 8: Add Validation with an IF Node
What if the first API call does not return the field you need? The second call will fail, and the error message may not explain why.
An IF node lets you check whether the value exists before the workflow continues.
Set it up like this:
- Condition:
{{ $json.id }}is not empty - True branch: connect to the second HTTP Request node
- False branch: connect to a node that stops the run, logs a message, or sends you a notification
This is not required for a quick test, but it is worth adding before you use the workflow in a real situation.
Common Mistakes and Fixes
The field path is wrong
Check the JSON in Step 3 again. Make sure you are following the exact structure. A nested field like id inside user needs the path $json.user.id, not just $json.id.
The API returns a list, not a single object
If the response starts with a square bracket like [{...}, {...}], it is an array. Use {{ $json[0].id }} to get the id from the first item. To process every item in the list, look into the Loop Over Items node.
The second API rejects the value
Some APIs expect a number. Others expect a string. If your expression sends the wrong type, the API may reject it. Use a Set node or a Code node to convert the value before sending it.
The first API response is empty
Run the first node by itself and check the Output tab. If nothing comes back, the problem is with that node, not the chaining. Fix it before moving on.
Authentication fails in the second node but not the first
Each HTTP Request node manages its own authentication. You can reuse a saved credential, but you have to select it in each node separately.
It works for one item but breaks for multiple
By default, items in n8n move through most nodes one at a time. If you are processing a list and things are not working as expected, check whether a Loop Over Items node would help. How items flow can depend on your specific setup, so testing with a small list first is always a good idea.
The API rate-limits you
If you call an API many times in a row, it may slow down or block your requests. Add a Wait node between calls, or check the API’s documentation for rate limit details.
You built too many steps before testing
Go back to Step 7. Test two nodes at a time.
Best Practices
- Name your nodes clearly. “HTTP Request 1” tells you nothing. “Get User by Email” tells you exactly what is happening.
- Test each node before connecting the next one. Do not assume it works.
- Keep the output of a good test run handy. If you break something, you can compare it to what the correct output looked like.
- Use an Edit Fields / Set node to trim responses. Pass forward only what the next step actually needs.
- Add an IF node before any step that depends on a specific value. It is a small amount of work that prevents a lot of confusing failures.
- Start with two API calls and get them working before adding more.
When to Use a Code Node
The Code node lets you write JavaScript to reshape data in ways the Set node cannot handle. You might use it to:
- Combine values from several fields into one new field
- Filter items from an array based on a condition
- Reformat a date or convert a number to a string
Use the Code node when the Set node is not enough. Do not use it just because it feels more powerful. Expressions and the Set node cover most cases, and they are much easier to read and maintain.
Use AI to Help
If you are stuck on an expression or not sure how to reshape a response, an AI tool can often give you the answer in seconds. You do not need to describe the whole workflow. Just share the relevant JSON and say what you need.
Here is a prompt you can copy and use:
Copy/paste AI prompt:
I am building a workflow in n8n.
The first API call returns this JSON:
[paste your JSON here]
I need to pass the value of [field name] into the URL of a second HTTP Request node.
The URL pattern is:
https://api.example.com/[something]/[value goes here]/[something]
Write the n8n expression I should use in the URL field.
Also explain what it does in plain English.
You can adapt this prompt for query parameters, request bodies, or any other place you need to insert a dynamic value. Replace the JSON and URL pattern with your own details.
Watch out: Always test the expression in a real n8n run. AI tools can get the syntax slightly wrong, especially for deeply nested fields or arrays.
Document Your Results
Once your workflow is working, spend five minutes writing down what it does. You will thank yourself the next time you open it.
Here is a simple template you can copy:
Workflow Documentation Template
Workflow name:
Date created:
Last updated:
Purpose:
What does this workflow do? (one or two sentences)
Trigger:
What starts it? (manual, scheduled, webhook, etc.)
API Calls:
Call 1:
Service:
Endpoint:
Method:
What it returns:
Key field passed forward:
Call 2:
Service:
Endpoint:
Method:
Where the value from Call 1 is used:
What it returns:
Data flow:
[Node name] → passes [field name] → [Node name]
Known issues or edge cases:
Links:
API documentation:
n8n workflow URL:
Keep this in a shared doc, a Notion page, or as a sticky note inside the workflow itself using n8n’s built-in note feature. Future you will appreciate it.
Production Readiness Checklist
Before you turn a workflow on for real use, go through this list:
- Both API calls return the correct data when you run the workflow manually
- The expression paths are correct and tested with real data
- An IF node or equivalent check is in place before any step that depends on a specific value
- Node names are clear and descriptive
- Any Set nodes added just for debugging during testing have been removed or disabled
- Authentication credentials are saved and selected in every node that needs them
- The workflow has been tested with more than one input, not just a single example
- You know what happens if an API call fails (does the workflow stop, retry, or notify you?)
- Rate limits have been considered if the workflow will run many times in a row
- The workflow has been documented using the template above
What to Do Next
Now that you understand the two-call pattern, here are some good directions to explore:
Try it with a real API. Pick one service you already use. Find the API documentation. Build a simple two-step workflow using what you learned here.
Add a third call. Once two calls work, add a third. The pattern is exactly the same. Get the value from the second response and pass it to the third request.
Learn about error handling. Look into the n8n Error Trigger node and the Stop and Error node. These let you catch failures and respond to them instead of letting the workflow silently break.
Explore the Loop Over Items node. If you need to make the same API call for each item in a list, the Loop Over Items node is the right tool to learn next.
Share what you built. The n8n community forum is a good place to post your workflow, ask questions, and see what others are building.
A Note on Accuracy
This tutorial covers general patterns. A few things to keep in mind:
- Node names and interface details can change between n8n versions. If something does not look exactly as described, check the official n8n documentation for your version.
- The expression editor interface has changed across versions of n8n. The expressions themselves (
{{ $json.id }}) work the same way, but the editor may look different. - Item flow behavior in n8n can depend on your specific node setup. The n8n data flow docs explain the details.
Official n8n Documentation
Bookmark these two pages:
- HTTP Request node: docs.n8n.io/integrations/builtin/core-nodes/n8n-nodes-base.httprequest/
- Data mapping: docs.n8n.io/data/data-mapping/
Final Recap
The pattern is always the same:
Get data → Find the field you need → Pass it forward → Test → Repeat
- Trigger the workflow.
- Make the first API call.
- Read the JSON output and find the field you need.
- Use an expression like
{{ $json.id }}to reference it in the next node. - Make the second API call using that value.
- Test. Fix. Add the next step.
Each new API call follows the same steps. After you do it twice, the third time is much easier.
Go slowly. Test often. Read the output at each step. That is the whole method.
Published in the n8n Community Tutorial Section • Written for beginner to intermediate n8n users









