# POST /mail/queue/{id}/deliver

First published 14 Oct 2026 (release 0.2.0) · Unchanged since publication

UrbeStack release 0.2.35 API operation in the mail group.

Request immediate delivery of a queued message

- Who may call it: administrator
- Token scope, any of: mail, all
- Answers: 200 OK

UrbeStack asks Postfix to attempt delivery immediately. With trace=true, UrbeStack temporarily adds the next-hop hosts to Postfix's debug_peer_list and reloads Postfix. The next hops are the sender domain's smarthost, the server's smarthost, or the MX hosts for each recipient domain. UrbeStack removes the temporary entries regardless of the outcome.

The traced request follows the attempt in the mail log for up to wait seconds. Its delivery object includes every SMTP command and reply captured and each recipient's status line. Poll GET /mail/queue/{id}/deliver to read the trace while the request is in progress.

The API returns 400 if id falls outside the required format of 6 to 20 uppercase hexadecimal characters or wait falls outside the allowed whole-number range.

## As a command

- [urbestack-mail-queue-deliver](https://urbestack.com/docs/commands/urbestack-mail-queue-deliver.md): Asks Postfix to attempt delivery of one queued message immediately using postqueue -i.

## Parameters

- `id` (path, string, matching ^[A-F0-9]{6,20}$, required)

## Request body

JSON.

- `trace` (boolean): Whether to follow the delivery attempt in the mail log and return its SMTP conversation and per-recipient status lines. The default is false, which requests delivery without tracing it.
- `wait` (integer, 1 to 300): Maximum number of seconds to follow a traced attempt, from 0 to 300. If omitted, UrbeStack uses mail_deliver_wait, which defaults to 60 seconds.

## Example

Set $API to the base URL and $TOKEN to the token, as the [API overview](https://urbestack.com/docs/api.md) shows.

```
curl -sS -X POST "$API/mail/queue/1/deliver" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "trace": true,
    "wait": 1
  }'
```

Response, 200 OK:

```
{
  "delivery": {
    "before": {
      "attempt_count": 1,
      "attempts": [
        {
          "at": "text",
          "delay": 1,
          "dsn": "text",
          "relay": "text",
          "reply": "text",
          "status": "active",
          "to": "text"
        }
      ],
      "hops": [
        "text"
      ],
      "last_at": "text",
      "last_reply": "text",
      "last_status": "text",
      "log_lines": [
        "text"
      ],
      "message": {
        "arrival_time": 1,
        "forced_expire": 1,
        "id": 1,
        "queue": "text",
        "recipients": [
          {
            "address": "info@example.com",
            "delay_reason": "text"
          }
        ],
        "sender": "text",
        "size": 1
      },
      "next_hop": "text",
      "read_at": "text",
      "subject": "text",
      "subjects_logged": true
    },
    "delivering": true,
    "done": true,
    "hops": [
      "text"
    ],
    "id": 1,
    "lines": [
      {
        "at": "text",
        "dir": "out",
        "pid": 1,
        "text": "text"
      }
    ],
    "noise": 1,
    "read_at": "text",
    "results": [
      {
        "at": "text",
        "delay": 1,
        "dsn": "text",
        "relay": "text",
        "reply": "text",
        "status": "active",
        "to": "text"
      }
    ],
    "running": true,
    "traced": true,
    "wait": 1,
    "waited": 1
  }
}
```

## Errors

- 400: --id is required
- 400: <what> must be a whole number from 0 to <max>
- 400: A queue id is 6 to 20 uppercase hexadecimal characters
- 400: Invalid boolean
- 400: The mail stack is not installed on this server
- 401: Authentication required
