Savannah Cloud

Jobs

Push, list, and inspect background jobs via the REST API.

Base URL

http://localhost:8080

All job endpoints require authentication. Use either a JWT or an API key.


Push a Job

Enqueues a new background job.

POST /jobs
X-API-Key: sc_your_key_here
Content-Type: application/json

Request body

{
  "type": "send_email",
  "payload": {
    "to": "user@example.com",
    "subject": "Hello",
    "body": "Hello from Savannah"
  },
  "max_retries": 3
}
FieldTypeRequiredDescription
typestringYesJob type; determines which handler runs
payloadobjectYesArbitrary JSON passed to the worker handler
max_retriesintegerNoMax attempts before marking failed (default: 0)

Response 202 Accepted

{
  "id": "unique-job-id",
  "status": "pending"
}

See Job Types for the list of built-in handlers and their expected payload shapes.


List Jobs

Returns all jobs in the organization, optionally filtered by status.

GET /jobs
GET /jobs?status=pending
Authorization: Bearer <token>

Query parameters

ParamValuesDescription
statuspending, processing, done, failedFilter by job status

Response 200

[
  {
    "id": "job-001",
    "type": "send_email",
    "status": "done",
    "retries": 0,
    "max_retries": 3,
    "created_at": "2026-05-24T10:00:00Z",
    "updated_at": "2026-05-24T10:00:05Z"
  }
]

Get a Single Job

GET /jobs/{id}
Authorization: Bearer <token>

Response 200

{
  "id": "job-001",
  "type": "send_email",
  "status": "done",
  "payload": { "to": "user@example.com", "subject": "Hello" },
  "retries": 0,
  "max_retries": 3,
  "created_at": "2026-05-24T10:00:00Z",
  "updated_at": "2026-05-24T10:00:05Z"
}

Get Job Execution Logs

Returns per-attempt log lines for a job.

GET /jobs/{id}/logs
Authorization: Bearer <token>

Response 200

[
  {
    "attempt": 1,
    "message": "Processing send_email for user@example.com",
    "level": "info",
    "timestamp": "2026-05-24T10:00:01Z"
  },
  {
    "attempt": 1,
    "message": "Email sent successfully",
    "level": "info",
    "timestamp": "2026-05-24T10:00:05Z"
  }
]

Job Status Reference

StatusDescription
pendingEnqueued, waiting for a worker
processingA worker has picked it up
completedCompleted successfully
failedAll retry attempts exhausted

Quick Reference

# Push a job
curl -X POST http://localhost:8080/jobs \
  -H "X-API-Key: sc_your_key_here" \
  -H "Content-Type: application/json" \
  -d '{"type":"send_email","payload":{"to":"user@example.com","subject":"Hi","body":"Hello"}}'

# List all jobs
curl http://localhost:8080/jobs \
  -H "Authorization: Bearer YOUR_JWT"

# List only failed jobs
curl "http://localhost:8080/jobs?status=failed" \
  -H "Authorization: Bearer YOUR_JWT"

# Get a single job
curl http://localhost:8080/jobs/job-001 \
  -H "Authorization: Bearer YOUR_JWT"

# Get logs for a job
curl http://localhost:8080/jobs/job-001/logs \
  -H "Authorization: Bearer YOUR_JWT"

On this page