lob
Use when working with Lob API for physical mail — sending certified letters, address verification, tracking, or webhook handling. Also use when sending USPS mail programmatically.
| Model | Source |
|---|---|
| sonnet | pack: mail |
Full Reference
┏━ 🔧 lob ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓ ┃ Lob API — physical mail, letters, address verify ┃ ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
Physical mail automation via Lob API — letters, certified mail, address verification, webhooks.
Quick Reference
Section titled “Quick Reference”| Item | Value |
|---|---|
| API base | https://api.lob.com/v1 |
| Auth | HTTP Basic — API key as username, empty password |
| Key prefixes | test_ (sandbox) / live_ (production) |
| Rate limits | 3 req/min (send), 10 req/min (tracking) |
| Letter pricing | From $0.90/letter (Developer plan) |
| Certified surcharge | +$6.70 per letter |
| Certified + return receipt | ~$9.52 surcharge |
| Webhook retries | 8 retries over ~27.5h; auto-disabled after 5 failure days |
Reference Index
Section titled “Reference Index”| Doc | What’s inside |
|---|---|
| reference/letters.md | POST /letters, HTML rendering requirements, tracking events |
| reference/addresses.md | POST /us_verifications, deliverability enum, response shape |
| reference/webhooks.md | Event types, HMAC-SHA256 verification, replay protection |
| reference/pricing.md | Per-plan costs, certified surcharges, address verification pricing |
Common Operations
Section titled “Common Operations”Create a letter:
curl -X POST https://api.lob.com/v1/letters \ -u "YOUR_API_KEY:" \ -d "to[name]=John Smith" \ -d "to[address_line1]=123 Main St" \ -d "to[address_city]=Springfield" \ -d "to[address_state]=IL" \ -d "to[address_zip]=62701" \ -d "from=adr_xxxx" \ -d "file=<html>...</html>" \ -d "color=false"Verify an address:
curl -X POST https://api.lob.com/v1/us_verifications \ -u "YOUR_API_KEY:" \ -d "primary_line=123 Main St" \ -d "city=Springfield" \ -d "state=IL" \ -d "zip_code=62701"Get letter status:
curl https://api.lob.com/v1/letters/ltr_xxxx \ -u "YOUR_API_KEY:"Common Mistakes
Section titled “Common Mistakes”| Mistake | Fix |
|---|---|
| Sending live mail in dev | Use test_ prefixed API key — mail is never printed |
HTML without <html><body> wrapper | Lob requires full HTML document structure |
| Address window area blocked by content | Keep 4” x 1.5” window area clear (see letters.md) |
| Missing webhook timestamp header | Check Lob-Signature-Timestamp, not just Lob-Signature |
| Replay attack window too wide | Reject requests older than 5 minutes |
| Forgetting certified tracking events differ | Certified has additional event types — see webhooks.md |