You can build a complete REST API inside n8n by using multiple Webhook nodes with different HTTP methods and paths.
You can build a complete REST API inside n8n by using multiple Webhook nodes with different HTTP methods and paths. Each webhook handles one operation (GET, POST, PUT, DELETE), and they can share downstream logic through sub-workflows or common Code nodes.
Real-world example: Build a simple task management API that a mobile app or frontend can call.
Create four separate workflows (or use one workflow with four Webhook trigger nodes if your n8n version supports it):
GET /webhook/api/tasks --> List all tasks
POST /webhook/api/tasks --> Create a task
PUT /webhook/api/tasks/:taskId --> Update a task
DELETE /webhook/api/tasks/:taskId --> Delete a task
```text
Workflow 1 -- List Tasks (GET):
```json
// Webhook node config
{
"httpMethod": "GET",
"path": "api/tasks",
"responseMode": "responseNode"
}
```text
```sql
-- Postgres node: Fetch tasks (parameterized)
SELECT id, title, status, created_at
FROM tasks
WHERE deleted_at IS NULL
ORDER BY created_at DESC
LIMIT $1
OFFSET $2;
-- Query Parameter 1: {{ $json.query.limit || 50 }}
-- Query Parameter 2: {{ $json.query.offset || 0 }}
```text
```json
// Respond to Webhook node
{
"respondWith": "json",
"responseCode": 200,
"responseBody": "={{ { \"tasks\": $json, \"count\": $json.length } }}"
}
```text
Workflow 2 -- Create Task (POST):
```json
// Webhook node config
{
"httpMethod": "POST",
"path": "api/tasks",
"responseMode": "responseNode"
}
```text
```sql
-- Postgres node: Insert task (parameterized)
INSERT INTO tasks (title, status, created_at)
VALUES ($1, 'pending', NOW())
RETURNING id, title, status, created_at;
-- Query Parameter 1: {{ $json.body.title }}
```text
```json
// Respond to Webhook node
{
"respondWith": "json",
"responseCode": 201,
"responseBody": "={{ { \"task\": $json } }}"
}
```text
> **Tip: Use sub-workflows for shared logic**
>
> If multiple endpoints share validation or authentication logic, extract it into a sub-workflow called via the Execute Workflow node. This keeps each webhook workflow focused on its HTTP operation.
This pattern gives you a full CRUD API without an external framework. Your frontend or mobile app hits n8n directly.
**Related:** [Set a Unique Encryption Key and Back It Up](../security-best-practices/01-set-a-unique-encryption-key-and-back-it-up.md) | [Use the HTTP Request Node as a Universal Connector](../integration-patterns/01-use-the-http-request-node-as-a-universal-connector.md)
I build production n8n and Cloudflare automation for teams — the same engineering behind HarperFlow. Fixed-price, escrow-protected, US-based.