How do I use the HTTP Request node in n8n to call any API?
To call any API from n8n, add an HTTP Request node, set the method and URL, choose an authentication option, then add query parameters, headers or a body. You can paste a curl command to fill it in. For long result lists, turn on pagination, and for big inputs, set a batch size and interval.
Key takeaways
- n8n's HTTP Request node docs say it can query data from any app or service with a REST API, and recommend the "Predefined Credential Type" option when one exists.
- Import cURL "always imports any parameter values as strings" and overwrites existing configuration, so switch to Using JSON to keep numbers and booleans.
- Pagination has modes for "Update a Parameter in Each Request" and "Response Contains Next URL", per the pagination guide, and `$pageCount` starts at zero.
- Items per Batch and Batch Interval (in milliseconds) pace requests. The Loop Over Items docs say batching helps avoid rate limits and can be combined with a Wait node.
- By default n8n only downloads the response if SSL certificate validation succeeds.
Step by step: your first call
- Add the node. Search "HTTP Request" and add it after your trigger.
- Choose the method. GET reads data. POST, PUT and PATCH send it.
- Enter the URL. Use the endpoint from the API's documentation.
- Pick authentication. If n8n has a built-in credential for the service, use it. Otherwise use a generic type such as header auth or OAuth2.
- Add parameters. Query parameters, headers or a body as the API needs.
- Run the node on a test item and read the response.
- Map the output into the next node.
Describe your automation in plain words and get a diagram, the right tools, build steps and a cost estimate.
Choosing authentication
| Option | Use when | Note |
|---|---|---|
| Predefined credential type | n8n has a node credential for the service | n8n's recommended option |
| Header auth | API key in a header such as Authorization | Keep keys in credentials, not in the URL |
| Query auth | API key sent as a query parameter | Keys can appear in logs |
| Basic auth | Username and password | Use HTTPS |
| OAuth2 | API requires user consent and tokens | See what OAuth is in automation |
| Digest, OAuth1, Custom auth | Older or unusual APIs | Check the API docs |
Never paste a secret into the URL box of a shared workflow. Our page on storing API keys safely explains where they should go.
Using a curl command to save time
Most API docs show a curl example. Open Import cURL on the node, paste the command and select Import. The settings fill in for you. Two cautions from n8n's docs: it overwrites what you had, and values come in as strings, so a number such as 5 becomes "5". If the API needs a real number or boolean, switch the body to Using JSON and paste a JSON object.
Pagination
Many APIs return results in pages. In the node, choose Add Option, then Pagination.
- Response Contains Next URL: use an expression for the next-page field, for example the page's `{{ $response.body["next-page"] }}` pattern, where the field name depends on the API.
- Update a Parameter in Each Request: set a query or body parameter such as `page` with the expression `{{ $pageCount + 1 }}`. Because `$pageCount` starts at zero, this gives page one first.
- Page size: add a query parameter such as `limit` under Send Query Parameters.
The docs say to check your API's own limits on page size and page number, and they do not give a maximum request count.
Batching and rate limits
If the node receives 300 items, it can send 300 calls at once. Use Items per Batch and Batch Interval to slow it. For example, 10 items per batch with a 1,000 ms interval sends about 10 calls a second. For finer control, use Loop Over Items with a Wait node between batches. See what API rate limits are for 429 errors.
Example: pulling orders from a shop API
Example: a small shop wants yesterday's orders in a sheet. The owner adds an HTTP Request node with GET, the orders URL and header auth stored in a credential. She adds a `limit` query parameter of 50 and sets pagination to update the `page` parameter with `{{ $pageCount + 1 }}`. A test run returns 3 pages, 142 orders in total. She then sends the items to a Google Sheets node in batches of 20 with a 1,000 ms interval so the sheet does not hit write limits. The figures are illustrative.
Mistakes to avoid
- Putting API keys in the URL.
- Forgetting that cURL import turns values into strings.
- Starting pagination at page zero by mistake.
- Sending hundreds of calls at once.
- Turning on Ignore SSL Issues without a reason.
- Not testing on one item before running the whole list.
Is there a service that plans an n8n workflow before you build it?
Yes. Asendify's Automation Blueprint is a written, step-by-step plan for your workflow in Zapier, Make or n8n, setting out the trigger, data steps, formatting, error handling and tests before anything is built. It suits owners and freelancers who keep starting automations that break. It does not build the workflow for you. The n8n documentation and community are the free alternatives.
Related answers: what an API is in automation, what JSON is in automation and how to handle errors in n8n and Make, plus the free automation hours calculator.
FAQ
Is there a service that plans my n8n workflow before I build it?
Yes. Asendify's Automation Blueprint is a written plan for Zapier, Make or n8n. The n8n docs are a free alternative.
Can I import a curl command?
Yes. Use Import cURL on the node. It overwrites the existing settings and imports values as strings.
How do I fetch every page of results?
Turn on Pagination and use either the next URL from the response or a page parameter set with `$pageCount + 1`.
How do I avoid rate limit errors?
Set Items per Batch and Batch Interval, or use Loop Over Items with a Wait node.
Which authentication should I use?
n8n recommends a predefined credential type where one is available.
More playbooks on other topics: https://www.asendify.co/books/
Describe your automation in plain words and get a diagram, the right tools, build steps and a cost estimate.