How to Call Any REST API in an n8n Workflow
The n8n HTTP Request node is the way to reach an app that has no dedicated node. Here is how to build the request, set its parts, and handle what comes back.
- published
n8n does not support every app with its own integration. When a client needs data from one of those, the n8n HTTP Request node is the answer. The docs say it makes requests to query data from any app or service with a REST API. If the app can be reached over REST, this node can reach it.
The docs also say you can use the HTTP Request node as a regular node or attached to an AI agent as a tool. So the same node serves two jobs in an n8n workflow.
When you reach for it
The docs are plain about the cost of this node. Using it means creating a REST API call, so you need basic API knowledge. A dedicated node hides the API from you. This one does not. You will be reading the app's API documentation and translating it into a request.
That is the trade. You get to connect anything with a REST API. In exchange, you do some of the work a dedicated node would have done for you.
Two ways to build the request
The docs say you can set up an HTTP request by configuring parameters or importing a curl command.
The curl import is the fast path. The docs say you can copy curl examples from an API's documentation into the HTTP Request node. Paste one in and the node sets up the request.
Two warnings come with the import. The docs say importing a curl command overwrites any existing configuration. So do the import first, then adjust. The docs also say a curl import brings in parameter values as strings, so use JSON to keep numbers and booleans. A value that arrives as the string "true" is not the same as the boolean true, and some APIs care about the difference.
Method, parameters, headers and body
The docs say you select the method for each HTTP Request node request. GET, POST and the rest each tell the API what you want done. The method you need will be in the API's documentation.
Three parts of the request do different jobs. The docs say query parameters act as filters on HTTP requests. The docs say headers contain metadata or context about your request. The docs say the JSON body option sends your body as JSON.
So a GET call often carries its filters as query parameters. A POST call often carries the thing you are creating in the JSON body. Headers carry context the API needs, such as who is asking.
Authentication
The docs give two ways to handle authentication. The docs recommend the Predefined Credential Type option for HTTP Request authentication when it is available.
When there is no predefined type for the app, the docs say generic credentials are for integrations n8n does not support. You configure the authentication yourself. The docs say generic credentials support Basic auth, Header auth, OAuth1, OAuth2, and more. The API's documentation will say which of these it accepts.
What comes back, and what goes wrong
The docs say the node returns only the response body by default. The docs say the response format can be autodetect or a file.
Errors have a rule of their own. The docs say the node returns success only on a 2xx code unless Never Error is turned on. So any other code fails the node by default. Turn on Never Error only when the workflow should keep going even after a bad response.
The docs say the HTTP Request node follows redirects by default. The docs say the timeout option sets how long the node waits for the server to send response headers. Use it when an API is slow to answer.
Large responses: batching and pagination
Some APIs cannot return a big result set in one call. The docs say pagination helps when query results are too big for the API to return in one call. The docs say pagination means splitting a large set of data into multiple pages.
The docs say pagination can update a parameter in each request or follow a next URL in the response. The docs say the HTTP Request node offers built-in variables for pagination, including $pageCount.
Do not guess how the API paginates. The docs say different APIs implement pagination in different ways, so check the API documentation. The docs also say to check the API documentation or make an unpaginated call before setting up pagination.
On the input side, the docs say the batching option controls how to batch large numbers of input items. If the workflow feeds the node a long list, batching keeps the requests orderly.
The node as an AI agent tool
Attached to an agent, the node changes shape a little. The docs say the optimize response option reduces the data passed to the LLM when the node is an agent tool. The docs say optimizing the response can help the LLM ignore unimportant details.
An API response can carry far more than a model needs. Optimization trims that down before it reaches the agent. For more on what agents can use, see the tools an n8n AI agent can call.
Where to go next
A request has to start somewhere. If it should start when an event arrives, look at how the n8n Webhook node starts an AI agent. If it should start on a clock, read how the n8n Schedule Trigger picks its time. And if you are weighing which platform to build on, Make and Zapier compared covers that choice.