Sandbox
Simulate the warehouse operator actions you can’t trigger yourself, so you can test your integration end-to-end while you build.
Some things that happen to your mailbox are done by USGM operators in the warehouse, on physical mail — not by you through the API. Two in particular:
- Mail arriving. New mail items appear when an operator receives and logs a physical piece.
- A scan being performed. When you request a scan, an operator physically scans the item; only then
does the scan reach
COMPLETEDwith a downloadable file.
In production there’s no API to make those happen — they’re real-world actions. But while you’re building against the sandbox, there’s no warehouse and no physical mail, so you’d have nothing to list, scan, or ship. The sandbox module fills that gap: a small set of endpoints that let you simulate the operator’s side so you can exercise your whole integration without waiting on real mail.
These endpoints exist only on the sandbox (https://api-sandbox.usglobalmail.com, with a
usgmk_test_… key). They return 404 on production — there is no operator to fake there.
Seed mailbox
POST /v1/sandbox/seed — populate your sandbox mailbox with a ready-made set of sample mail items in
one call. Takes no body; returns the ids of everything it created.
Use it once at the start of a test run to get a populated inbox to list, filter, organize, and scan.
Seed mail
POST /v1/sandbox/seed/mail — add a single mail item, shaped to the case you’re testing. Every
field is optional; omit the body entirely to get a sample letter.
The mail_type matters: LETTER and LARGELETTER accept a flat SCAN_REQUEST, while the bulkier
types accept an UNBOXING_REQUEST (open-and-scan) — so seed the type that matches the scan flow
you want to test.
Complete scan
POST /v1/sandbox/scans/{id}/complete — force one of your pending scan requests to COMPLETED,
standing in for the operator who would physically scan the item. Pass the scan’s id in the path.
The sandbox has no scanning AI, so the body (optional) lets you supply the label and summary the AI
would normally generate — handy for exercising the scan’s label field and the
GET /v1/scans/{id}/summary endpoint.
The response is the completed scan, now with a downloadable file.
Putting it together
A typical end-to-end test drives your integration through the full scan lifecycle — you play both sides:
Request a scan
POST /v1/scans with that mail_id → returns a scan in a pending status. (Your real integration code.)
Steps 2 and 4 are your actual production code paths — only steps 1 and 3 use sandbox-only endpoints. When you move to production, drop the two simulation calls; real mail and real scans take their place.