API Reference

Complete API documentation for integrating with ezyWFM.

Base URL

https://your-domain.com/api

Authentication

ezyWFM supports two authentication methods:

Session-Based Authentication

For web UI integrations, use NextAuth.js session cookies. Users authenticate through the login page, and the session cookie is automatically included in subsequent requests.

API Key Authentication

For server-to-server integrations, use API keys:

http
Authorization: Bearer YOUR_API_KEY

Or:

http
X-API-Key: YOUR_API_KEY

API keys are only shown once when created. Store them securely.

Creating API Keys

  1. Go to SettingsAPI Keys
  2. Click Create API Key
  3. Enter a name and select permissions
  4. Copy the key immediately (it won't be shown again)

Available Permissions

| Permission | Description | |------------|-------------| | import:historical | Import historical contact data | | import:employees | Sync employees from HRIS | | import:agent-states | Push real-time agent states |

Error Handling

All errors follow a consistent format:

json
{
"error": "Error message",
"details": { }
}

HTTP Status Codes

| Code | Meaning | |------|---------| | 200 | Success | | 201 | Created | | 400 | Bad Request (validation error) | | 401 | Unauthorized (not logged in) | | 403 | Forbidden (insufficient permissions) | | 404 | Not Found | | 409 | Conflict (duplicate resource) | | 429 | Too Many Requests (rate limited) | | 500 | Internal Server Error | | 503 | Service Unavailable |

Rate Limiting

API requests are rate limited to prevent abuse:

| Endpoint Type | Limit | |---------------|-------| | Authentication | 10/minute | | Sensitive operations | 5/minute | | External API (v1) | 1000/minute | | General API | 100/minute |

When rate limited, you'll receive a 429 response with Retry-After header.

Pagination

List endpoints support pagination:

GET /api/endpoint?page=1&limit=50

Response includes:

json
{
"data": [...],
"page": 1,
"limit": 50,
"total": 250
}

API Sections