Batteries

Queues

Work that survives the app restarting, and the platform's own events on the same three calls. Postgres underneath rather than a broker, which is why the API is the subset Postgres serves well.

Every call below goes to the address in your SAASIE_ANALYTICS_URL environment variable, with Authorization: Bearer <token>. Read both from the environment — they are injected, and hardcoding either is how an app breaks when the platform moves. See getting the credential.

GET /v1/queues

What is waiting

Every queue with something on it, and how much. A queue with a high inFlight and nothing moving is a consumer that is not acking.

200 — The queues that exist right now

FieldType
queues* object[] —
depth* number —
maxDepth* number —

When it does not work

401Missing or invalid service token
403The Saasie is stopped

POST /v1/queues/_ack

Finish with a message

Deletes it. Ack after the work is done, not before — a message acked and then dropped is work nobody will ever redo.

Request body

FieldType
receipt* string length 1–∞

200 — Whether the receipt still held the lease

FieldType
acked* boolean False when the lease had already lapsed and the message went back on the queue — your work may be done twice. It is not an error.

When it does not work

400Not a receipt
401Missing or invalid service token
403The Saasie is stopped

POST /v1/queues/{queue}

Put a message on a queue

The queue is created by this call if nothing was on it. Payload is anything JSON, and the platform never reads into it.

Request body

FieldType
payload* any Anything JSON. The platform never reads into it.

200 — Where it went and when it lapses

FieldType
id* string —
queue* string —
expiresAt* number When it is dropped if nobody has consumed it by then.

When it does not work

400Not a queue name, or a payload over the size cap
401Missing or invalid service token
403The Saasie is stopped, or this is the events queue
429Too many messages are already waiting

POST /v1/queues/{queue}/consume

Take one message, waiting if there is none

Long-polls for up to ~25 seconds and answers { message: null } if nothing arrives — which is a normal answer, not an error. Call it again in a loop. One message at a time, and it is leased rather than removed until you ack.

200 — A message, or null

FieldType
message* object | null Null when the wait elapsed and the queue was empty.

When it does not work

400Not a queue name
401Missing or invalid service token
403The Saasie is stopped

Generated from openapi.json, which the service renders from its own routes. * marks a required field. Every error body is { "error": { "code", "message", "details"? } }.