n8n has hundreds of pre-built nodes for popular apps, but eventually you’ll want to connect to a service that doesn’t have one — your own company’s internal system, a niche SaaS tool, or a newly launched API. That’s exactly where custom API integration in n8n comes in. If you’re new to n8n’s core concepts, start with our beginner’s guide to n8n first — this guide assumes you already understand nodes, triggers, and workflows.

Why You’d Need Custom API Integration

Pre-built nodes are convenient, but they only cover popular, mainstream services. If you need to pull data from your company’s internal CRM, connect to a lesser-known SaaS product, or use a brand-new API that n8n hasn’t built a dedicated node for yet, you’ll rely on n8n’s generic HTTP Request node instead — which can connect to virtually any service that exposes a REST API.

Step 1: Understand the API You’re Connecting To

Before building anything in n8n, gather this information from the API’s documentation:

  • Base URL — the root endpoint you’ll be sending requests to
  • Authentication method — API key, Bearer token, Basic Auth, or OAuth2
  • Available endpoints — the specific paths for the data or actions you need (e.g., /customers, /orders)
  • Request method — whether you need GET (retrieve data), POST (create data), PUT/PATCH (update data), or DELETE
  • Expected response format — almost always JSON, but worth confirming

Step 2: Add and Configure the HTTP Request Node

  1. In your n8n workflow, add the HTTP Request node
  2. Set the Method (GET, POST, etc.) based on what the API documentation specifies
  3. Enter the full URL, including the specific endpoint path
  4. If sending data (POST/PUT), add your data in the Body section, typically as JSON

Step 3: Handle Authentication

Most APIs require some form of authentication. n8n’s HTTP Request node supports this a few ways:

  • API Key in Header — add a custom header (commonly named Authorization or X-API-Key) with your key as the value
  • Bearer Token — set the Authorization header to Bearer YOUR_TOKEN
  • Basic Auth — n8n has a built-in Basic Auth option where you enter a username and password directly
  • OAuth2 — for more complex APIs, n8n supports configuring OAuth2 credentials, which handles token refreshing automatically

Wherever possible, store API keys and tokens using n8n’s Credentials system rather than pasting them directly into the node — this keeps sensitive keys out of your workflow’s visible configuration and makes them reusable across multiple workflows.

Step 4: Process the API Response

Once your HTTP Request node runs successfully, the API’s response (usually JSON) becomes available for the next nodes in your workflow. Common next steps include:

  • Using a Set node to extract specific fields you need from the response
  • Using an IF node to branch your workflow based on the response (e.g., “if status is 200, continue; if not, send an alert”)
  • Passing relevant data into a following action, like sending a Slack message or updating a spreadsheet

If the response is deeply nested JSON, n8n’s expression editor lets you reference specific fields directly (e.g., {{ $json.data.customer.email }}) without needing extra processing nodes for simple extractions.

Step 5: Add Error Handling

Custom integrations are more prone to unexpected failures than pre-built nodes, since you’re responsible for getting every detail right yourself. Build in error handling from the start:

  • Enable “Continue on Fail” in the HTTP Request node’s settings if you want the workflow to keep running even if this specific request fails
  • Add an IF node right after to check the response status code and route failures to a notification step (like an email or Slack alert)
  • Use n8n’s Error Trigger workflow feature to catch failures across your entire workflow and log or alert on them centrally

Common Problems and How to Fix Them

Getting a 401 Unauthorized error?

Double-check your authentication method matches exactly what the API expects — a common mistake is using “Bearer” formatting when the API actually expects a raw token, or vice versa.

Getting a 400 Bad Request error?

This usually means your request body doesn’t match the format the API expects. Check that you’re sending valid JSON, and that required fields aren’t missing or misnamed.

Response data looks correct in testing but breaks in production?

APIs sometimes return different data structures for edge cases (like an empty result set). Test your workflow against a few different real-world scenarios, not just the “happy path” example from the documentation.

Final Thoughts

Custom API integration in n8n opens up automation possibilities far beyond what pre-built nodes alone can offer — practically any service with a documented API becomes usable inside your workflows. It takes a bit more setup than dragging in a pre-built node, but the HTTP Request node’s flexibility means you’re rarely limited by what n8n officially supports out of the box. If you want to see custom integrations in action within a complete workflow, check out our n8n WhatsApp Automation guide.

Frequently Asked Questions

Do I need coding knowledge for custom API integration in n8n?

Basic understanding of concepts like JSON, HTTP methods, and authentication helps significantly, but you don’t need to write traditional code — the HTTP Request node handles the technical request itself through its visual interface.

Can n8n handle APIs that require OAuth2 authentication?

Yes, n8n supports configuring OAuth2 credentials, including automatic token refresh, for APIs that require this more complex authentication flow.

What’s the difference between using a pre-built node and the HTTP Request node?

Pre-built nodes are pre-configured specifically for one service, making setup faster and more guided. The HTTP Request node is generic and works with any API, but requires you to manually configure the URL, method, authentication, and body yourself.

About Author

Arshad Sultan

Arshad Sultan is the Founder of Tutorials Ocean and a Technical Architect & Full-Stack Developer with 15+ years of experience in PHP, Laravel, CRM development, API integrations, and AI-powered automation. He also runs Rapid Code, a software and AI automation agency, and has trained hundreds of students across Karachi's IT institutes since 2010.

Leave a Reply

Your email address will not be published. Required fields are marked *