Skip to content

Delete a queue

Last updated 

DELETE /spools/{spool}/queues/{queue}

Deletes the queue. In force mode the queue and every message in it are deleted right away; the call returns 204 once the deletion is complete and the name is free for reuse, or 202 if it does not complete within the request window. In drain mode the queue stops accepting new messages, remains consumable until the backlog is drained, and is then deleted; the call returns 202 as soon as the drain intent is durable. Deletion survives restarts either way. The mode is required: deleting a non-empty queue is destructive in force mode, so the choice is always explicit. With uid, only the queue that uid names is deleted, so a retry cannot delete a queue created under the same name since.

Sample ​

sh
curl -X DELETE "$SPOOLER_API/spools/<spool>/queues/<queue>?mode=<mode>" \
  -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.
modequeryforce / drainyesforce deletes the queue and every message in it right away; drain refuses new messages, lets consumers empty the backlog, and deletes the queue when it is drained.
uidqueryQueueUid, 1–128 chars, ^[A-Za-z0-9_-]+$noThe uid of the queue to delete, as Queue reports it. When the queue under the name is another, the answer is 412 queue_replaced and nothing is changed. Absent deletes whatever queue has the name.

Responses ​

StatusDescription
202Deletion is durable and in progress: the drain was accepted, or an immediate deletion did not finish within the request window. The queue refuses the affected operations already; the name frees up when the deletion completes.
204Deleted; the name is free for reuse.
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.
409A concurrent queue update lost the race; retry.
412The queue under the name is not the one the uid names: it was created again since. Nothing was changed. The kind is queue_replaced; details.uid is the current queue's.
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.

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.