Skip to main content

Overview

n8n uses API key authentication to secure its REST API. Each API key can be configured with specific scopes to control access to different resources and operations.

Creating an API Key

You can create API keys through the n8n user interface:
1

Navigate to Settings

Go to Settings → API in your n8n instance.
2

Create New Key

Click Create API Key and provide:
  • A descriptive label
  • Selected scopes (permissions)
  • Optional expiration date
3

Save the Key

Copy the generated API key immediately. It won’t be shown again for security reasons.
API keys are sensitive credentials. Store them securely and never commit them to version control.

Authentication Methods

Pass your API key in the X-N8N-API-KEY header:

Managing API Keys

List API Keys

Retrieve all API keys for your account.
Response:
API keys in list responses are redacted for security. Only the first few and last few characters are visible.

Create API Key

Generate a new API key with specified permissions.
string
required
A descriptive name for the API key
string[]
required
Array of permission scopes for this key
number
default:"null"
Unix timestamp (seconds) when the key expires. null for no expiration.
Response:
The rawApiKey field is only returned on creation. Store it securely as it cannot be retrieved again.

Update API Key

Modify an existing API key’s label or scopes.
string
required
The API key ID
string
New label for the API key
string[]
Updated array of permission scopes
Response:

Delete API Key

Revoke an API key permanently.
string
required
The API key ID to delete
Response:

Get Available Scopes

Retrieve the list of scopes available for your user role.
Response:

API Key Scopes

Workflow Scopes

scope
Read workflow configurations and metadata
scope
Create new workflows
scope
Modify existing workflows
scope
Delete workflows
scope
Trigger workflow executions
scope
List all accessible workflows
scope
Activate workflows to run automatically
scope
Deactivate active workflows

Credential Scopes

scope
Read credential metadata (not sensitive data)
scope
Create new credentials
scope
Update existing credentials
scope
Delete credentials
scope
List all accessible credentials

Execution Scopes

scope
Read execution data and results
scope
List workflow executions
scope
Retry failed executions
scope
Stop running executions
scope
Delete execution records

Security Best Practices

Generate new API keys periodically and revoke old ones to minimize security risks.
Only grant the scopes necessary for your integration. This limits potential damage if a key is compromised.
For temporary integrations or testing, set an expiration date on API keys.
Regularly review your API keys and their usage patterns to detect unauthorized access.
Store API keys in environment variables, never hardcode them in your application.
For high-security scenarios, consider implementing request signing or using OAuth where available.

License Requirements

API Key Scopes is an enterprise feature. Without a license, API keys have access to all available scopes for the user’s role.

Common Issues

401 Unauthorized

Problem: Request returns 401 Unauthorized Solutions:
  • Verify the API key is correct
  • Check that the key hasn’t expired
  • Ensure you’re using the correct header name: X-N8N-API-KEY

403 Forbidden

Problem: Request returns 403 Forbidden Solutions:
  • Verify your API key has the required scope for the operation
  • Check that the key is active and not revoked
  • Ensure you have access to the requested resource

Rate Limiting

Problem: Request returns 429 Too Many Requests Solutions:
  • Implement exponential backoff
  • Reduce request frequency
  • Cache responses when possible
  • Contact support for higher limits if needed

Next Steps

Workflows API

Start managing workflows programmatically

Executions API

Monitor and control workflow executions

Credentials API

Manage authentication credentials

API Overview

Return to API overview