Hoppa till innehållet

Search the message log

POST/v1/messages/search

TypeScript sendora.messages.search(filters)

Python sendora.messages.search(**filters)

PHP $sendora->messages->search(...$filters)

Java sendora.messages().search(search)

Key sk_… a server key

The messages of the server, newest first, one page at a time. A POST so that an address travels in the body and never in a URL. Messages older than the retention window are gone.

Request body

Every filter is optional; the page is newest first.

{
  "recipient": "anna@example.com",
  "status": "bounced",
  "limit": 20
}
  • recipientstring (at least 3, at most 254 characters)

    Messages to this address, in to, cc or bcc. A whole address matches exactly. Anything else of three characters or more matches anywhere in an address, such as kommun.se.

  • streamIdstring (uuid)

    Messages on this stream of the server.

  • broadcastIdstring (uuid)

    Messages of this broadcast.

  • tagstring (at least 1, at most 100 characters)
  • statusone of 2

    Messages with at least one recipient in this state, or in any of these states.

    1. "queued" | "delivered" | "deferred" | "bounced" | "expired"

      queued until the receiver answers; deferred while it keeps saying try later.

    2. array of "queued" | "delivered" | "deferred" | "bounced" | "expired", at least 1, at most 5
  • fromstring (date-time)

    Submitted at or after this time.

  • tostring (date-time)

    Submitted before this time.

  • limitinteger (1 to 100)default 50

    Page size, 1 to 100.

  • afterstring (uuid)

    The next value of the previous page.

Responses

Every field of a response is always present. A field that can be null says so in its type.

200A page of the messages that match, newest first.

Example (31 lines)
{
  "messages": [
    {
      "messageId": "5f432ffd-c005-499b-aa3a-5b8a088ea20e",
      "streamId": "7c9e6679-7425-40de-944b-e07fc1f90ae7",
      "broadcastId": null,
      "status": "injected",
      "from": "no-reply@example.se",
      "subject": "Your invoice for September",
      "tag": "invoice",
      "metadata": {
        "invoiceId": "2026-0912"
      },
      "submittedAt": "2026-09-15T12:00:00.000Z",
      "test": false,
      "recipients": [
        {
          "address": "anna@example.com",
          "kind": "to",
          "status": "delivered",
          "tracked": true,
          "opens": 2,
          "clicks": 1,
          "firstOpenAt": "2026-09-15T12:03:10.000Z",
          "firstHumanOpenAt": "2026-09-15T12:03:10.000Z"
        }
      ]
    }
  ],
  "next": null
}
  • messagesarray of object
    • messageIdstring (uuid)
    • streamIdstring (uuid)

      The stream the message went on.

    • broadcastIdstring (uuid) or null

      The broadcast the message belongs to; null for a message sent on its own.

    • status"accepted" | "injected" | "failed"

      accepted until handed to the mail server, injected after; failed if that never worked.

    • fromstring
    • subjectstring
    • tagstring or null
    • metadatamap of string to string
    • submittedAtstring (date-time)
    • testboolean

      True when the message went through a test server: its events were simulated and nobody received it.

    • recipientsarray of object
      • addressstring
      • kind"to" | "cc" | "bcc"
      • status"queued" | "delivered" | "deferred" | "bounced" | "expired"

        queued until the receiver answers; deferred while it keeps saying try later.

      • trackedboolean

        Whether tracking applied to this recipient’s copy when it left. It does not say to opens, links or both, or that the HTML held a link to track.

      • opensinteger

        Opens recorded, machines’ included.

      • clicksinteger

        Clicks recorded, machines’ included.

      • firstOpenAtstring (date-time) or null

        The first open, or the first click that was likely a person’s. Null before that.

      • firstHumanOpenAtstring (date-time) or null

        The same, counting only what was likely a person. Null before that.

  • nextstring (uuid) or null

    Pass as after for the next page; null on the last.

Errors

Every error answers error, the code, and message, a sentence for a person. A code that adds fields is shown in full below the table.

CodeStatusMeaning
invalid_request400The body, the query or a header does not match what the route takes.
unauthorized401The key is missing, malformed or revoked.
wrong_token_kind403The key is of the other kind: a server key (sk_) where an account key (ak_) is needed, or the reverse. The message names the kind the operation takes.
not_for_connections403A connected app called an operation that no tool of the MCP server calls. An API key can.
read_only_connection403A connected app may only read here: the account is read only through a connection, and a live server takes changes only if the person allowed them when connecting.
test_server_only403A connected app may create a secret, or do what cannot be undone, on a test server only.
  • WWW-Authenticateheader on 401"Bearer"

    Always Bearer: send the key as Authorization: Bearer <key>.

invalid_request

Example

{
  "error": "invalid_request",
  "message": "The request is invalid: to.0: Invalid email address",
  "issues": [
    {
      "path": "to.0",
      "message": "Invalid email address"
    }
  ]
}
  • issuesarray of object

    One entry per invalid field; absent when a header is wrong.

    • pathstringrequired

      The field, dotted, such as to.0.email; empty when the whole body is wrong.

    • messagestringrequired