Loading learning content…
Loading learning content…
Connect to any REST API, handle authentication, pagination, and rate limits.
Read through the lesson, mark it complete when the concept is clear, then move to the next lesson in the sequence or jump back to the module map.
n8n's HTTP Request node connects to any REST API. Configure: method, URL, headers, body, authentication, and response parsing.
API Key — pass in a header (Authorization: Bearer {key}) or query parameter. Store keys in n8n credentials, never hardcode.
OAuth 2.0 — n8n handles the OAuth flow for supported integrations. For custom OAuth, use the OAuth2 credential type.
HMAC — generate a signature from request contents. Used by Stripe, GitHub webhooks. Implement in a Function node.
Most APIs paginate large result sets. Common patterns:
Offset pagination — ?page=2&limit=50. Loop until results < page size.
Cursor pagination — ?cursor=abc123. Loop until cursor is null.
Link header — response includes a Link: <url>; rel="next" header. Follow until no "next" link.
Build the pagination loop in a Function node with recursive calls or use n8n's built-in Split In Batches node.
APIs throttle requests. Handle rate limits:
Retry-After headerSome APIs use soft limits (headers warning you're approaching limits) — monitor these proactively.
async function callWithRetry(url, options, maxRetries = 3) {
for (let attempt = 0; attempt <= maxRetries; attempt++) {
const response = await fetch(url, options);
if (response.ok) return response.json();
if (response.status === 429) {
const wait = parseInt(response.headers.get('Retry-After') || '60');
await sleep(wait * 1000);
continue;
}
if (attempt === maxRetries) throw new Error(`Failed: ${response.status}`);
}
}