Skip to content

Receive a message

Last updated 

POST /spools/{spool}/queues/{queue}/recv

Leases a visible message. wait long-polls until a message becomes visible or the wait elapses (204). The payload returns raw; the lease and message attributes ride Spooler-* response headers. Responses carry Cache-Control no-store. A draining queue keeps serving receives until its backlog empties.

Sample ​

sh
curl -si -X POST "$SPOOLER_API/spools/<spool>/queues/<queue>/recv" \
  -H "Authorization: Bearer $SPOOLER_KEY"

Parameters ​

NameInTypeRequiredDescription
spoolpathIdentName, 1–63 chars, ^[A-Za-z0-9_:-]+$yesThe spool name.
queuepathIdentName, 1–63 chars, ^[A-Za-z0-9_:-]+$yesThe queue name.
waitSecondsqueryinteger, 0–20noSeconds to wait for a message, at most 20; when none comes, the answer is 204. It bounds the wait for a message, not the request: the response can arrive somewhat later. Absent waits the maximum; 0 returns without waiting for one.

Responses ​

StatusDescription
200A message was leased. The body is the payload; Content-Length is its size.
204No message became visible within the wait window.
400The request is malformed; the kind names the problem.
401The API key is missing or not recognized; the kind is unauthenticated.
402The account is suspended; the kind is account_suspended.
403The operation is refused; the kind names why: a plan limit (queue_limit, retention_limit), or account_blocked on any operation when the account is on an abuse hold.
404The spool or queue does not exist; the kind says which.
409Concurrent state refuses the operation; the kind names it.
429The per-account request rate cap is exceeded. The body names the kind (rate_limited); the wait is the Retry-After header and is not repeated in the body. Headers are as structured as the body, and this one is the header HTTP defines for a wait.
503The spool is momentarily unavailable.

200 headers ​

HeaderDescription
Spooler-LeasePresent back to ack, nack or renew.
Spooler-Message-IdThe message's id.
Spooler-Message-RetriesRedeliveries so far; 0 on the first delivery.
Spooler-Message-Created-AtWhen the message was sent (RFC 3339, UTC).
Spooler-Lease-Expires-AtWhen the lease auto-nacks (RFC 3339, UTC). Absent when the queue has no lease timeout.

429 headers ​

HeaderDescription
Retry-AfterSeconds until the next request is admitted, whole and at least 1; always the delay-seconds form, never an HTTP-date.