Larkspur Docs

HTTP API Reference

The monitoring API listens on 127.0.0.1:7420 by default. All responses are JSON. Write endpoints require Authorization: Bearer <token>.

Queues

GET/v2/queues

List all queues with counters.

{
  "queues": [
    {"name": "emails", "ready": 12, "leased": 3, "failed": 0, "done_24h": 4821}
  ]
}

POST/v2/queues/{name}/pause

Stop leasing new jobs from the queue. In-flight jobs finish normally.

POST/v2/queues/{name}/resume

Resume a paused queue.

Jobs

POST/v2/queues/{name}/jobs

Enqueue a job.

FieldTypeDescription
payloadobjectArbitrary JSON passed to the handler.
run_atRFC 3339Optional scheduled time.
max_attemptsintegerOverrides retry.max_attempts.
unique_keystringDeduplicate jobs with the same key for 24h.
curl -X POST http://127.0.0.1:7420/v2/queues/emails/jobs \
  -H "Authorization: Bearer $LARKSPUR_TOKEN" \
  -d '{"payload":{"to":"ada@example.com"},"max_attempts":5}'

GET/v2/jobs/{id}

Fetch a job, its attempts and the last error.

POST/v2/jobs/{id}/retry

Move a failed or dead job back to the ready state.

DELETE/v2/jobs/{id}

Cancel a pending job. Leased jobs cannot be cancelled.

Workers & health

GET/v2/workers

List connected workers, their hostnames and current leases.

GET/healthz

Returns 200 OK when the store is reachable.

GET/metrics

Prometheus exposition format. Key series: larkspur_jobs_total, larkspur_job_duration_seconds, larkspur_queue_depth.

Errors

StatusCodeMeaning
400invalid_payloadBody is not valid JSON or a field has the wrong type.
401unauthorizedMissing or invalid bearer token.
404not_foundQueue or job does not exist.
409duplicateA job with the same unique_key exists.