# Queues

Queues are the core organizational unit in Zeplo. Each queue processes HTTP requests independently and tracks execution results.

### Queue types

- **Standard** — Requests are processed as fast as possible. Best for most use cases.
- **FIFO** — Requests are processed in the order they're received. Use when ordering matters.

### Creating a queue

```bash
curl -X POST "https://api.zeplo.io/workspaces/YOUR_WORKSPACE_ID/queues" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "order-webhooks",
    "type": "standard"
  }'
```

**Response:**

```json
{
  "id": "q_abc123",
  "name": "order-webhooks",
  "type": "standard",
  "status": "active",
  "created": "2026-02-25T12:00:00Z"
}
```

### Queue status

Queues can be **active** or **paused**.

- **Active** — Requests are processed normally.
- **Paused** — New requests are accepted but not processed until the queue is resumed.

### Pausing and resuming

```bash
# Pause
curl -X PATCH "https://api.zeplo.io/workspaces/WS_ID/queues/QUEUE_ID" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"status": "paused"}'

# Resume
curl -X PATCH "https://api.zeplo.io/workspaces/WS_ID/queues/QUEUE_ID" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"status": "active"}'
```

### Queue metrics

The dashboard shows real-time metrics for each queue:

- **Request count** — Total requests processed
- **Success rate** — Percentage of requests that returned 2xx
- **Error rate** — Percentage of failed requests
- **Avg response time** — Average execution time in milliseconds
- **Last activity** — Timestamp of the most recent request

### Deleting a queue

```bash
curl -X DELETE "https://api.zeplo.io/workspaces/WS_ID/queues/QUEUE_ID" \
  -H "Authorization: Bearer YOUR_TOKEN"
```

Deleting a queue cancels all pending requests and removes the queue from your workspace.
