Skip to content

postscanmail

Use when working with PostScanMail virtual mailbox API — fetching mail items, managing auto-scan rules, or checking for incoming physical mail. Also use when integrating a CMRA virtual mailbox.

ModelSource
sonnetpack: mail
Full Reference

┏━ 🔧 postscanmail ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓ ┃ PostScanMail — virtual mailbox, scan, forward ┃ ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛

Virtual mailbox management via PostScanMail API — listing mail items, managing auto-scan rules, polling for new mail.

ItemValue
API basehttps://api.postscanmail.com/api/account-docs/v2
Authx-api-key header
SandboxNone — all requests hit production
Rate limit250 req/window; Retry-After: 60 on 429
PaginationPage-based, 20 items/page fixed (no per_page param)
Date filteringClient-side only — no server-side date params
v1 statusDeprecated — returns 410 Gone
DocWhat’s inside
reference/items.mdGET /items, response shape, empty mailbox edge case, PDF download
reference/rules.mdGET/PUT auto-scan rules endpoints, rule meanings, request/response shapes
reference/integration.mdPolling strategy, rate limit handling, error patterns, security checklist

List mail items (page 1):

Terminal window
curl "https://api.postscanmail.com/api/account-docs/v2/items?page=1" \
-H "x-api-key: $POSTSCAN_API_KEY"

List items sorted oldest-first:

Terminal window
curl "https://api.postscanmail.com/api/account-docs/v2/items?page=1&sort_order=asc" \
-H "x-api-key: $POSTSCAN_API_KEY"

Get auto-scan rules:

Terminal window
curl "https://api.postscanmail.com/api/account-docs/v2/user-defined-rules/system-user-defined-rules" \
-H "x-api-key: $POSTSCAN_API_KEY"

Update a rule:

Terminal window
curl -X PUT "https://api.postscanmail.com/api/account-docs/v2/user-defined-rules/update-system-user-defined-rule" \
-H "x-api-key: $POSTSCAN_API_KEY" \
-H "Content-Type: application/json" \
-d '{"rule_id": 42, "enabled": true}'
  • No sandbox — every request hits live production data
  • Empty mailbox trapdata array contains a string message instead of objects when mailbox is empty; guard before accessing item fields
  • No per_page — always 20 per page, pagination is the only way to get more
  • No server-side filtering — filter by date/status client-side after fetching
MistakeFix
Accessing data[0].mail_id on empty mailboxGuard: if (!Array.isArray(data) || typeof data[0] === 'string') return []
Using v1 endpointsSwitch to v2 — v1 returns 410 Gone
Expecting per_page param to workIt’s ignored; page size is always 20
Filtering by date server-sideFetch pages and filter client-side
Logging raw API keyRedact in all log output