금. 8월 15th, 2025

G: In the vast and interconnected world of automation, the ability to “talk” to different services is paramount. Whether you’re pulling data from a CRM, pushing updates to a marketing platform, or orchestrating complex workflows across various cloud services, the HTTP Node in n8n is your universal translator. 🌐

It’s the workhorse that empowers your n8n workflows to interact with virtually any API out there. Forget rigid integrations; with the HTTP Node, your automation possibilities become truly boundless!

This comprehensive guide will demystify the n8n HTTP Node, breaking down its core components and, most excitingly, providing you with 10 real-world examples to supercharge your automation skills. Get ready to master API integration like never before! 🚀


The Core of Connectivity: What is the n8n HTTP Node?

At its heart, the n8n HTTP Node allows your workflow to make HTTP requests – the fundamental way web applications communicate. Think of it as your workflow’s ability to send messages (requests) to an API and understand the replies (responses) it gets back.

It supports all standard HTTP methods (GET, POST, PUT, DELETE, PATCH, etc.), handles various body types (JSON, form-data, raw), and manages authentication, making it incredibly versatile for any API interaction.


Decoding the HTTP Node’s Anatomy: Key Parameters Explained 🧬

Before we dive into examples, let’s break down the essential parameters you’ll encounter when configuring an HTTP Node. Understanding these is key to unlocking its full power.

1. Method 🔄

This defines the type of action you want to perform on the API endpoint.

  • GET: Retrieve data. (e.g., “Give me the latest weather forecast!”)
  • POST: Create new data. (e.g., “Here’s a new user for your database!”)
  • PUT: Replace existing data. (e.g., “Completely overwrite this product’s details!”)
  • PATCH: Partially update existing data. (e.g., “Just change this user’s email address!”)
  • DELETE: Remove data. (e.g., “Delete that old record!”)
  • HEAD, OPTIONS: Less common for general automation, used for fetching headers or allowed methods.

2. URL 🔗

The address of the API endpoint you want to interact with. This can be static (e.g., https://api.example.com/users) or dynamic, using expressions to include data from previous nodes (e.g., https://api.example.com/users/{{ $json.user_id }}).

3. Headers 📜

Key-value pairs that provide additional information about the request.

  • Content-Type: Crucial for POST and PUT requests, tells the API what format your request body is in (e.g., application/json, application/x-www-form-urlencoded, multipart/form-data).
  • Authorization: Used for sending API keys or tokens for authenticated requests.
  • Custom Headers: Many APIs require specific headers for things like API versioning or custom client IDs.

4. Query Parameters ❓

Key-value pairs appended to the URL after a ? (e.g., https://api.example.com/products?category=electronics&limit=10). Used primarily with GET requests to filter, sort, or paginate data.

5. Body Parameters (for POST, PUT, PATCH) 📦

This is where you send the actual data to the API. The Content-Type header must match your body format!

  • JSON: Most common for modern APIs. You provide a JSON object directly.
    {
      "name": "John Doe",
      "email": "john.doe@example.com"
    }
  • Form-Data (Multipart/Form-Data): Used for traditional web forms and, importantly, for file uploads. Each field is sent as a separate part.
  • Form-Data (x-www-form-urlencoded): Also for web forms, but typically simpler key-value pairs, encoded in the URL-like string.
  • Raw: For sending plain text, XML, or any custom format.
  • Binary File: If you’re uploading a file that’s already in a binary format from a previous node (e.g., Read Binary File, Download).

6. Authentication 🔑

How you prove your identity to the API.

  • None: For public APIs.
  • Basic Auth: Username and password.
  • Bearer Token: A common method using a token (often Bearer YOUR_TOKEN).
  • OAuth2.0: For more complex authorization flows (often handled by n8n’s dedicated credential types).
  • Custom: For unique authentication schemes, often by adding specific headers.
  • n8n Credentials: The best practice! Store API keys, tokens, or OAuth configurations securely in n8n’s “Credentials” section and simply reference them in the HTTP Node. This keeps sensitive information out of your workflow definitions.🔒

7. Response Handling 📤

  • Response Format: JSON (n8n will automatically parse the JSON response) or Binary Data (if you’re expecting a file or non-JSON content).
  • Follow Redirects: If the API responds with a redirect, n8n will automatically follow it.
  • Max Redirects: Limits how many redirects n8n will follow.

8. Options & Error Handling 🛠️

  • Timeout: How long n8n waits for a response before giving up.
  • Proxy: If your n8n instance needs to go through a proxy server.
  • On Fail: Crucial for robust workflows!
    • Continue: The workflow continues even if the HTTP request fails (e.g., 4xx or 5xx status codes). You can then use an If node to check the statusCode and handle errors.
    • Error: The workflow stops immediately if the HTTP request fails. This is the default.
    • Retry: Automatically retries the request a specified number of times with an optional delay. Perfect for flaky APIs!

🚀 10 Real-World Examples to Master the HTTP Node

Let’s get practical! Here are 10 diverse examples demonstrating how to use the n8n HTTP Node effectively. For each example, assume you have a basic n8n workflow set up (e.g., starting with a Start or Manual Trigger node).


Example 1: Simple GET Request to Fetch Public Data ☀️

Scenario: You want to get information from a public API, like a random joke. API Used: JokeAPI

How to Configure:

  1. Add an HTTP Request node.
  2. Method: GET
  3. URL: https://v2.jokeapi.dev/joke/Any?type=single
  4. No headers, body, or authentication needed.

Expected Output: The node will return a JSON object containing a random joke.

[
  {
    "joke": "What do you call a fly with no wings? A walk."
  }
]

👉 Pro Tip: Use https://jsonplaceholder.typicode.com/ for simple mock API calls (e.g., https://jsonplaceholder.typicode.com/posts/1 for a single post).


Example 2: GET Request with Query Parameters 📍

Scenario: Fetching data based on specific criteria, like getting information about a country by its name. API Used: Rest Countries API

How to Configure:

  1. Add an HTTP Request node.
  2. Method: GET
  3. URL: https://restcountries.com/v3.1/name/united%20states (Note: The API automatically handles spaces, but united%20states is the URL-encoded version of “United States”)
  4. Alternatively, use Query Parameters:
    • URL: https://restcountries.com/v3.1/name/
    • Under “Query Parameters”, add a row:
      • Name: q (or whatever the API expects, for this API, it’s part of the path, so the first method is better. Let’s use Agify API for a true query param example)
      • URL: https://api.agify.io/
      • Query Parameters:
        • Name: name
        • Value: Alice

Expected Output: JSON data containing estimated age for “Alice”.

[
  {
    "name": "alice",
    "age": 28,
    "count": 140089
  }
]

Example 3: POST Request with JSON Body (Sending Data) 📨

Scenario: Sending data to a webhook or creating a new record in a system. Let’s simulate sending a new user registration. API Used: Webhook.site (a free service to inspect incoming webhooks) or httpbin.org.

How to Configure:

  1. Go to webhook.site and copy your unique URL.
  2. Add an HTTP Request node.
  3. Method: POST
  4. URL: Your copied Webhook.site URL (e.g., https://webhook.site/YOUR_UNIQUE_ID)
  5. Body Parameters:
    • Body Content Type: JSON
    • JSON:
      {
        "username": "n8n_user_123",
        "email": "user123@example.com",
        "status": "active"
      }

Expected Output: The HTTP Request node will show the webhook’s response (usually a success message). On webhook.site, you’ll see your JSON data arrive.

[
  {
    "json": {
      "username": "n8n_user_123",
      "email": "user123@example.com",
      "status": "active"
    }
    // ... other httpbin.org response data
  }
]

Example 4: POST Request with Form-Data 📝

Scenario: Submitting data to an older API that expects form-encoded data, similar to a traditional HTML form submission. API Used: httpbin.org (echoes back what it receives).

How to Configure:

  1. Add an HTTP Request node.
  2. Method: POST
  3. URL: https://httpbin.org/post
  4. Body Parameters:
    • Body Content Type: Form-Data (x-www-form-urlencoded)
    • Form Data:
      • Row 1: Name: product_name, Value: n8n Automation Course
      • Row 2: Name: price, Value: 99.99
      • Row 3: Name: currency, Value: USD

Expected Output: httpbin.org will return a JSON object confirming the form data it received.

[
  {
    "form": {
      "product_name": "n8n Automation Course",
      "price": "99.99",
      "currency": "USD"
    }
    // ... other httpbin.org response data
  }
]

Example 5: Authenticated GET Request (Bearer Token) 🔐

Scenario: Accessing protected resources on an API, like your GitHub user profile. API Used: GitHub API

How to Configure:

  1. Create a GitHub Personal Access Token: Go to GitHub -> Settings -> Developer settings -> Personal access tokens -> Tokens (classic) -> Generate new token. Give it a descriptive name and select the read:user scope. Copy the token.
  2. Create an n8n Credential: In n8n, go to “Credentials” (bottom left) -> “New Credential” -> Search for Generic Credential.
    • Credential Name: GitHub Personal Access Token
    • Authentication: Header Auth
    • Header Name: Authorization
    • Header Value: Bearer YOUR_GITHUB_TOKEN_HERE (replace YOUR_GITHUB_TOKEN_HERE with your actual token). Save the credential.
  3. Add an HTTP Request node.
  4. Method: GET
  5. URL: https://api.github.com/user
  6. Authentication: Select Predefined Credential and choose your GitHub Personal Access Token credential.

Expected Output: JSON data containing your GitHub user profile information.

[
  {
    "login": "your_github_username",
    "id": 12345,
    "node_id": "...",
    "avatar_url": "...",
    // ... more GitHub user data
  }
]

👉 Security Best Practice: Always use n8n Credentials for sensitive information like API keys and tokens. Never hardcode them directly into your workflow nodes!


Example 6: Handling API Pagination (Iterating Through Results) 🔄➡️

Scenario: An API returns data in pages (e.g., 100 items per page) and you need to retrieve all of them. API Used: Rick and Morty API (characters endpoint with info.next for pagination).

How to Configure: This requires a loop using the HTTP Request node in conjunction with a Loop or Do While node.

  1. Start Node (or Manual Trigger).
  2. Initialize Variable (Set Node):
    • Mode: Merge Data
    • Add a value: nextPageUrl = https://rickandmortyapi.com/api/character
    • Add a value: allCharacters = [] (an empty array to store all results)
  3. Do While Node:
    • Mode: Loop
    • Condition: {{ $json.nextPageUrl !== null }} (Loop as long as nextPageUrl is not null)
  4. Inside Do While Loop:
    • HTTP Request Node:
      • Method: GET
      • URL: {{ $json.nextPageUrl }}
      • No authentication.
    • Append Data (Set Node):
      • Mode: Merge Data
      • Value 1: nextPageUrl = {{ $json.info.next }} (Get the URL for the next page from the response)
      • Value 2: allCharacters = {{ $json.allCharacters.concat($json.results) }} (Append current page’s characters to allCharacters array)
  5. After Do While Loop: You’ll have all characters collected in the allCharacters variable.

Expected Output: After the loop finishes, the final Set node will contain the allCharacters array populated with all characters from the API.


Example 7: Uploading a File (Multipart Form-Data) 📂⬆️

Scenario: Sending a local file to an API (e.g., uploading an image to cloud storage). API Used: httpbin.org (to demonstrate file reception).

How to Configure:

  1. Read Binary File Node:
    • File Path: Specify a path to a test file on your n8n server (e.g., /tmp/my_test_image.jpg).
    • Property Name: data (this is the default, and what the HTTP node expects).
  2. HTTP Request Node:
    • Method: POST
    • URL: https://httpbin.org/post
    • Body Parameters:
      • Body Content Type: Form-Data (multipart/form-data)
      • Form Data:
        • Row 1: Name: file, Value: {{ $('Read Binary File').item.binary.data }} (This expression points to the binary data output by the previous node).
        • Row 2: Name: description, Value: A test image from n8n

Expected Output: httpbin.org will return a JSON object containing details about the uploaded file, including its filename, content type, and a portion of the data.

[
  {
    "files": {
      "file": "data:image/jpeg;base64,...", // Base64 encoded file data
    },
    "form": {
      "description": "A test image from n8n"
    },
    // ... other httpbin.org response data
  }
]

Example 8: Dynamic URL and Headers Using Expressions 🧩

Scenario: Constructing an API request where parts of the URL or headers depend on previous data in the workflow. API Used: The Cat API (fetching a specific cat image type). Requires an API key.

How to Configure:

  1. Set Node: Simulate receiving data from a previous node.
    • Add a value: imageType = png
    • Add a value: myApiKey = YOUR_THE_CAT_API_KEY (replace with your actual key)
  2. HTTP Request Node:
    • Method: GET
    • URL: https://api.thecatapi.com/v1/images/search?mime_types=image/{{ $json.imageType }}
    • Headers:
      • Row 1: Name: x-api-key, Value: {{ $json.myApiKey }}

Expected Output: JSON data containing a URL to a random cat image of the specified type (e.g., PNG).

[
  {
    "id": "abc",
    "url": "https://cdn2.thecatapi.com/images/abc.png",
    "width": 123,
    "height": 456
  }
]

Example 9: Robust Error Handling & Retries for Flaky APIs 🚫🔄

Scenario: An external API sometimes fails with a 500 error, and you want n8n to automatically retry the request before failing the workflow. API Used: httpbin.org (simulates a server error).

How to Configure:

  1. Add an HTTP Request node.
  2. Method: GET
  3. URL: https://httpbin.org/status/500 (This will consistently return a 500 error)
  4. Error Handling (under “Options”):
    • On Fail: Retry
    • Retry on: All (or specific status codes like 429 for rate limits, 5xx for server errors)
    • Number of Retries: 3
    • Retry Delay: 5 (seconds)
    • Retry Delay Backoff: Exponential (delay increases with each retry)

Expected Output: The node will try 3 times, waiting 5 seconds, then 10, then 20 seconds. After the 3rd retry fails, the node will eventually fail, but it shows how to build resilience. If you used an API that occasionally recovered, it would succeed on a later retry. 👉 Next Step: To truly handle errors gracefully after retries fail, connect an Error node or an If node checking {{ $node["HTTP Request"].error }}.


Example 10: PUT/PATCH Request for Updating Data ✍️

Scenario: Updating an existing record in a CRM or database via its API. Let’s simulate updating a post on a mock API. API Used: JSONPlaceholder (for mock API updates).

How to Configure:

  1. Add an HTTP Request node.
  2. Method: PUT (or PATCH if you only want to send partial updates)
  3. URL: https://jsonplaceholder.typicode.com/posts/1 (We’re updating post with ID 1)
  4. Body Parameters:
    • Body Content Type: JSON
    • JSON:
      {
        "id": 1,
        "title": "n8n Mastery: Updated Title!",
        "body": "This is the updated content of the post, thanks to n8n HTTP node. ✨",
        "userId": 1
      }

      (Note: For PUT, you usually send the complete resource. For PATCH, you’d only send the fields you want to change, e.g., just {"title": "Updated Title"})

Expected Output: JSONPlaceholder will return the updated resource, echoing back the data you sent.

[
  {
    "id": 1,
    "title": "n8n Mastery: Updated Title!",
    "body": "This is the updated content of the post, thanks to n8n HTTP node. ✨",
    "userId": 1
  }
]

Best Practices & Pro Tips for HTTP Node Mastery 💡

  • Always use n8n Credentials for sensitive data. 🔐 This is non-negotiable for security and maintainability.
  • Embrace Expressions ({{ ... }}). Make your URLs, headers, and body dynamic by pulling data from previous nodes. This is the essence of automation!
  • Test with Mock Services. Tools like httpbin.org and webhook.site are invaluable for quickly testing HTTP requests without needing a real API endpoint.
  • Implement Robust Error Handling. Use the “On Fail” option in the HTTP node (especially Retry) and combine it with Try/Catch blocks and Error nodes for truly resilient workflows. Don’t let a single API glitch stop your entire process.
  • Respect Rate Limits. Many APIs have limits on how many requests you can make in a given period. Use the Wait node in n8n to introduce delays between requests if you’re hitting rate limits.
  • Understand API Documentation. Every API is different. Always refer to the official API documentation for required headers, body formats, authentication methods, and error codes.
  • Log API Responses (during development). During development, send API responses to a NoOp node and then inspect them, or even Log nodes to a file, to understand their structure and troubleshoot issues.

Conclusion ✨

The n8n HTTP Node is an incredibly powerful and flexible tool that truly unlocks the potential of your automation workflows. By mastering its core parameters and understanding how to apply them in various scenarios, you can integrate n8n with virtually any service, API, or custom application.

These 10 examples are just the tip of the iceberg. The more you experiment and understand the principles of HTTP requests, the more complex and valuable automations you’ll be able to build. So, go forth, connect, and automate everything! Happy automating! 🚀🤖

답글 남기기

이메일 주소는 공개되지 않습니다. 필수 필드는 *로 표시됩니다