curl Cookbook

The whole OKMQ API in copy-paste curl — no SDKs, no install, no client library

Setup

Every request authenticates with your API key (Account → API Keys). The key works with or without the Bearer prefix. All examples use https://api.okmq.net as the base URL.

# Set your API key once
export OKMQ="Authorization: Bearer your-api-key"
export BASE="https://api.okmq.net"

Queues — the core loop

# Create a queue
curl -X POST $BASE/queues \\
  -H "$OKMQ" -H "Content-Type: application/json" \\
  -d '{"name": "tasks", "auto_ack": false}'

# Create a queue with retries and TTL (all options optional)
curl -X POST $BASE/queues \\
  -H "$OKMQ" -H "Content-Type: application/json" \\
  -d '{
    "name": "tasks-critical",
    "auto_ack": false,
    "ttl": 3600,
    "max_delivery_attempts": 5,
    "lock_duration": 60,
    "retry_strategy": {
      "type": "exponential",
      "base_delay": 5,
      "max_delay": 300,
      "multiplier": 2.0,
      "jitter": 10
    }
  }'

# List queues
curl $BASE/queues -H "$OKMQ"
# Send one or more messages (JSON array)
curl -X POST $BASE/queues/tasks/messages \\
  -H "$OKMQ" -H "Content-Type: application/json" \\
  -d '[
    {"id": "job-1", "body": "resize photo 123"},
    {"id": "job-2", "body": "generate thumbnail 124", "tag": "images"}
  ]'

# Schedule a message for later (delayed delivery)
curl -X POST $BASE/queues/tasks/messages \\
  -H "$OKMQ" -H "Content-Type: application/json" \\
  -d '[{"id": "reminder-1", "body": "nudge user", "delivery_time": "2026-09-09T09:00:00Z"}]'
# Receive messages (locks them for processing)
curl "$BASE/queues/tasks/messages?limit=10" -H "$OKMQ"

# Receive only messages with a specific tag
curl "$BASE/queues/tasks/messages?tag=images" -H "$OKMQ"

# Peek without locking (doesn't affect delivery)
curl "$BASE/queues/tasks/messages?peek=true" -H "$OKMQ"

# Inspect message states: all | acked | failed | pending | processing | scheduled
curl "$BASE/queues/tasks/messages?peek=true&type=failed" -H "$OKMQ"
# Acknowledge success — message is gone
curl -X POST $BASE/queues/tasks/ack \\
  -H "$OKMQ" -H "Content-Type: application/json" \\
  -d '[{"id": "job-1", "ack": true}]'

# Nack: retry per the queue's retry strategy
curl -X POST $BASE/queues/tasks/ack \\
  -H "$OKMQ" -H "Content-Type: application/json" \\
  -d '[{"id": "job-2", "ack": false}]'

# Nack with a custom retry time (e.g. retry in 30 seconds)
curl -X POST $BASE/queues/tasks/ack \\
  -H "$OKMQ" -H "Content-Type: application/json" \\
  -d '[{"id": "job-2", "ack": false, "delivery_time": "2026-09-08T20:30:00Z"}]'

# Reset all failed messages back to pending
curl -X POST $BASE/queues/tasks/resetfailed -H "$OKMQ"
# Queue stats and housekeeping
curl $BASE/queues/tasks/stats -H "$OKMQ"

# Delete a message
curl -X DELETE $BASE/queues/tasks/messages/job-1 -H "$OKMQ"

# Delete the queue
curl -X DELETE $BASE/queues/tasks -H "$OKMQ"

Topics — fan-out to many queues

Publish to a topic and every queue subscribed to it receives a copy. Subscribe by setting topics on queue creation (see above).

# Publish to a topic — fanned out to all subscribed queues
curl -X POST $BASE/topics/orders/messages \\
  -H "$OKMQ" -H "Content-Type: application/json" \\
  -d '[{"id": "order-1", "body": "{\"sku\": \"A1\", \"qty\": 2}"}]'

Streams — append-only event logs

# Create a stream
curl -X POST $BASE/streams \\
  -H "$OKMQ" -H "Content-Type: application/json" \\
  -d '{"name": "events"}'

# Append events (array, ordered by sequence)
curl -X POST $BASE/streams/events/messages \\
  -H "$OKMQ" -H "Content-Type: application/json" \\
  -d '[
    {"id": "evt-1", "body": "user signed up"},
    {"id": "evt-2", "body": "user upgraded"}
  ]'

# Consume new events (long-polling supported)
curl $BASE/streams/events/messages?limit=100 -H "$OKMQ"
# Commit your offset after processing (single-consumer model)
curl -X POST $BASE/streams/events/commit \\
  -H "$OKMQ" -H "Content-Type: application/json" \\
  -d '{"offset": 42}'

Account

# Quotas and usage
curl $BASE/account -H "$OKMQ"

Machine-readable versions of this page

Full OpenAPI spec: /content/openapi.yaml · Agent docs index: /llms.txt · Pricing: /pricing.md