# GET /mail/trace/by-message-id/{mid}

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

UrbeStack release 0.2.35 API operation in the mail group.

Trace a message by its Message-ID

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

The trace includes the message timeline, recipient statuses, delivery attempts with Postfix's four delays, mailbox delivery and what happened to the mailbox copy afterward, the verdict and findings, and the raw log lines. If several queue IDs share the Message-ID, as can happen when an alias forwards a message, the response traces the newest queue ID in full and lists the others.

Resellers can trace messages only for their own domains and those of their customers. The API returns 400 if mid is empty, exceeds 998 characters, or contains control characters.

## As a command

- [urbestack-mail-trace](https://urbestack.com/docs/commands/urbestack-mail-trace.md): Finds messages in the mail logs and shows what happened to them.

## Parameters

- `mid` (path, string, matching ^<?[^<>\s@]+@[^<>\s@]+>?$, up to 998 characters, required)

## 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 GET "$API/mail/trace/by-message-id/text" \
  -H "Authorization: Bearer $TOKEN"
```

Response, 200 OK:

```
{
  "message": {
    "at": "text",
    "attempt_count": 1,
    "attempts": [
      {}
    ],
    "bounce": {},
    "bounce_id": "text",
    "client": {},
    "client_history": {},
    "client_host": "text",
    "client_ip": "text",
    "connected_at": "text",
    "customer_text": {},
    "direction": "outbound",
    "epoch": 1,
    "findings": [
      {}
    ],
    "forwarded_from": "text",
    "from": "text",
    "header_from": "text",
    "held": true,
    "helo": "text",
    "in_queue": true,
    "kind": "message",
    "logs": {},
    "mailbox": {},
    "message_id": "text",
    "nrcpt": 1,
    "parent": "example.com",
    "parent_row": {},
    "qid": "text",
    "queued_at": "text",
    "ratelimited": {},
    "raw": {},
    "raw_count": 1,
    "read_at": "text",
    "received_at": "text",
    "recipients": [
      {}
    ],
    "reject_code": "text",
    "reject_dsn": "text",
    "reject_reason": "text",
    "reject_stage": "text",
    "relay": "text",
    "removed_at": "text",
    "same_message_id": [
      "text"
    ],
    "sasl": "text",
    "sasl_method": "text",
    "scan": {},
    "script": "text",
    "server_time": "text",
    "service": "text",
    "session_summary": "text",
    "sessions": [
      {}
    ],
    "size": 1,
    "spam": {},
    "spam_pre": {},
    "spam_score": 1,
    "status": "delivered",
    "subject": "text",
    "subjects_logged": true,
    "timeline": [
      {}
    ],
    "timezone": "text",
    "tls": "text",
    "to": [
      "text"
    ],
    "to_more": 1,
    "total_delay": 1,
    "uid": 1,
    "uid_user": "text",
    "verdict": {}
  }
}
```

## Errors

- 400: --q, --id, --message-id, --reverse or --files is required
- 400: <what> must be text without control characters, 1 to <max> characters
- 400: A Message-ID has the shape local@domain
- 400: A queue id is 6 to 20 uppercase hexadecimal characters
- 400: At most 64 addresses at once
- 400: Give an address, a queue id or a Message-ID to search for
- 400: Invalid setting key
- 400: Search for an address, a queue id (6 to 20 uppercase hexadecimal characters) or a Message-ID in angle brackets
- 400: dir is any, sender or recipient
- 401: Authentication required
- 404: No message <qid> in the kept logs
- 404: No message with the Message-ID <<mid>> in the kept logs
- 404: No such user: <owner>
- 404: Setting '<key>' not found
