Scheduled Jobs API
Base path: /api/jobs
GET /api/jobs
List all jobs.
Response 200:
[ { "id": "job_abc", "name": "Daily Ticket Summary", "description": "Summarize open tickets and send report", "action": "agent_run", "schedule": "0 9 * * 1-5", "enabled": true, "config": { "agentId": "agent_abc", "message": "Summarize all open critical tickets from the last 24 hours" }, "lastRun": "2024-01-15T09:00:00.000Z", "nextRun": "2024-01-16T09:00:00.000Z", "createdAt": "2024-01-10T08:00:00.000Z" }]GET /api/jobs/:id
Get a single job.
POST /api/jobs
Create a job.
Request body:
{ "name": "Daily Ticket Summary", "description": "Send daily open ticket summary", "action": "agent_run", "schedule": "0 9 * * 1-5", "enabled": true, "config": { "agentId": "agent_abc", "message": "Summarize open critical tickets" }}Action types and config:
agent_run:
{ "agentId": "string", "message": "string" }webhook_dispatch:
{ "eventType": "string", "payload": {} }http_request:
{ "url": "string", "method": "GET|POST|PUT|DELETE", "headers": {}, "body": {}}PUT /api/jobs/:id
Update a job. All fields optional.
DELETE /api/jobs/:id
Delete a job and all its run history.
POST /api/jobs/:id/run
Trigger a job to run immediately, regardless of schedule or enabled state.
Response 200:
{ "runId": "run_001", "status": "success", "output": "Agent returned: Acme Corp has 3 open critical tickets...", "startedAt": "2024-01-15T14:30:00.000Z", "completedAt": "2024-01-15T14:30:04.231Z", "duration": 4231}GET /api/jobs/:id/runs
Get execution history (last 100 runs).
Response 200:
[ { "id": "run_001", "status": "success", "output": "...", "startedAt": "2024-01-15T09:00:00.000Z", "duration": 3241 }, { "id": "run_000", "status": "error", "output": "Agent run failed: ANTHROPIC_API_KEY not configured", "startedAt": "2024-01-14T09:00:00.000Z", "duration": 45 }]DELETE /api/jobs/:id/runs
Clear all run history for a job.