If you're building automation workflows with n8n, understanding how to work with REST APIs is not optional — it's the foundation of nearly every integration you'll ever build. This guide covers everything an automation engineer needs to know about REST API integrations in n8n: from making your first API call to handling webhooks, configuring API gateways, and securing requests with OAuth and API keys.
What Is a REST API and Why Does It Matter for Automation?
A REST API (Representational State Transfer Application Programming Interface) is a standardized way for two systems to communicate over HTTP. In the context of n8n workflow automation, REST APIs are the primary mechanism through which your workflows interact with external services — whether that's a CRM, a payment processor, a database interface, or a third-party data provider.
Every time your n8n automation reads from or writes to an external platform, it is almost certainly making REST API calls under the hood. Understanding REST APIs at a deeper level — not just clicking "Add Credential" in n8n — is what separates beginner automators from professional integration engineers.
A REST API communicates using standard HTTP methods:
- GET — Retrieve data from an API endpoint
- POST — Send data to create or trigger something via the API
- PUT / PATCH — Update existing records through the REST API
- DELETE — Remove records via the API
In n8n workflow automation, you'll use all four methods regularly across your API integrations.
The n8n HTTP Request Node: Your REST API Powerhouse
The most important node for REST API integrations in n8n is the HTTP Request node. This node is a universal API client that allows your workflow to call any REST API endpoint in the world — whether or not n8n has a pre-built integration for that service.
The HTTP Request node supports:
- All standard HTTP methods (GET, POST, PUT, PATCH, DELETE)
- Custom API headers, query parameters, and request bodies
- JSON, form-data, and raw body formats for REST API payloads
- OAuth2, Bearer tokens, Basic Auth, and API key authentication
- Automatic pagination for APIs that return paginated results
- Response data mapping directly into your workflow for downstream nodes
Mastering the HTTP Request node means you can integrate with any REST API — even obscure internal services or custom-built APIs that no automation tool has ever heard of. This is the core skill of any serious n8n integration engineer.
API Integrations: Connecting n8n to External Services
When building API integrations in n8n workflows, the first step is always understanding the target API's structure: its base URL, authentication method, available endpoints, rate limits, and response format.
A typical n8n API integration workflow follows this pattern:
- Authenticate — Configure credentials using OAuth2, API key, or Bearer token
- Trigger — Start the workflow via a schedule, webhook, or manual trigger
- Fetch Data — Use the HTTP Request node to call the REST API and retrieve records
- Transform — Parse and reshape the API response using Set, Code, or Function nodes
- Act — Write the transformed data to a database, another API, or downstream service
- Handle Errors — Catch failed API calls and route them to your error handling workflow
For complex API integrations with multiple endpoints, consider building modular sub-workflows in n8n — one sub-workflow per API service — then calling them from a master orchestration workflow. This keeps your integrations maintainable as they scale.
API Gateway Patterns in n8n Automation
An API gateway acts as the single entry point for all incoming API requests to your automation system. In n8n workflow architecture, you can simulate an API gateway pattern using Webhook trigger nodes — each webhook endpoint acts as an API gateway route that accepts inbound requests and routes them to the appropriate workflow.
This is powerful because it means n8n can function as a lightweight API gateway for your internal tools:
- Expose a REST API endpoint via n8n's webhook trigger
- Route incoming requests to different workflows based on path, method, or payload
- Return structured JSON responses back to the caller — making n8n act like a real API server
- Apply authentication checks at the webhook level before any integration logic runs
For teams building internal tooling, this API gateway pattern means you can prototype entire API integration layers using nothing but n8n workflows — no backend server required.
Webhooks in n8n: Event-Driven API Integration
While polling a REST API on a schedule works for many use cases, webhooks are far more efficient for real-time automation. A webhook is a reverse API call — instead of your workflow asking the external service "do you have new data?", the external service pushes data to your webhook endpoint the moment something happens.
In n8n, webhooks are first-class citizens. The Webhook trigger node creates a unique HTTP endpoint that any external service can call, turning your n8n workflow into a real-time event-driven automation.
Common webhook use cases in n8n API integrations:
- Receive payment notifications from Stripe via webhook and trigger fulfillment workflows
- Listen for GitHub push events via webhook and kick off CI/CD automation pipelines
- Accept CRM updates via webhook and sync data across multiple API integrations
- Capture form submissions via webhook and route them through validation workflows
Webhook event reliability is also important — always implement a response acknowledgment in your n8n webhook node so the sending service knows the webhook was received successfully. For high-volume webhook scenarios, combine with n8n's batch processing and queue patterns.
API Authentication: OAuth2, Bearer Tokens, and API Keys
Securing your API integrations is critical. n8n supports all major API authentication methods natively, but understanding when to use each is essential for building robust integrations.
OAuth2 in n8n API Integrations
OAuth2 is the industry standard for delegated authorization — it allows your n8n automation to act on behalf of a user without storing their password. Most major REST APIs (Google, Salesforce, HubSpot, Slack) use OAuth2.
In n8n, configuring OAuth2 for an API integration involves:
- Registering your n8n instance as an OAuth2 application with the target service
- Storing the OAuth2 client ID and secret in n8n credentials
- Completing the OAuth2 authorization code flow to obtain access and refresh tokens
- n8n automatically refreshes expired OAuth2 tokens during workflow execution
Bearer Tokens and API Keys
For simpler REST APIs that use API keys or Bearer tokens, n8n's credential manager stores these securely and injects them into each HTTP Request node automatically. Never hardcode API keys directly in your workflow nodes — always use n8n's credential vault for API secrets.
Handling API Responses in n8n Workflows
Every REST API returns data — and how you handle that response data inside your n8n workflow determines the quality of your integration. Most modern REST APIs return JSON responses, which n8n parses automatically and makes available to downstream nodes.
Key techniques for handling API responses in n8n integrations:
- Dot notation access — Access nested JSON fields from API responses using expressions like {{ $json.data.user.email }}
- Array handling — When a REST API returns an array of records, n8n automatically splits them into individual items for downstream processing
- Conditional routing — Use IF nodes to route workflow logic based on API response codes or field values
- Error response parsing — Check HTTP status codes from API calls and route 4xx/5xx responses to your error handling workflow
- Response transformation — Use Set or Code nodes to reshape API response data before writing it to a database or calling another API
Understanding REST API response structures — status codes, headers, pagination tokens, rate limit headers — is what enables you to build integrations that are resilient in production, not just in testing.
Rate Limiting and Pagination in REST API Integrations
Two of the most common challenges in production REST API integrations are rate limiting and pagination. Nearly every public API imposes rate limits — a maximum number of requests per minute or per hour. If your n8n automation hits these limits, requests will fail.
Strategies for handling API rate limits in n8n workflow automations:
- Use Wait nodes inside loops to throttle API calls to a safe rate
- Monitor the Retry-After header in API responses to dynamically wait before retrying
- Process data in batch processing chunks sized to stay within API rate limits
- Implement exponential backoff logic in Code nodes for resilient REST API retry patterns
For pagination, most REST APIs use one of three patterns: page-number pagination, cursor-based pagination, or offset pagination. In n8n, handle API pagination by building a loop workflow that keeps calling the REST API until the response indicates there are no more pages — typically when a next_page token or has_more field is absent from the API response.
Building Production-Grade API Integration Workflows
When moving from a prototype n8n API integration to a production workflow, keep these principles in mind:
- Credential Management — Store all API keys and OAuth2 secrets in n8n's credential vault, never in node parameters
- Idempotency — Design API integration workflows that can safely re-run without creating duplicate records
- Logging — Log every significant REST API call with its response code, payload, and timestamp for auditing
- Error Handling — Catch every API failure and route it to a notification workflow immediately
- Webhook Security — Validate webhook signatures from external services before processing webhook payloads
- API Gateway Routing — Use n8n webhook endpoints as API gateway routes for internal tooling
- Testing — Test API integrations with edge-case payloads (empty responses, null fields, large arrays) before going to production
Production REST API integrations in n8n are not just about making the happy-path work — they're about building automation workflows that handle every failure mode gracefully and keep running reliably 24/7.
Why REST API Integrations Are the Core Skill for n8n Engineers
Of all the skills an n8n automation engineer can develop, REST API integration expertise is the most universally applicable. Every business system — CRMs, ERPs, databases, payment platforms, communication tools — exposes a REST API. Every workflow orchestration challenge ultimately comes down to moving data between APIs, transforming it, and routing it intelligently.
Mastering n8n's HTTP Request node, understanding OAuth2 and API key authentication, handling webhook events, implementing API gateway patterns, and building resilient integration workflows with proper error handling and batch processing — these skills make you a highly effective automation integration engineer capable of connecting any system to any other system.
Need Help Building Custom API Integrations?
Our team specializes in designing and implementing production-grade REST API integrations using n8n and other enterprise automation platforms.
Get Free Consultation