How to Use HTTP Node in n8n | Connect Any API or Service in n8n

Learn how to use the HTTP Request node in n8n to connect any API or service. Step-by-step guide on configuration, methods, authentication, and cURL import.

Table of Contents

Overview

In this lesson, you'll learn how to use the HTTP Request node in n8n to connect and interact with any API or service, especially those not officially supported by n8n. You'll understand key API concepts, how to configure HTTP requests with various methods, authentication types, query parameters, headers, and request bodies. You'll also see how to import cURL requests directly into n8n for quick setup and explore practical examples to deepen your understanding.


Understanding APIs and HTTP Requests in n8n

What is an API?

An API (Application Programming Interface) acts like a translator between different applications, allowing them to communicate by sending and receiving data automatically without human intervention. APIs use a request-response model:

  • Request: You ask for data or send data to an application.
  • Response: The application sends back the requested data or a confirmation of your action.

Examples:

  • Weather API: Request weather info for a location; receive temperature and forecast data.
  • Google Maps API: Send coordinates; receive directions.
  • CRM API: Send customer details; receive confirmation that data is saved.

For more on managing API credentials and authentication in n8n, see our detailed guide on n8n API, Collaboration & Credential Management.

What is a Webhook?

Unlike APIs where you request data, webhooks push data to you in real-time when an event occurs, such as:

  • Shopify sending an alert when an order is placed.
  • Stripe notifying a payment completion.
  • Slack delivering a message notification.

Think of APIs as making a phone call to get information, and webhooks as receiving instant text alerts.


Introducing the HTTP Request Node in n8n

The HTTP Request node in n8n lets you:

  • Make HTTP requests (GET, POST, PUT, DELETE).
  • Fetch data from any API.
  • Post or update data in external services.
  • Act as a built-in API client (similar to Postman).

It's essential when you want to integrate apps without native n8n nodes. For a deeper dive into this node’s capabilities, check out the HTTP Node in n8n.


Step-by-Step: Configuring the HTTP Request Node

1. Add a Trigger Node

Start your workflow with a trigger node, such as the Manual Trigger, to test your HTTP request.

2. Add the HTTP Request Node

  • Search for and add the HTTP Request node.
  • This node has two configuration modes:
    • Parameterized configuration: Fill out fields manually.
    • Import cURL: Paste a cURL command to auto-configure the node.

3. Configure the Request Method

Choose the HTTP method based on your API task:

Method Use Case
GET Fetch data
POST Send or create new data
PUT Update existing data
DELETE Remove data (rarely used directly; usually soft delete via PUT)

4. Set the Request URL

Enter the full API endpoint URL where the request will be sent.

5. Authentication

Most APIs require authentication to verify the requester:

  • None: For open/public APIs.
  • Predefined credentials: n8n supports many built-in credentials (e.g., Slack, Airtable).
  • Generic credentials: Use Basic Auth, Bearer Token, or OAuth2 for custom APIs.

You create credentials via the n8n credential manager. Learn more about setting up authentication in the n8n API, Collaboration & Credential Management lesson.

6. Add Query Parameters (Optional)

Query parameters are key-value pairs appended to the URL to filter or specify data, such as:

?apikey=YOUR_API_KEY&language=en-us&metric=false

Enable "Send Query Parameters" and add parameters as needed.

7. Add Headers (Optional)

Headers provide meta-information about the request, such as content type or authorization tokens.

Add headers as key-value pairs if the API requires them.

8. Configure the Request Body (Optional)

APIs may expect data in the body for POST or PUT requests:

  • Set the content type (JSON, form-data, etc.).
  • Provide the body data accordingly.
  • For file uploads, use the n8n binary file type.

For full details on all options, refer to the n8n HTTP Request node documentation{:target="_blank"}.


Practical Example: Using the AccuWeather API

Let's fetch the daily weather forecast for New York City using AccuWeather's API.

Step 1: Review API Documentation

  • Method: GET
  • URL: http://dataservice.accuweather.com/forecasts/v1/daily/1day/{locationKey}
  • Required Query Parameter: apikey
  • Optional Query Parameters: language, metric

Step 2: Prepare Your Request

  • Replace {locationKey} with New York's location key (e.g., 349727).
  • Use your API key from your AccuWeather developer account.

Example URL:

http://dataservice.accuweather.com/forecasts/v1/daily/1day/349727

Step 3: Configure HTTP Request Node

Field Value
Method GET
URL http://dataservice.accuweather.com/forecasts/v1/daily/1day/349727
Authentication None
Send Query Parameters Enabled
Query Parameter Name apikey
Query Parameter Value Your AccuWeather API key
Headers None
Body Disabled

Step 4: Execute and Inspect Response

Run the workflow; you should see JSON data containing weather forecast details such as temperature, conditions, and location.


Importing cURL Requests into the HTTP Node

Many API docs provide cURL commands to test endpoints.

How to Import a cURL Command:

  1. Copy the cURL command from API documentation.
  2. In your HTTP Request node, click Import cURL.
  3. Paste the command and click Import.
  4. The node auto-fills with method, URL, headers, query parameters, and body.
  5. Execute the node to test.

This method is excellent for complex requests with many headers or parameters. For more on this feature, see the n8n HTTP Request node documentation{:target="_blank"}.


Additional Examples to Master HTTP Requests

Example 1: Simple GET Request

  • URL: https://jsonplaceholder.typicode.com/albums
  • No query parameters or headers.
  • Response includes a list of albums.

Example 2: Fetch a Random Wikipedia Page

  • URL: https://en.wikipedia.org/api/rest_v1/page/random/summary
  • Set option to follow redirects (max 20).
  • Response returns a random Wikipedia page summary.

Example 3: Handling Pagination and Dynamic Query Parameters

  • URL dynamically constructed based on input.
  • Query parameters like page and per_page sent dynamically.
  • Useful for APIs that paginate results.

For advanced workflows involving dynamic data and AI, consider integrating with OpenAI APIs as shown in our AI Automation with n8n and OpenAI lesson.


Common Mistakes and Troubleshooting

  • Incorrect HTTP Method: Using POST instead of GET or vice versa can cause errors.
  • Missing or Incorrect Authentication: Always verify if the API requires authentication and provide correct credentials.
  • Wrong URL or Endpoint: Double-check the API base URL and endpoint path.
  • Incorrect Query Parameter Names: Use exact parameter names as per API docs.
  • Not Handling Pagination: For APIs returning paginated data, implement pagination logic to fetch all data.
  • Ignoring Rate Limits: APIs may limit requests; handle errors and retries accordingly.
  • Misconfigured Headers or Body: Ensure content types and body formats match API expectations.


Quick Reference: HTTP Request Node Cheat Sheet

Setting Description Notes
Method HTTP method: GET, POST, PUT, DELETE Choose based on API action
URL Full API endpoint URL Include path parameters as needed
Authentication None, Predefined, Generic (Basic, Bearer, OAuth2) Create credentials in n8n credentials manager
Query Parameters Key-value pairs sent in URL Enable "Send Query Parameters"
Headers HTTP headers key-value pairs Required for content type, auth tokens, etc.
Request Body Data sent with POST/PUT Set appropriate content type (JSON, form)
Import cURL Paste cURL command to auto-configure Speeds up setup, especially for complex requests

By mastering the HTTP Request node, you unlock the power to integrate virtually any API into your n8n workflows, expanding your automation capabilities beyond pre-built nodes. As shown in the video above, following the steps and examples here will give you confidence to connect and automate services that previously seemed inaccessible.

Frequently Asked Questions

You can set authentication types like None, Basic Auth, OAuth2, or API Key in the HTTP Request node settings to access secured APIs.

Yes, n8n allows you to paste a cURL command which it automatically converts into the HTTP Request node configuration for quick setup.

The HTTP Request node supports GET, POST, PUT, and DELETE methods to fetch, create, update, or delete data from APIs.

You can manually add query parameters and headers in the node’s configuration fields to customize your API requests.

APIs require you to send requests to get or send data, while webhooks push data to n8n automatically when an event occurs.

Dheeraj Sharma

Dheeraj Sharma

AI Systems Builder
Creator of the n8n Zero to Hero course (42 lessons, 31+ hours). I help solopreneurs build AI systems that grow revenue without growing workload.

Get the n8n Mastery Bundle

All workflows, cheat sheets, and premium resources from the entire course in one package.

Get Premium Resources