Jobs
A job is one unit of work: a handler name, a JSON payload and the queue that should run it. Jobs move through the states described in the job lifecycle.
The Job object
job_.scheduled, queued, running, succeeded, failed, cancelled, dead.dead.Create a job
POST/jobs
Enqueues a job. With run_at in the future the job starts as scheduled. Sending the same idempotency_key twice returns the first job instead of creating a second one.
Required scope jobs:write
Request body
{} 5 5 Request
curl -X POST https://api.sextant.example/v2/jobs \
-H "Authorization: Bearer $SEXTANT_TOKEN" \
-H "Content-Type: application/json" \
-d '{"queue":"emails","handler":"send-receipt","payload":{"order_id":"ord_4412","to":"[email protected]"},"run_at":"2026-10-20T09:15:00Z","idempotency_key":"receipt-ord_4412"}'const result = await sextant.jobs.create({
queue: 'emails',
handler: 'send-receipt',
payload: {
order_id: 'ord_4412',
to: '[email protected]',
},
run_at: '2026-10-20T09:15:00Z',
idempotency_key: 'receipt-ord_4412',
});result = client.jobs.create(
queue="emails",
handler="send-receipt",
payload={
"order_id": "ord_4412",
"to": "[email protected]",
},
run_at="2026-10-20T09:15:00Z",
idempotency_key="receipt-ord_4412",
)result, err := client.Jobs.Create(ctx, &sextant.JobCreateParams{
Queue: "emails",
Handler: "send-receipt",
Payload: map[string]any{
"order_id": "ord_4412",
"to": "[email protected]",
},
RunAt: "2026-10-20T09:15:00Z",
IdempotencyKey: "receipt-ord_4412",
})
if err != nil {
return err
}Responses
The job was created.
{
"id": "job_8f3k2m9q",
"queue": "emails",
"handler": "send-receipt",
"state": "queued",
"priority": 5,
"payload": {
"order_id": "ord_4412",
"to": "[email protected]"
},
"attempt": 0,
"max_attempts": 5,
"run_at": "2026-10-20T09:15:00Z",
"created_at": "2026-10-20T09:14:58Z",
"idempotency_key": "receipt-ord_4412"
}A job with this idempotency key already exists; it is returned unchanged.
{
"id": "job_8f3k2m9q",
"queue": "emails",
"handler": "send-receipt",
"state": "queued",
"priority": 5,
"payload": {
"order_id": "ord_4412",
"to": "[email protected]"
},
"attempt": 0,
"max_attempts": 5,
"run_at": "2026-10-20T09:15:00Z",
"created_at": "2026-10-20T09:14:58Z",
"idempotency_key": "receipt-ord_4412"
}Validation failed, for example an unknown queue.
{
"error": {
"code": "validation_failed",
"message": "queue 'emial' does not exist",
"param": "queue",
"request_id": "req_c1f0a2"
}
}List jobs
GET/jobs
Returns jobs newest first, with cursor pagination.
Required scope jobs:read
Query parameters
50 next_cursor of the previous page.Request
curl https://api.sextant.example/v2/jobs?limit=20 \
-H "Authorization: Bearer $SEXTANT_TOKEN"const result = await sextant.jobs.list({
limit: 20,
});result = client.jobs.list(limit=20)result, err := client.Jobs.List(ctx, &sextant.ListParams{Limit: 20})
if err != nil {
return err
}Responses
A page of jobs.
{
"data": [
{
"id": "job_8f3k2m9q",
"queue": "emails",
"handler": "send-receipt",
"state": "failed",
"priority": 5,
"payload": {
"order_id": "ord_4412",
"to": "[email protected]"
},
"attempt": 2,
"max_attempts": 5,
"run_at": "2026-10-20T09:15:00Z",
"created_at": "2026-10-20T09:14:58Z",
"idempotency_key": "receipt-ord_4412",
"last_error": {
"code": "handler_error",
"message": "SMTP 451: mailbox busy",
"at": "2026-10-20T09:15:03Z"
},
"next_run_at": "2026-10-20T09:15:33Z"
}
],
"next_cursor": "cur_Xk92"
}Retrieve a job
GET/jobs/{job_id}
Returns one job with its last error, if any. Use the runs endpoint of the CLI or the dashboard for the full attempt history.
Required scope jobs:read
Path parameters
Request
curl https://api.sextant.example/v2/jobs/job_8f3k2m9q \
-H "Authorization: Bearer $SEXTANT_TOKEN"const result = await sextant.jobs.get('job_8f3k2m9q');result = client.jobs.get("job_8f3k2m9q")result, err := client.Jobs.Get(ctx, "job_8f3k2m9q")
if err != nil {
return err
}Responses
The job.
{
"id": "job_8f3k2m9q",
"queue": "emails",
"handler": "send-receipt",
"state": "failed",
"priority": 5,
"payload": {
"order_id": "ord_4412",
"to": "[email protected]"
},
"attempt": 2,
"max_attempts": 5,
"run_at": "2026-10-20T09:15:00Z",
"created_at": "2026-10-20T09:14:58Z",
"idempotency_key": "receipt-ord_4412",
"last_error": {
"code": "handler_error",
"message": "SMTP 451: mailbox busy",
"at": "2026-10-20T09:15:03Z"
},
"next_run_at": "2026-10-20T09:15:33Z"
}No such job.
{
"error": {
"code": "not_found",
"message": "job_8f3k2m9q not found",
"request_id": "req_77ab01"
}
}Cancel a job
POST/jobs/{job_id}/cancel
Cancels a scheduled or queued job. A running job receives a cancellation signal and is marked cancelled once its handler returns; finished jobs cannot be cancelled.
Required scope jobs:write
Path parameters
Request
curl -X POST https://api.sextant.example/v2/jobs/job_8f3k2m9q/cancel \
-H "Authorization: Bearer $SEXTANT_TOKEN"const result = await sextant.jobs.cancel('job_8f3k2m9q');result = client.jobs.cancel("job_8f3k2m9q")result, err := client.Jobs.Cancel(ctx, "job_8f3k2m9q")
if err != nil {
return err
}Responses
The job, now cancelled (or still running if the signal is pending).
{
"id": "job_8f3k2m9q",
"queue": "emails",
"handler": "send-receipt",
"state": "cancelled",
"priority": 5,
"payload": {
"order_id": "ord_4412",
"to": "[email protected]"
},
"attempt": 0,
"max_attempts": 5,
"run_at": "2026-10-20T09:15:00Z",
"created_at": "2026-10-20T09:14:58Z",
"idempotency_key": "receipt-ord_4412"
}The job already finished.
{
"error": {
"code": "invalid_state",
"message": "job is succeeded",
"request_id": "req_09de5c"
}
}Retry a job
POST/jobs/{job_id}/retry
Puts a failed or dead job back in its queue with a fresh attempt counter.
Required scope jobs:write
Path parameters
Request
curl -X POST https://api.sextant.example/v2/jobs/job_8f3k2m9q/retry \
-H "Authorization: Bearer $SEXTANT_TOKEN"const result = await sextant.jobs.retry('job_8f3k2m9q');result = client.jobs.retry("job_8f3k2m9q")result, err := client.Jobs.Retry(ctx, "job_8f3k2m9q")
if err != nil {
return err
}Responses
The job was re-queued.
{
"id": "job_8f3k2m9q",
"queue": "emails",
"handler": "send-receipt",
"state": "queued",
"priority": 5,
"payload": {
"order_id": "ord_4412",
"to": "[email protected]"
},
"attempt": 0,
"max_attempts": 5,
"run_at": "2026-10-20T09:15:00Z",
"created_at": "2026-10-20T09:14:58Z",
"idempotency_key": "receipt-ord_4412"
}The job is not failed or dead.
{
"error": {
"code": "invalid_state",
"message": "job is running",
"request_id": "req_5b3e90"
}
}