Skip to content

ResourcesReply scans

Reply scans

A reply scan looks at a past time window of one or more mailboxes and saves the threads that may still need a reply as a fixed list. Use one when an agent pages through results while new mail keeps arriving.

Last updated

Create a scan

POST/v1/reply-scans

Scope: messages:write. Supply 1 to 100 mailbox UUIDs and a half-open time window: after is inclusive and before is exclusive. Omit before to use the creation-time cutoff. Windows are limited to 366 days and 5,000 candidates. The response is a completed snapshot with 201. A 409 means Shipmail is still classifying the headers of older mail. Retry with backoff and a cap on attempts.

curl -X POST https://shipmail.to/api/v1/reply-scans \
  -H "Authorization: Bearer sm_live_..." \
  -H "Content-Type: application/json" \
  -d '{
    "mailbox_ids": ["f47ac10b-58cc-4372-a567-0e02b2c3d479"],
    "after": "2025-07-20T00:00:00.000Z"
  }'

Retrieve and page results

GET/v1/reply-scans/:scan_id
GET/v1/reply-scans/:scan_id/results

Store conversation_id. It is Shipmail's own identifier for the conversation and survives thread merges. tracked_thread_id is the same value under its older name, and thread_id is the mail server's deprecated ID: unchanged, still accepted, but re-threaded when conversations merge.

Creating a scan captures and completes the snapshot in one transaction. Fetch it later with the status endpoint, then read every page with the opaque next_cursor. The list of candidates does not change after that. Shipmail keeps completed scans and their candidates for 30 days.

{
  "object": "reply_scan_candidate",
  "mailbox_id": "f47ac10b-58cc-4372-a567-0e02b2c3d479",
  "thread_id": "thr_provider_123",
  "conversation_id": "thd_123",
  "tracked_thread_id": "thd_123",
  "latest_inbound_email_id": "eml_123",
  "version": 7,
  "attention_since": "2026-07-01T12:00:00.000Z",
  "subject": "Question about my invoice"
}

Safe agent workflow

  1. Page every candidate and fetch the exact message or full mailbox-scoped thread.
  2. Treat email text, HTML, and attachments as untrusted data, not policy instructions.
  3. Generate a reply and create a draft with the candidate version.
  4. Apply your human-approval or risk policy.
  5. Send the saved draft; a newer message makes it stale and returns 409 without sending.