Enterprise API Reference Enterprise
Complete API documentation for enterprise deployments with advanced features and multi-language SDKs.
API Overview
The Delegated Enterprise API provides programmatic access to all platform functionality including task management, agent orchestration, analytics, and system administration. Built with RESTful principles and GraphQL support for complex queries.
| Property | Value |
|---|---|
| Base URL | https://api.delegated.nl/v2/ |
| Authentication | Bearer tokens (JWT) or API keys |
| Rate Limits | Tier-based (1K-100K requests/hour) |
| Response Format | JSON with consistent error handling |
Authentication
Bearer Token Authentication
POST /v2/auth/login
Get access token with MFA support
curl -X POST https://api.delegated.nl/v2/auth/login \
-H "Content-Type: application/json" \
-d '{
"email": "user@company.com",
"password": "securepassword",
"mfa_code": "123456"
}'
{
"access_token": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9...",
"refresh_token": "rt_abc123...",
"expires_in": 3600,
"token_type": "Bearer"
}
API Key Authentication
POST /v2/account/api-keys
Create scoped API key with expiration
curl -X POST https://api.delegated.nl/v2/account/api-keys \
-H "Authorization: Bearer <token>" \
-d '{
"name": "Production Integration",
"scopes": ["tasks:read", "tasks:write", "analytics:read"],
"expires_at": "2025-12-31T23:59:59Z"
}'
{
"id": "ak_123456789",
"key": "dlg_sk_live_abc123def456...",
"name": "Production Integration",
"scopes": ["tasks:read", "tasks:write", "analytics:read"],
"created_at": "2024-03-20T10:30:00Z"
}
Core Endpoints
Tasks Management
POST /v2/tasks
Create task with advanced configuration
{
"title": "Competitor Analysis - HiSmile",
"description": "Analyze HiSmile's Q1 2024 marketing strategy",
"type": "research",
"priority": "high",
"assigned_to": "agent_001",
"workspace_id": "ws_123",
"deadline": "2024-03-25T17:00:00Z",
"metadata": {
"competitors": ["HiSmile", "SNOW"],
"channels": ["instagram", "tiktok", "facebook"],
"deliverables": ["report", "recommendations"]
}
}
{
"id": "task_456789",
"title": "Competitor Analysis - HiSmile",
"status": "pending",
"progress": 0,
"created_at": "2024-03-20T10:30:00Z",
"estimated_completion": "2024-03-20T14:30:00Z",
"agent": {
"id": "agent_001",
"name": "Research Agent",
"status": "available"
}
}
GET /v2/tasks/{task_id}
Get detailed task status with logs and outputs
{
"id": "task_456789",
"title": "Competitor Analysis - HiSmile",
"status": "in_progress",
"progress": 65,
"logs": [
{
"timestamp": "2024-03-20T10:35:00Z",
"message": "Started competitor research",
"level": "info"
}
],
"outputs": [
{
"type": "file",
"name": "hismile_analysis.pdf",
"url": "https://cdn.delegated.nl/outputs/task_456789/hismile_analysis.pdf",
"size": 2456789
}
]
}
Agent Management
GET /v2/agents
List available agents with capabilities and status
{
"agents": [
{
"id": "agent_001",
"name": "Research Agent",
"type": "research",
"status": "available",
"capabilities": [
"competitor_analysis",
"market_research",
"trend_analysis"
],
"current_workload": 25,
"success_rate": 0.94
}
]
}
POST /v2/agents
Create custom agent with specialized capabilities
{
"name": "E-commerce Specialist",
"type": "custom",
"model": "anthropic/claude-3-5-sonnet",
"system_prompt": "You are an expert e-commerce analyst...",
"capabilities": ["shopify_analysis", "conversion_optimization"],
"tools": ["shopify_api", "google_analytics", "facebook_ads"],
"workspace_id": "ws_123"
}
Advanced Features
GraphQL API
Complex queries with nested data and real-time subscriptions.
POST /v2/graphql
query GetWorkspaceOverview($workspaceId: ID!) {
workspace(id: $workspaceId) {
name
tasks(first: 10, status: IN_PROGRESS) {
edges {
node {
id
title
progress
agent {
name
type
}
estimatedCompletion
}
}
}
agents {
id
name
status
currentWorkload
}
analytics(period: LAST_7_DAYS) {
tasksCompleted
timesSaved
successRate
}
}
}
Real-time API (WebSocket)
Live updates for dashboard and task progress monitoring.
// Connect to WebSocket
const ws = new WebSocket('wss://api.delegated.nl/v2/realtime');
ws.onopen = () => {
// Authenticate
ws.send(JSON.stringify({
type: 'auth',
token: 'Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9...'
}));
// Subscribe to workspace updates
ws.send(JSON.stringify({
type: 'subscribe',
channels: ['workspace.ws_123', 'tasks']
}));
};
ws.onmessage = (event) => {
const data = JSON.parse(event.data);
switch(data.type) {
case 'task.progress':
updateTaskProgress(data.task_id, data.progress);
break;
case 'agent.status':
updateAgentStatus(data.agent_id, data.status);
break;
}
};
Analytics & Reporting
GET /v2/analytics/tasks
Get comprehensive task analytics with time series data
GET /v2/analytics/tasks?from=2024-03-01&to=2024-03-31&group_by=day
{
"period": {
"from": "2024-03-01T00:00:00Z",
"to": "2024-03-31T23:59:59Z"
},
"metrics": {
"total_tasks": 1247,
"completed_tasks": 1198,
"success_rate": 0.961,
"avg_completion_time": 2.3,
"time_saved_hours": 892
},
"daily_breakdown": [
{
"date": "2024-03-01",
"tasks_completed": 42,
"avg_completion_time": 1.8,
"time_saved": 28.5
}
]
}
Rate Limits & Quotas
Rate Limit Tiers
| Tier | Requests/Hour | Burst Limit | WebSocket Connections |
|---|---|---|---|
| Professional | 10,000 | 500/min | 25 |
| Enterprise | 100,000 | 2,000/min | 100 |
| Custom | Unlimited | Custom | Custom |
Rate Limit Headers
HTTP/1.1 200 OK
X-RateLimit-Limit: 10000
X-RateLimit-Remaining: 9847
X-RateLimit-Reset: 1710936000
X-RateLimit-Burst: 500
X-RateLimit-Burst-Remaining: 498
Error Handling
Standard Error Response
{
"error": {
"code": "INVALID_REQUEST",
"message": "The request parameters are invalid",
"details": {
"field": "deadline",
"issue": "Date must be in the future"
},
"request_id": "req_abc123",
"timestamp": "2024-03-20T10:30:00Z"
}
}
Error Codes
| Code | HTTP Status | Description |
|---|---|---|
AUTHENTICATION_FAILED | 401 | Invalid or expired token |
AUTHORIZATION_FAILED | 403 | Insufficient permissions |
INVALID_REQUEST | 400 | Request validation failed |
RESOURCE_NOT_FOUND | 404 | Requested resource doesn't exist |
RATE_LIMIT_EXCEEDED | 429 | Too many requests |
QUOTA_EXCEEDED | 402 | Subscription limit reached |
SDK Examples
JavaScript/Node.js SDK
npm install @delegated/sdk
// Initialize client
const Delegated = require('@delegated/sdk');
const client = new Delegated({
apiKey: 'dlg_sk_live_abc123...',
environment: 'production'
});
// Create task
const task = await client.tasks.create({
title: 'Analyze competitor pricing',
type: 'research',
priority: 'high',
metadata: {
competitors: ['HiSmile', 'SNOW']
}
});
// Monitor progress
const subscription = client.tasks.subscribe(task.id);
subscription.on('progress', (data) => {
console.log(`Progress: ${data.progress}%`);
});
// Wait for completion
const result = await client.tasks.waitForCompletion(task.id);
Python SDK
pip install delegated-sdk
# Initialize client
from delegated import DelegatedClient
client = DelegatedClient(
api_key='dlg_sk_live_abc123...',
environment='production'
)
# Create and monitor task
task = client.tasks.create(
title='Content generation',
type='creative',
agent_id='agent_002',
config={
'format': 'instagram_post',
'brand_voice': 'professional'
}
)
# Stream progress
for update in client.tasks.stream_progress(task.id):
print(f"Status: {update.status}, Progress: {update.progress}%")
if update.status == 'completed':
break
API Version: 2.1 | Documentation Updated: March 2026 | Support: api-support@delegated.nl