n8n is an open-source workflow automation platform that allows you to connect different services and automate tasks without extensive coding. The n8n API provides programmatic access to manage and control your n8n instances.
What is the n8n API?
The n8n API is a REST API that lets you:
- Manage workflows (create, read, update, delete)
- Execute workflows programmatically
- Monitor workflow executions
- Manage credentials and connections
- Access execution history and logs
- Control user permissions and settings
How to Use the n8n API
Authentication
Most n8n API endpoints require authentication. You can use:
- API Key: Generate an API key in your n8n instance settings
- Session-based: Use login credentials for browser-based access
Basic Usage Examples
Get all workflows:
GET /api/v1/workflows
Authorization: Bearer YOUR_API_KEY
Execute a workflow:
POST /api/v1/workflows/{id}/execute
Authorization: Bearer YOUR_API_KEY
Get execution results:
GET /api/v1/executions/{id}
Authorization: Bearer YOUR_API_KEY
Common Use Cases
- CI/CD Integration: Trigger workflows as part of deployment pipelines
- External Application Integration: Execute n8n workflows from your own applications
- Monitoring and Alerting: Check workflow status and execution history
- Dynamic Workflow Management: Create or modify workflows based on external conditions
- Bulk Operations: Manage multiple workflows programmatically
Getting Started
- Enable API access in your n8n instance settings
- Generate an API key for authentication
- Review the API documentation available at
your-n8n-instance/api-docs
- Test endpoints using tools like Postman or curl
The API follows RESTful conventions and returns JSON responses, making it straightforward to integrate with most programming languages and platforms. The exact endpoints and capabilities may vary depending on your n8n version and deployment type (self-hosted vs cloud).