Introduction
n8n provides a comprehensive REST API that allows you to programmatically manage workflows, executions, credentials, and other resources. The API is designed to be intuitive and follows RESTful principles.Base URL
The API is accessible at your n8n instance URL:API Versions
n8n currently supports:- Public API (v1):
/api/v1/*- Designed for external integrations - Internal API: Used by the n8n frontend application
This documentation focuses on the Public API endpoints that are stable and recommended for external use.
Core Resources
The n8n API provides access to these core resources:Workflows
Create, read, update, and delete workflows. Activate and deactivate workflow automation.Executions
Monitor workflow executions, check their status, and manage running workflows.Credentials
Manage credentials used by workflow nodes for authentication.API Features
Pagination
List endpoints support cursor-based pagination:nextCursor value in subsequent requests:
Filtering
Many endpoints support filtering by various parameters:Response Format
All API responses use JSON format:Error Handling
The API uses standard HTTP status codes:| Status Code | Description |
|---|---|
200 | Success |
201 | Resource created |
400 | Bad request - Invalid parameters |
401 | Unauthorized - Invalid or missing API key |
403 | Forbidden - Insufficient permissions |
404 | Resource not found |
409 | Conflict - Resource state conflict |
500 | Internal server error |
Error Response Format
Rate Limiting
n8n implements rate limiting to ensure fair usage:- IP-based limits: 1000 requests per 5 minutes
- Key-based limits: Varies by endpoint and operation
Scopes and Permissions
API keys can have specific scopes that control access:workflow:read- Read workflow dataworkflow:create- Create new workflowsworkflow:update- Update existing workflowsworkflow:delete- Delete workflowsworkflow:execute- Execute workflowscredential:read- Read credentialscredential:create- Create credentialscredential:update- Update credentialscredential:delete- Delete credentialsexecution:read- Read execution dataexecution:list- List executions
Getting Started
Generate an API Key
Navigate to Settings → API in your n8n instance and create a new API key with the required scopes.
Best Practices
Use Appropriate Scopes
Use Appropriate Scopes
Only grant the minimum required scopes to your API keys. This follows the principle of least privilege and enhances security.
Handle Errors Gracefully
Handle Errors Gracefully
Always check HTTP status codes and handle errors appropriately in your application.
Implement Retry Logic
Implement Retry Logic
For transient errors (5xx), implement exponential backoff retry logic.
Cache When Possible
Cache When Possible
Cache workflow and credential data when appropriate to reduce API calls.
Use Webhooks
Use Webhooks
For real-time updates, consider using n8n’s webhook functionality instead of polling.
Next Steps
Authentication
Learn how to authenticate API requests
Workflows
Manage workflows via API
Executions
Monitor and control workflow executions
Credentials
Manage credentials programmatically