API Documentation
Complete reference for all available API endpoints. Authenticate with your API key to get started.
Login to Access Your API Key
Your personal API key is required to authenticate requests. Log in to view, copy, or regenerate your key.
Authentication
All API requests require authentication via your API key.
Include your API key in every request using one of these methods:
# Recommended: X-API-Key header
X-API-Key: your-api-key-here
# Alternative: Authorization Bearer token
Authorization: Bearer your-api-key-here | HTTP Status | Meaning |
|---|---|
| 401 | Missing API key |
| 403 | Invalid or expired API key |
| 429 | Rate limit exceeded (60 req/min for trigger endpoints) |
/api/token-usageToken Usage Tracking
Track AI model token consumption and costs from your n8n workflows.
Quick Setup
Enable dashboard editing, click Connect to n8n, then copy the pre-configured HTTP Request node — your API key is already filled in.
Request
POSThttps://invokati.com/api/token-usageX-API-Key headerRequest Body
{
"n8n_base_url": "{{ $env.WEBHOOK_URL.split('/webhook')[0] }}",
"workflow_id": "{{ $workflow.id }}",
"execution_id": "{{ $execution.id }}",
"model_id": "gpt-4",
"input_tokens": {{ $json.usage.prompt_tokens }},
"output_tokens": {{ $json.usage.completion_tokens }}
}Fields
| Field | Required | Description |
|---|---|---|
| n8n_base_url | Yes | Base URL of your n8n instance |
| workflow_id | Yes | n8n workflow UUID ($workflow.id) |
| execution_id | Yes | n8n execution ID ($execution.id) |
| model_id | Yes | AI model name e.g. gpt-4, claude-3-opus |
| input_tokens | Yes | Number of prompt/input tokens |
| output_tokens | Yes | Number of completion/output tokens |
Token field names by AI provider:
- OpenAI:
$json.usage.prompt_tokens/$json.usage.completion_tokens - Anthropic:
$json.usage.input_tokens/$json.usage.output_tokens - Google:
$json.usageMetadata.promptTokenCount/$json.usageMetadata.candidatesTokenCount
Response (201)
{
"status": "success",
"message": "Token usage recorded successfully",
"id": "259",
"data": {
"workflow_id": "b9NLgJV0oXIpXSsr",
"execution_id": "551",
"model_id": "gpt-4",
"input_tokens": 399,
"output_tokens": 288,
"total_tokens": 687,
"input_cost": 0.01197,
"output_cost": 0.01728,
"total_cost": 0.02925,
"model_found": true,
"model_label": "GPT-4"
}
} GET /api/token-usage/{workflow_id}/stats
Retrieve aggregated token usage statistics for a workflow.
{
"status": "success",
"workflow_id": "abc123",
"stats": {
"total_records": 150,
"total_tokens": 210000,
"total_cost": 8.85
}
}/api/trigger-webhookWebhook Trigger
Trigger an n8n workflow from the dashboard. Proxies the request to your n8n webhook endpoint. Rate limited to 60 requests/minute.
Quick Setup
Enable dashboard editing, click Connect to n8n, then use Copy Trigger Node to get a fully pre-configured webhook node for your n8n canvas.
Trigger Request Body
{
"endpoint": "https://n8n.example.com/webhook/your-path",
"source": "dashboard",
"data": {
"custom_key": "custom_value"
}
}| Field | Required | Description |
|---|---|---|
| endpoint | Yes | Full n8n webhook URL to call |
| source | No | Origin label, defaults to dashboard |
| data | No | Additional payload to forward to n8n |
n8n receives this payload
{
"triggered_at": "2025-01-21T10:30:00Z",
"source": "dashboard",
"user_id": 42,
"username": "john.doe",
"data": {}
}n8n Webhook Setup
POSTinvokati-trigger/[installation_id]/[workflow_id]Immediately/api/poll-executionPoll Execution Status
Poll n8n for the status of the most recent execution of a workflow. Automatically called by the dashboard after triggering.
{
"nid": 123,
"triggered_after": "2025-01-21T10:30:00Z"
}| Field | Required | Description |
|---|---|---|
| nid | Yes | Drupal workflow node ID |
| triggered_after | No | ISO timestamp — only match executions after this time |
Response statuses
| status | is_complete | Meaning |
|---|---|---|
| waiting | false | Execution not yet started, keep polling |
| success | true | Execution completed successfully |
| error | true | Execution failed or crashed |
Media API
Create and manage media items (images, videos, audio, files) from n8n workflows. Media items are scoped to your client group.
| Method | Endpoint | Auth | Description |
|---|---|---|---|
| POST | /api/media | API Key | Create a media item |
| GET | /api/media/list | Session | List media items for your group |
| GET | /api/media/{id} | Session | Get a single media item |
| PATCH | /api/media/{id} | Session | Update media item fields |
| DELETE | /api/media/{id} | API Key | Delete a media item |
| POST | /automation/media/create | API Key | Create from n8n with human-interaction flag |
| GET | /api/media/stats | Session | Media statistics for dashboard widget |
Create Media — POST /api/media
{
"title": "Product Hero Video",
"media_type": "video",
"url": "https://youtube.com/watch?v=xyz",
"thumbnail_url": "https://img.youtube.com/vi/xyz/hqdefault.jpg",
"description": "Main hero video for product launch",
"tags": "product, launch, hero",
"installation_id": 45,
"workflow_id": "abc123",
"execution_id": "exec-789",
"human_interaction": true,
"allow_regenerate": true,
"automation_status": "pending"
}Media Fields Reference
| Field | Required | Description |
|---|---|---|
| title | Yes | Display name for the media item |
| media_type | Yes | video, image, audio, or file |
| url | No | Source URL — provider metadata auto-resolved for YouTube, Vimeo, etc. |
| thumbnail_url | No | Preview image URL (auto-resolved from YouTube/Vimeo if omitted) |
| embed_url | No | Embeddable URL (auto-resolved) |
| download_url | No | Direct download URL, defaults to url |
| source | No | Source label e.g. YouTube, Vimeo |
| duration | No | Video/audio duration string |
| file_size | No | Human-readable file size |
| width / height | No | Pixel dimensions (integers) |
| description | No | Free-text description |
| tags | No | Comma-separated tags |
| installation_id | No | Drupal Installation node ID |
| workflow_id | No | n8n workflow UUID — used to resolve client group |
| execution_id | No | n8n execution ID — required for human-interaction resume |
| human_interaction | No | true to require approve/deny review before workflow resumes |
| allow_regenerate | No | true to show a Regenerate button in the review panel |
| automation_status | No | Initial status: pending (default), approved, denied |
| collection_id | No | ID of an existing Collection entity to assign this media item to |
| collection_name | No | Collection title — auto-creates the collection if it doesn't exist. Takes precedence over collection_id |
List Media Query Params — GET /api/media/list
| Param | Description |
|---|---|
| media_type | Filter by type: video, image, audio, file |
| automation_status | Filter by status: pending, approved, denied |
| human_interaction | Set to 1 to return only items requiring review |
| group_id | Filter to a specific client group ID |
| search | Search in title, source, and tags |
| collection_id | Filter to media items in a specific collection |
Response (201)
{
"success": true,
"id": 42,
"media_type": "video",
"automation_status": "pending",
"installation_id": 45,
"workflow_id": "abc123",
"message": "Media item created successfully."
}Collections API
Manage collections — named groups for organizing media items. Collections are scoped to your team. Use collection_name in media creation calls to auto-create collections.
| Method | Endpoint | Auth | Description |
|---|---|---|---|
| GET | /api/collections | Session | List all collections for your team |
| POST | /api/collections | Session | Create a new collection |
| GET | /api/collections/{id} | Session | Get a single collection |
| PUT | /api/collections/{id} | Session | Update title or description |
| DELETE | /api/collections/{id} | Session | Delete a collection |
Create Collection — POST /api/collections
{
"title": "March Social Media Campaign",
"description": "All assets for Q1 social push"
}List Response
{
"collections": [
{
"id": 1,
"title": "March Social Media Campaign",
"description": "All assets for Q1 social push",
"team_id": 5,
"media_count": 12,
"created": 1710000000,
"changed": 1710100000
}
],
"count": 1
}Auto-create from n8n: Pass collection_name in any POST /api/media payload and the collection will be created automatically if it does not exist. The resolved collection_id is returned in the media create response.
Leads API
Create and manage leads from n8n workflows. Leads are scoped to your client group with automatic duplicate detection.
| Method | Endpoint | Description |
|---|---|---|
| POST | /api/leads | Create a lead (API Key auth) |
| GET | /api/leads/recent | Recent leads for dashboard widget |
| GET | /api/leads/list | Full lead list with filters |
| GET | /api/leads/{id} | Get single lead |
| PATCH | /api/leads/{id} | Update lead fields |
| DELETE | /api/leads/{id} | Delete lead (API Key auth) |
Create Lead — POST /api/leads
Duplicate detection is automatic — same email within the same group triggers dedup behavior. Control with on_duplicate query param.
POST /api/leads?on_duplicate=update
{
"first_name": "Jane",
"last_name": "Doe",
"email": "jane@example.com",
"phone": "+1 555-0100",
"company_name": "Acme Corp",
"job_title": "VP Marketing",
"website": "https://acme.com",
"industry": "Technology",
"company_size": "51-200",
"annual_revenue": "$5M-$10M",
"location": "San Francisco, CA",
"lead_source": "Website Form",
"status": "New",
"lead_score": 75,
"budget_confirmed": false,
"pain_points": "Manual reporting takes too long",
"timeline": "Q2 2025",
"utm_source": "google",
"utm_medium": "cpc",
"utm_campaign": "spring-promo",
"installation_id": 45,
"workflow_id": "abc123",
"execution_id": "exec-789",
"human_interaction": false,
"automation_status": "pending"
}Required Fields
| Field | Type | Description |
|---|---|---|
| first_name | Required | Lead's first name |
| last_name | Required | Lead's last name |
| Required | Email address — used for duplicate detection |
Duplicate Handling
Add ?on_duplicate= to the query string:
| Value | Behavior |
|---|---|
| ignore | Default — return existing lead ID, no update |
| update | Update non-empty fields on the existing lead |
| create | Always create a new lead, skip dedup check |
Default Statuses
List Query Params — GET /api/leads/list
| Param | Description |
|---|---|
| status | Filter by lead status |
| source | Filter by lead_source value |
| group_id | Filter to a specific client group |
| search | Search in name, email, and company |
| limit | Max results for /recent endpoint (1–50, default 5) |
Response (201)
{
"success": true,
"id": 101,
"status": "New",
"message": "Lead created successfully."
}Lead Pipeline & Custom Fields
Manage custom lead statuses, custom fields, view configuration, and bulk operations for your team's CRM pipeline.
Lead Statuses
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/lead-statuses | List all statuses for your team (includes defaults) |
| POST | /api/lead-statuses | Create a custom status (requires label, optional color) |
| PATCH | /api/lead-statuses/{id} | Update label or color of a custom status |
| DELETE | /api/lead-statuses/{id} | Delete a custom status (built-in statuses cannot be deleted) |
| POST | /api/lead-statuses/reorder | Reorder statuses — body: {"ids": [3,1,4,2]} |
Custom Fields
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/lead-custom-fields | List custom fields defined for your team |
| POST | /api/lead-custom-fields | Create a custom field (requires label and field_type) |
| PATCH | /api/lead-custom-fields/{id} | Update field label, options, or required flag |
| DELETE | /api/lead-custom-fields/{id} | Delete a custom field and all its values |
Supported field_type values: text, textarea, number, date, select, checkbox, url. Pass options as a JSON array for select fields. Custom field values are read and written via the standard /api/leads/{id} PATCH endpoint using the field's machine name.
View Configuration
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/leads/view-config | Get the current user's saved column visibility and order |
| PUT | /api/leads/view-config | Save column visibility/order — body: {"columns": [...]} |
Bulk Operations — POST /api/leads/bulk
{
"action": "update_status",
"ids": [101, 102, 103],
"status": "Qualified"
}Supported actions: update_status, delete.
Custom Payloads API
Store arbitrary structured data from n8n workflows. Use custom payloads for any output that doesn't fit the Lead or Media models.
| Method | Endpoint | Description |
|---|---|---|
| POST | /api/payloads | Create a custom payload (API Key auth) |
| GET | /api/payloads/list | List payloads with filters |
| GET | /api/payloads/{id} | Get single payload |
| PATCH | /api/payloads/{id} | Update payload |
| DELETE | /api/payloads/{id} | Delete payload (API Key auth) |
| POST | /automation/payload/create | Create from n8n with human-interaction flag |
Create Payload — POST /api/payloads
{
"title": "Monthly SEO Report",
"task_type": "seo-report",
"payload": {
"domain": "example.com",
"keywords": ["n8n automation", "workflow tool"],
"backlinks": 342,
"domain_authority": 45
},
"installation_id": 45,
"workflow_id": "abc123",
"execution_id": "exec-789",
"human_interaction": true,
"allow_regenerate": true,
"automation_status": "pending"
}Fields Reference
| Field | Required | Description |
|---|---|---|
| title | Yes | Display name for the payload |
| task_type | No | Category label for grouping e.g. seo-report, content-brief. Defaults to generic |
| payload | No | Any JSON object or string — stored as JSON |
| installation_id | No | Drupal Installation node ID |
| workflow_id | No | n8n workflow UUID |
| execution_id | No | n8n execution ID — required for human-interaction resume |
| human_interaction | No | true to pause workflow until a human approves/denies |
| allow_regenerate | No | true to show a Regenerate button in the review panel |
| automation_status | No | pending (default), approved, denied |
List Query Params — GET /api/payloads/list
| Param | Description |
|---|---|
| task_type | Filter by task type string |
| automation_status | Filter by status |
| human_interaction | Set to 1 for items requiring review |
| group_id | Filter to a specific client group |
| search | Search in title and task_type |
Human Interaction (Automation Review)
Pause n8n workflows for human review. When approved, denied, or regenerated, the platform automatically resumes the paused n8n execution via the n8n resume API.
How it works
- Your n8n workflow creates a Lead, Media, or Custom Payload with
human_interaction: trueandexecution_id - n8n pauses using a Wait node listening on the resume webhook
- A reviewer on the platform clicks Approve, Deny, or Regenerate
- The platform calls
POST /automation/approve(or deny/regenerate) - The platform POSTs to
{n8n_host}/rest/executions/{execution_id}/resumewith the decision - n8n resumes and processes the decision
Review Endpoints
| Method | Endpoint | Action | Required Permission |
|---|---|---|---|
| POST | /automation/approve | Set status to approved and resume n8n | review automation content |
| POST | /automation/deny | Set status to denied and resume n8n | review automation content |
| POST | /automation/regenerate | Set status to regenerate and resume n8n | review automation content |
Request Body (all three endpoints)
{
"entity_id": 42,
"entity_type": "custom_payload",
"execution_id": "exec-789",
"installation_id": 45,
"notes": "Looks good, approved for production."
}| Field | Required | Description |
|---|---|---|
| entity_id | Yes | ID of the entity to review |
| entity_type | Yes | lead, media_item, or custom_payload |
| execution_id | No* | n8n execution ID — required to resume the workflow |
| installation_id | No* | Installation node ID — required to resume the workflow |
| notes | No | Reviewer notes — saved as a note and forwarded to n8n |
* If omitted, the platform uses the values stored on the entity. Both are needed to resume n8n.
n8n receives this resume payload
{
"decision": "approved",
"notes": "Looks good, approved for production.",
"entity_id": 42,
"entity_type": "custom_payload"
}Response
{
"success": true,
"entity_id": 42,
"entity_type": "custom_payload",
"action": "approved",
"automation_status": "approved",
"n8n_resumed": true
}Create via Automation Endpoints
Convenience endpoints for creating entities from n8n with human-interaction preset to pending. Authentication via API Key.
| Endpoint | Creates | Required Fields |
|---|---|---|
| /automation/payload/create | CustomPayload | title |
| /automation/media/create | MediaItem | title, media_type |
Both accept the same fields as their respective /api/ counterparts plus an optional group_id to override the auto-resolved client group.
/api/push/executionsPush Execution Data
For self-hosted n8n instances that push execution telemetry to this platform instead of the platform polling the n8n API. Requires Bearer token auth.
Register Your n8n Instance First
POST /api/installs/register
Authorization: Bearer your-api-key-here
{
"instance_id": "my-n8n-001",
"host": "https://n8n.yourdomain.com",
"api_key": "n8n-api-key-here",
"title": "Production n8n"
}Push Execution Data
POST /api/push/executions
Authorization: Bearer your-api-key-here
{
"installation_id": 45,
"workflow_id": "abc123",
"execution_data": { }
}Execution data is stored as {installation_id}-{workflow_id}.json and used by the workflow dashboard instead of polling the n8n API.
Get Already-Imported Workflows
GET /api/installed/{installation_node_id}Returns a list of n8n workflow IDs already imported from a given installation — useful to avoid duplicates during bulk import.