Skip to content

API reference

Last updated 

Every operation has its own page in the sidebar. This page is what is true of all of them.

Endpoint

Every path below is relative to the base URL:

https://api.spooler.sh/v1

The spoolersh/memspoold image serves the same API on http://localhost:8080/v1.

Authentication

Every operation authenticates with an API key from the console, presented as a bearer token:

Authorization: Bearer <key>

A missing or bad key fails with 401; a suspended account with 402. Keys never travel in query strings.

Addressing

Every operation names one of your spools: /spools/{spool}/… (the quickstart uses default). Queue operations address /queues/{queue} under it. Ack, nack, renew, recover, and discard are spool-scoped — the lease already names the queue, so a wrong queue is unrepresentable. Name rules are in limits.

Bodies

A send's request body is the payload — raw application/octet-stream, Content-Length required (411 without it). A receive's or peek's response body is the payload; message attributes ride Spooler-* response headers. Everything else is JSON in, JSON out. There is no envelope and no base64.

Spooler-* headers

Message attributes travel as Spooler-* headers. Each operation accepts only the headers it defines: any other fails with 400 kind unknown_header — a typo is refused, never silently ignored.

HeaderDirectionOperations
Spooler-Dedup-HashrequestSend a message
Spooler-Dedup-StringrequestSend a message
Spooler-DelayrequestSend a message
Spooler-LeaseresponseReceive a message, Peek the oldest failed message
Spooler-Lease-Expires-AtresponseReceive a message
Spooler-Message-IdresponseReceive a message, Peek the oldest failed message
Spooler-Retry-CountresponseReceive a message, Peek the oldest failed message

Durations are Go duration strings (500ms, 5s, 1m30s, 168h); timestamps are RFC 3339 UTC.

Responses

200 carries a body; 201 means created or durably appended; 204 means done with nothing to say (an ack, a delete, an empty receive). Errors are JSON {"error", "kind"} — match on the status and kind, see errors. 429 carries Retry-After (see limits); 503 means the spool is momentarily unavailable — retry.

Operations

All 13 operations:

Queues

PUT /spools/{spool}/queues/{queue}Create a queue
PATCH /spools/{spool}/queues/{queue}Update queue settings
DELETE /spools/{spool}/queues/{queue}Delete a queue
GET /spools/{spool}/queuesList queues
GET /spools/{spool}/statsGet spool stats

Messages

POST /spools/{spool}/queues/{queue}/sendSend a message
POST /spools/{spool}/queues/{queue}/recvReceive a message
POST /spools/{spool}/ackAcknowledge a processed message
POST /spools/{spool}/nackRequeue a message for retry
POST /spools/{spool}/renewRenew a lease
POST /spools/{spool}/discardDiscard a message

Failure queue

GET /spools/{spool}/queues/{queue}/failures/headPeek the oldest failed message
POST /spools/{spool}/recoverRecover a failed message