http://localhost:8000
Optional API key authentication via Bearer token:
Authorization: Bearer {api_key}
If no API key is configured, authentication is disabled.
GET /healthReturns server health status.
Response:
{
"status": "healthy",
"uptime_seconds": 86400,
"active_tasks": 1234
}POST /tasks/schedule
Content-Type: application/jsonSchedule a new task.
Request Body:
{
"schedule_type": "send_mail",
"when": {
"type": "once",
"time": "2024-12-05T14:30:00Z"
},
"payload": {
"to": "user@example.com",
"body": "Hello"
},
"repeat": null,
"metadata": {
"created_by": "agent_123"
}
}When Types:
-
Once - Single execution:
{ "type": "once", "time": "2024-12-05T14:30:00Z" // ISO 8601 }{ "type": "once", "delay": "5m" // Relative: 5m, 2h, 1d }{ "type": "once", "natural": "tomorrow at 2pm" // Natural language } -
Recurring - Repeated execution:
{ "type": "recurring", "delay": "5m", "repeat": { "interval": "1h", "times": 5 // null for infinite } } -
Cron - Cron expression:
{ "type": "cron", "cron": "0 9 * * *" // Daily at 9am }
Response:
{
"task_id": "uuid-here",
"schedule_type": "send_mail",
"next_execution": "2024-12-05T14:30:00Z",
"status": "active"
}GET /tasks/poll?types=send_mail,order_food&limit=10High-performance endpoint for polling due tasks.
Query Parameters:
types: Comma-separated schedule typeslimit: Maximum tasks to return (1-100)
Response:
{
"tasks": [
{
"task_id": "uuid-here",
"schedule_type": "send_mail",
"payload": {
"to": "user@example.com",
"body": "Hello"
},
"scheduled_for": "2024-12-05T14:30:00Z"
}
],
"next_poll_at": "2024-12-05T14:30:05Z"
}Headers:
ETag: For conditional requests (304 Not Modified)X-Poll-Interval: Suggested polling interval in seconds
POST /tasks/{task_id}/ack
Content-Type: application/jsonAcknowledge task execution.
Request Body:
{
"status": "success",
"execution_time_ms": 123,
"error": null
}Response:
{
"next_execution": "2024-12-06T14:30:00Z" // null if no more executions
}GET /tasks/{task_id}Get task details.
Response:
{
"id": "uuid-here",
"schedule_type": "send_mail",
"created_at": 1733409000,
"payload": {...},
"schedule_config": {...},
"status": "active",
"next_execution_iso": "2024-12-05T14:30:00Z"
}PATCH /tasks/{task_id}
Content-Type: application/jsonUpdate task (pause, resume, modify).
Request Body:
{
"status": "paused"
}DELETE /tasks/{task_id}Cancel/delete task.
Response:
{
"status": "cancelled"
}GET /tasks?status=active&schedule_type=send_mail&limit=100&offset=0List tasks with filters.
Query Parameters:
status: Filter by status (active, paused, completed, cancelled)schedule_type: Filter by schedule typelimit: Maximum results (1-1000)offset: Pagination offset
Response:
{
"tasks": [...],
"count": 10
}GET /tasks/{task_id}/history?limit=100Get execution history for a task.
Response:
{
"history": [
{
"executed_at": 1733409000,
"executed_at_iso": "2024-12-05T14:30:00Z",
"status": "success",
"execution_time_ms": 123,
"error": null
}
]
}GET /metricsPrometheus-format metrics.
Response:
# HELP pulse_tasks_active Number of active tasks
# TYPE pulse_tasks_active gauge
pulse_tasks_active 1234
# HELP pulse_tasks_executed_total Total tasks executed
# TYPE pulse_tasks_executed_total counter
pulse_tasks_executed_total 56789
All errors return JSON:
{
"detail": "Error message"
}Status Codes:
400: Bad Request401: Unauthorized404: Not Found500: Internal Server Error