Through a postal mailing API, you send using First-Class Mail or Certified Mail.
REST API overview
- Base URL
- https://mailmanapi.com/v1
- Draft auth
- None required (or Bearer API key)
- Letter services
- First-Class Mail, Certified Mail, or Certified Mail with electronic Return Receipt
What you need
Write the recipient’s name and the correct mailing address. Use a return address. Please verify the address before sending your mail.
Draft request fields
- to / from
- Recipient and return addresses
- document.text
- Letter text
- document.pdf_base64
- Base64-encoded PDF
- service
- first_class, certified, or certified_err
- Address check
- POST /v1/addresses/verify
Standardized address
A complete address has all the address elements necessary to allow an exact match with the current USPS ZIP+4 Product. The accuracy of the address affects the speed and handling of your mail.
Address check
- Endpoint
- POST /v1/addresses/verify
- Results
- deliverable, corrected (with the corrected address), or undeliverable
Quote, draft, and approve
- Make a draft letter for the Certified Mail service.
- Through the private approval link, pay using one of the available payment methods.
Requests and draft response
- Quote
- POST /v1/quotes
- Create a draft
- POST /v1/mail
- approval_url
- Private page where the payer reviews the letter and exact price and pays
- total_cents
- The draft's exact price in cents
curl https://mailmanapi.com/v1/mail \
-H "Content-Type: application/json" \
-H "Idempotency-Key: certified-notice-0001" \
-d '{
"product": "letter",
"service": "certified_err",
"to": { "name": "R. Okafor", "line1": "700 Poplar St",
"city": "Macon", "state": "GA", "zip": "31201" },
"from": { "name": "Sam Rivera", "line1": "206 Washington St SW",
"city": "Atlanta", "state": "GA", "zip": "30334" },
"document": { "text": "Notice text..." }
}'
Idempotency keys
If the request timed out, the client is left uncertain about whether the resource was created by MailmanAPI. You can reattempt the request with the same idempotency key. A request with the same Idempotency-Key and request body won’t result in multiple resources being created.
Retry rules
- Header
- Idempotency-Key
- Same key and same body
- Returns the original piece
- Same key and a different body
- Refused
Error code
Clients that receive a 422 response should expect that repeating the request without modification will fail with the same error.
JSON error object
- error.code
- Machine-readable reason
- error.message
- What failed
- error.fix
- How to correct it
- error.field
- Input field at fault when applicable
- 422 invalid_request
- Fix the field named in error.field, then send again
- 400 idempotency_key_required
- Add the missing header
- 409 idempotency_mismatch
- Retry with the original body, or use a new key for a different draft
Review and approve
The file that will actually be printed is the PDF preview. The message contained within the draft cannot be edited once created. Once the draft is generated, it can be replaced to make changes.
Review and control endpoints
- Exact print PDF
- GET /v1/mail/{id}/preview
- Cancel draft or hold
- POST /v1/mail/{id}/cancel
- Auto-send (owner-enabled key, monthly cap)
- POST /v1/mail/{id}/approve with approval_hash
Mailing receipt
Certified Mail provides the sender with a mailing receipt. Certified Mail provides electronic verification that a mail piece was delivered or that a delivery attempt was made. Use USPS Tracking® on USPS.com® with your Certified Mail tracking number.
Electronic Return Receipt
A Return Receipt provides evidence of delivery (to whom it was delivered and the date of delivery). Return Receipt (Electronic) is an electronic alternative to the Return Receipt (green postcard).
- Return receipt PDF (downloadable once the signature record is available): GET /v1/mail/{id}/receipt
Test mode
You can test independently from your live integration with test API keys. To test your integration, you can simulate an attempt with named test recipients.
Test recipients and docs
- Test side effects
- No printing, postage, mailing, or charges
- Approve a test draft
- POST /v1/mail/{id}/approve with approval_hash
- Named test recipients
- Test Delivered, Test Returned, Test Print Failure, Test Undeliverable, Test No Scans
After payment
You can cancel the order within 30 minutes. Estimated delivery dates are approximations.
Timing
- Cancellation hold
- 30 minutes after payment, full refund (POST /v1/mail/{id}/cancel)
- After the hold
- Screening, then printing
- USPS handoff
- Usually within 2 business days of payment
- Late handoff or misprint
- Reprint or refund for a misprint or handoff after 2 business days
Starting all-in prices (1 page, black and white)
- First-Class letter
- $1.67
- Certified Mail
- $9.80
- Certified + electronic Return Receipt
- $13.16
Check the status
You can make an API call to MailmanAPI to track the status. If you sent it certified, this will provide a tracking number.
Status and timeline
- Draft access
- Private token from mail_url (t query parameter) or the creating Bearer key
- Certified tracking field
- tracking_number
- Timeline steps
- draft, paid, printed, mailed, in transit, delivered, receipt ready, returned
Refused or unclaimed mail
The addressee may refuse to accept a mailpiece, and then it goes back to the sender. All items are available for pickup at the local Post Office™ until close of business on the applicable return date. Then the item is returned to the sender.
Common questions
What are some Physical Mailing Services with APIs?
With MailmanAPI, you can preview your letter in PDF format before sending it.
Is it possible to track an envelope?
First-Class Mail does not include USPS Tracking®, so send the letter by Certified Mail.
Do you need to know who signed for your mail?
Use Certified Mail with the Electronic Return Receipt option.
Sources: USPS; USPS PostalPro; USPS.