n8n public API: API keys, scopes, pagination and rate limits
How to use the n8n public API: create a scoped API key, call /api/v1, page through results, retry POSTs safely, and handle the new 2.47 rate limits.

The n8n public API lets you manage workflows, executions, credentials, users and more over HTTP instead of the editor. Create a key in Settings > n8n API, send it in the X-N8N-API-KEY header to https://<your-domain>/api/v1/..., and page through lists with the nextCursor value. Since n8n 2.47, an admin can also turn on per-key rate limits, which answer 429 Too Many Requests with a Retry-After header.
The short version:
- Availability: every self-hosted edition, and n8n Cloud Starter, Pro and Enterprise. Not on the Cloud free trial.
- Keys are scoped on every plan since n8n 2.14.0. Give each integration only the scopes it needs. A missing scope returns
403 Forbidden. - Pagination: 100 results per page by default, 250 at most, and a
cursorquery parameter for the next page. - Safe retries: since 2.45.0, an
Idempotency-Keyheader on a POST makes a retry return the first response instead of creating a duplicate. - Rate limits (2.47.0 and later): off by default. Defaults are 1,200 reads and 600 writes a minute per key across all endpoints, and 1,000 reads and 500 writes a minute per key on each endpoint.
We ran every request in this guide against a fresh n8n 2.47.7 instance (the current stable release), with a deliberately low rate limit so we could see the 429.
Before you start
The API is part of n8n itself, so there is nothing to install. According to the n8n API docs, it's available on all self-hosted editions and on n8n Cloud's Starter, Pro and Enterprise plans, but not during the free trial.
On self-hosted n8n the API is on by default. If you don't use it, n8n recommends turning it off with N8N_PUBLIC_API_DISABLED=true. N8N_PUBLIC_API_SWAGGERUI_DISABLED=true turns off the built-in playground (disable the public API). Our environment variables guide covers the other settings worth setting in production.
The base URL is your instance address plus /api/v1:
- n8n Cloud:
https://<your-instance>.app.n8n.cloud/api/v1 - Self-hosted:
https://<your-domain>/api/v1
Self-hosted instances also serve an interactive Swagger UI at /api/v1/docs, where you can try requests against your own data.
Create an API key with the right scopes
From the authentication docs:
- Go to Settings > n8n API.
- Select Create an API key.
- Choose a Label and an Expiration.
- Pick the Scopes the key gets.
- Copy My API Key and store it somewhere safe, such as a secrets manager.
Scopes are named resource:action, for example workflow:list, workflow:read, execution:list or credential:create. The docs say scopes are available on all plans from n8n 2.14.0; on earlier versions only Enterprise had them, and other keys had full access to the account.
Two things we noticed when creating a key on 2.47.7:
- The key can't do more than you can. A key's scopes are limited to what your role allows. The instance owner sees the most scopes.
- The scope list in the app is longer than the docs' table. It includes, for example,
securitySettings:manage, which the rate-limit settings endpoints need, and scopes such asagent:read,eventBusDestination:listandrole:manage. Check the dialog, not only the docs, when you look for a scope.
Make your first request
Send the key in the X-N8N-API-KEY header:
curl -s 'https://<your-domain>/api/v1/workflows?active=true' \
-H 'accept: application/json' \
-H 'X-N8N-API-KEY: <your-api-key>'What came back in our test:
| Request | Response |
|---|---|
| No header, or a wrong key | 401 Unauthorized with {"message":"Unauthorized"} |
Valid key, but without the scope the endpoint needs (we called /credentials with a workflow-only key) | 403 Forbidden with {"message":"Forbidden"} |
| Valid key with the right scope | 200 OK and the JSON result |
A 403 almost always means a missing scope, not a broken key. Create a new key with that scope instead of debugging the request: n8n's changelog says scopes are fixed on a key when you create it.
To call the API from a workflow, use the n8n node with an n8n API credential: paste the key into API Key and your /api/v1 address into Base URL.
Page through large result sets
List endpoints return 100 results per page by default. You can set limit up to 250, per the pagination docs. When there are more results, the response includes a nextCursor:
{
"data": [{ "id": "...", "name": "..." }],
"nextCursor": "eyJsaW1pdCI6Miwib2Zmc2V0IjoyfQ=="
}Send it back as cursor with the same filters to get the next page:
curl -s 'https://<your-domain>/api/v1/workflows?limit=2&cursor=<nextCursor>' \
-H 'X-N8N-API-KEY: <your-api-key>'In our test with three workflows and limit=2, the first page returned two workflows and a cursor. The second returned the third workflow and "nextCursor": null, which is your signal to stop.
Retry a POST without creating duplicates
Since n8n 2.45.0, POSTs that create something or start work accept an Idempotency-Key header (idempotency docs). If a request times out and you're not sure it went through, send it again with the same key. n8n returns the first successful response instead of running the POST again.
curl -s -X POST 'https://<your-domain>/api/v1/workflows' \
-H 'X-N8N-API-KEY: <your-api-key>' \
-H 'Idempotency-Key: 7d1f0c9e-4b2a-4f7e-9a51-2f3c8e6b1a20' \
-H 'Content-Type: application/json' \
-d '<workflow-json>'What we saw on 2.47.7:
- Same key, same body, twice: both calls returned
200with the same workflow ID. Only one workflow was created. - Same key, different body:
422withThis Idempotency-Key was already used with a different request. - A key with a space in it:
400withIdempotency-Key must be 1 to 128 visible ASCII characters.
The docs add the rules you need for retry logic: n8n keeps the first successful response for 12 hours, a failed POST isn't stored (so a retry runs again), a request still in progress returns 409, and keys belong to the user, so two API keys of the same user share them. Use a new UUID for each new operation. GET, PUT, PATCH and DELETE ignore the header.
Public API rate limits (n8n 2.47 and later)
n8n 2.47.0 added rate limits for the public API, on every plan, Cloud and self-hosted, as n8n announced on its blog on November 13. They're off by default: an instance owner or admin turns them on. They exist so one busy integration can't slow down the instance for everyone else.
How n8n counts requests
From the rate limits docs:
- Per API key. Two keys of the same user have separate counts. Only requests with an API key at
/api/v1count; the editor doesn't. - Reads and writes separately.
GETis a read;POST,PUT,PATCHandDELETEare writes. - Two limits at once. One count across all endpoints, and one per endpoint. An endpoint is a method plus a path, so
GET /api/v1/workflows/{workflowId}is one endpoint for every ID.
| Limit | Default | Window |
|---|---|---|
| Reads, all endpoints | 1,200 | 60 seconds |
| Writes, all endpoints | 600 | 60 seconds |
| Reads, each endpoint | 1,000 | 60 seconds |
| Writes, each endpoint | 500 | 60 seconds |
What a client sees
Every successful response carries X-RateLimit-Limit, X-RateLimit-Remaining and X-RateLimit-Reset (a Unix timestamp in seconds). The headers show whichever of the two limits has fewer requests left, and they're absent when rate limiting is off.
We set the per-endpoint read limit to 5 requests per 30 seconds and called GET /api/v1/workflows repeatedly. The fifth call showed X-RateLimit-Remaining: 0, and the sixth got this:
HTTP/1.1 429 Too Many Requests
X-RateLimit-Limit: 5
X-RateLimit-Remaining: 0
X-RateLimit-Reset: 1794818336
Retry-After: 30
{"message":"Too many requests"}At the same moment, GET /api/v1/workflows/{id} with the same key still answered 200 with 4 requests remaining, because each endpoint has its own count. A rejected request doesn't count toward any limit, and n8n doesn't run it.
Handle a 429 in your client
The docs recommend:
- Wait the number of seconds in
Retry-Afterbefore retrying. An earlier retry gets another429. - Add up to 5 seconds of random delay, so many clients don't all retry at once.
- Slow down when
X-RateLimit-Remainingnears 0, untilX-RateLimit-Reset. - Spread large jobs at a steady rate instead of sending everything at once.
Combine retries with an Idempotency-Key on POSTs, or a retried create can produce a duplicate.
Workflows that call their own instance
A workflow that loops over 1,000 items with the n8n node or the HTTP Request node sends about 1,000 requests at once. These nodes fail on a 429 and don't wait for Retry-After. Retry On Fail doesn't help much: it waits at most 5 seconds, often inside the same window, and reruns the node for every item.
The fix is Batching: in the n8n node it's under Request Options, in the HTTP Request node under Options. Set Items per Batch and Batch Interval (ms). n8n's example: five items each second is 300 requests a minute, below every default limit. Our rate limits guide shows batching and a loop that honors Retry-After, tested against a mock API.
Turn on rate limits
There are three ways, all for an instance owner or admin:
- In the app: Settings > Policies, under Public API Limits, turn on Enable API key rate limits, adjust the fields, and select Enable limits. Changes apply at once, without a restart.
- With the API:
GETandPUTon/api/v1/settings/rate-limits, with a key that has thesecuritySettings:managescope. APUTreplaces all fields, so send every one;0means no limit. - With environment variables (self-hosted): set
N8N_PUBLIC_API_RATE_LIMIT_ENABLED=trueand restart n8n.
services:
n8n:
image: docker.n8n.io/n8nio/n8n:2.47.7
environment:
- N8N_PUBLIC_API_RATE_LIMIT_ENABLED=true
# Optional: change one limit, for example 300 writes a minute across all endpoints
- N8N_PUBLIC_API_RATE_LIMIT_GLOBAL_WRITE_LIMIT=300Each limit has a matching variable (N8N_PUBLIC_API_RATE_LIMIT_GLOBAL_READ_LIMIT, ..._ENDPOINT_READ_LIMIT, ..._ENDPOINT_WRITE_LIMIT and so on) plus a ..._WINDOW_SECONDS variable for its window. A variable overrides the settings page: the field is locked there, and a PUT that tries to change it gets 409 Conflict. In our test, GET /api/v1/settings/rate-limits listed the three fields we had set by environment in envManagedFields.
All keys on an instance share the same limits. n8n's blog post says that if one integration needs different limits, run it on a separate instance. In a multi-main setup, the mains share one count per key through Redis, so a key over the limit gets a 429 from every main (see our queue mode guide for that setup).
Common errors and fixes
| Error | Cause and fix |
|---|---|
401 Unauthorized | The X-N8N-API-KEY header is missing, misspelled, or the key expired or was deleted. Check the header name and create a new key if needed. |
403 Forbidden | The key lacks the scope this endpoint needs. Create a new key with that scope in Settings > n8n API. |
429 Too Many Requests | A rate limit is on and the key went over it. Wait Retry-After seconds, then batch or slow down your requests. |
422 "This Idempotency-Key was already used with a different request." | You reused a key for a different body or path. Generate a new key for each new operation. |
409 "A request with this Idempotency-Key is already in progress." | The first request hasn't finished. Wait, then retry with the same key and body. |
409 Conflict on PUT /settings/rate-limits | You tried to change a field that an environment variable controls. Change the variable and restart n8n. |
Next steps
- If an AI client needs to work with your instance, the MCP guide covers n8n's MCP server, which is often a better fit than raw API calls.
- The 2.47 release roundup lists everything else in the release that brought rate limits.
- Outside APIs rate-limit you too: our rate limits guide shows how to handle their
429s in a workflow.
Sources
- n8n public REST API (n8n docs)
- API authentication and scopes (n8n docs)
- API pagination (n8n docs)
- API idempotency (n8n docs source on GitHub)
- API rate limits (n8n docs source on GitHub)
- Disable the public REST API (n8n docs)
- New in n8n: Public API rate limits that keep every team on your instance running (n8n blog)
Editorial team
The then8nblog editorial team researches every article from n8n's release notes, documentation and source code, states the n8n version each guide was tested on, and has every post reviewed by a human editor before it goes live.



