A shipping label API for USPS, FedEx & Canada Post
Three endpoints. Quote a rate, buy the label, listen for the webhook. We pool the carrier accounts so you skip the paperwork — you write one integration and ship US→US on USPS and FedEx, or CA→CA on Canada Post, from a single wallet.
The PDF is the same spec you're reading here — portable, email-able, printable. Keys are still issued by hand after a short intro chat on the support page. Mention "API access" and a couple of details about your store.
Need something we don't ship out of the box?
USPS, FedEx, and Canada Post are what's ready to plug in today — keys issued, docs written, wallet-funded. We also build custom API integrations on request:
- DHL Express international (direct MyDHL account)
- FedEx International Priority / Economy DDP + DDU
- UPS Worldwide Saver / Expedited on a dedicated child account
- Canada Post International + tracked packet routes
- Asendia, GlobalPost, DHL eCommerce pooled first-mile / DDU pipes
- White-label label generation on your own domain
- Merchant sub-account provisioning (pooled billing under one master)
- Custom customs / commercial-invoice pipelines
- Bulk / multi-box / MPS flows tuned to your fulfillment stack
Anything weird, anything niche, anything your current provider says "no" to — just ask. Reach out on the support page and we'll spec it with you.
Three carriers, one auth
You don't open a USPS, FedEx, or Canada Post account. You use ours. We negotiated the contracts so the rates you see back are what most small stores can't get on their own.
Predictable shape
Every response carries a request_id. Every error has a short string code from a finite list (see below). No sprawling nested error trees. No surprise field changes.
Crypto-funded wallet
Top up with Bitcoin, Litecoin, or 100+ other coins through the same wallet our website checkout uses. Every label purchase deducts atomically — no card holds, no monthly invoice surprise. Failed carrier calls auto-refund.
Quickstart
Below is the entire integration, end to end. If you can run curl from your shell, you can ship a real package in about a minute once your key is active.
Base URL — use this exactly as written
Every endpoint is hosted on our Supabase Edge network. Point your client at:
https://dbudgkgovfbwyvzvyvgv.supabase.co/functions/v1Full endpoint reference — append any of these to the base URL above:
| Purpose | Method | Path |
|---|---|---|
| Quote a rate | POST | /api-v1-rates |
| Buy a label | POST | /api-v1-labels |
| Re-fetch a label by tracking | GET | /api-v1-label-get?tracking={code} |
| List past shipments | GET | /api-v1-shipments |
| Fetch label PDF (signed) | GET | /api-v1-label-pdf?token={token} |
| Fire a test webhook | POST | /api-v1-webhook-test |
A friendlier api.bitcoinshippinglabels.com host will proxy to these endpoints in a future release — when it goes live, the paths stay identical, only the hostname changes.
1. Quote a rate — POST /functions/v1/api-v1-rates
Send the from/to addresses and a parcel. Both addresses must share a country:
US → US fans out to USPS and FedEx. CA → CA fans out to Canada Post.
Prices are already marked up — what you see is what gets billed.
US → US example
curl https://dbudgkgovfbwyvzvyvgv.supabase.co/functions/v1/api-v1-rates \ -H "Authorization: Bearer sk_live_..." \ -H "Content-Type: application/json" \ -d '{ "from": { "name": "Acme", "street1": "417 Montgomery St", "city": "San Francisco", "state": "CA", "zip": "94104", "country": "US", "phone": "4155551234" }, "to": { "name": "Jordan Lee", "street1": "1600 Pennsylvania Ave NW", "city": "Washington", "state": "DC", "zip": "20500", "country": "US", "phone": "2025551234" }, "parcel": { "length": 9, "width": 6, "height": 2, "weight_oz": 14 } }'{ "rates": [ { "rate_id": "bsl_rate_...", "carrier": "USPS", "service": "GroundAdvantage", "est_delivery_days": 3, "cost_usd": 7.49 }, { "rate_id": "bsl_rate_...", "carrier": "USPS", "service": "Priority", "est_delivery_days": 2, "cost_usd": 10.62 }, { "rate_id": "bsl_rate_...", "carrier": "FedEx", "service": "FEDEX_GROUND", "est_delivery_days": 3, "cost_usd": 21.88 }, { "rate_id": "bsl_rate_...", "carrier": "FedEx", "service": "FEDEX_2_DAY", "est_delivery_days": 2, "cost_usd": 45.10 } ], "shipment_id": "bsl_shp_...", "request_id": "req_..."
}CA → CA example (Canada Post)
curl https://dbudgkgovfbwyvzvyvgv.supabase.co/functions/v1/api-v1-rates \ -H "Authorization: Bearer sk_live_..." \ -H "Content-Type: application/json" \ -d '{ "from": { "name": "North Depot", "street1": "150 Elgin St", "city": "Ottawa", "state": "ON", "zip": "K2P 1L4", "country": "CA", "phone": "6135551234" }, "to": { "name": "Alex Tremblay", "street1": "1055 Rue University", "city": "Montreal", "state": "QC", "zip": "H3B 2A2", "country": "CA", "phone": "5145559876" }, "parcel": { "length": 9, "width": 6, "height": 2, "weight_oz": 14 } }'{ "rates": [ { "rate_id": "bsl_rate_...", "carrier": "CanadaPost", "service": "RegularParcel", "est_delivery_days": 4, "cost_usd": 13.44 }, { "rate_id": "bsl_rate_...", "carrier": "CanadaPost", "service": "ExpeditedParcel","est_delivery_days": 2, "cost_usd": 16.90 }, { "rate_id": "bsl_rate_...", "carrier": "CanadaPost", "service": "Xpresspost", "est_delivery_days": 2, "cost_usd": 22.55 } ], "shipment_id": "bsl_shp_...", "request_id": "req_..."
}2. Buy the label — POST /functions/v1/api-v1-labels
Pass the shipment_id + rate_id back. Send an Idempotency-Key tied to your own order ID — a flaky network never charges you twice, and the same key always returns the same label later.
curl https://dbudgkgovfbwyvzvyvgv.supabase.co/functions/v1/api-v1-labels \ -H "Authorization: Bearer sk_live_..." \ -H "Idempotency-Key: order-12345" \ -H "Content-Type: application/json" \ -d '{ "shipment_id": "bsl_shp_...", "rate_id": "bsl_rate_..." }'{ "tracking_code": "9400111899223344556677", "label_url": "https://dbudgkgovfbwyvzvyvgv.supabase.co/functions/v1/api-v1-label-pdf?token=bsl_lbl_...", "carrier": "USPS", "service": "GroundAdvantage", "cost_usd": 7.49, "wallet_balance_usd": 142.11, "request_id": "req_..."
}Wallet mechanics: we atomically deduct cost_usd before hitting the carrier. If the carrier fails, we auto-refund your wallet in the same request and return 502 carrier_unavailable. You never lose credits to a failed purchase.
3. Re-fetch a label — GET /functions/v1/api-v1-label-get?tracking={tracking_code}
Lost the response? Every successful purchase is mirrored to your merchant dashboard at /api-dashboard, and you can always pull a fresh signed PDF URL programmatically:
curl "https://dbudgkgovfbwyvzvyvgv.supabase.co/functions/v1/api-v1-label-get?tracking=9400111899223344556677" \ -H "Authorization: Bearer sk_live_..."Returns tracking_code, label_url (fresh 180-day token),carrier, service, and current status. Works months after the original purchase.
Required fields — read this first
Domestic only. From and to must share a country — either both US (routes to USPS and FedEx) or both CA (routes to Canada Post). Cross-border requests return 400 invalid_request. The biggest gotcha: phone is required on both addresses. FedEx and UPS silently refuse to rate without a real 10-digit number, so we enforce it up front instead of letting your request return partial results.
| Field | Required? | Notes |
|---|---|---|
| from.street1 / to.street1 | Required | Street address line 1. |
| from.city / to.city | Required | |
| from.state / to.state | Required | 2-letter code. US state (e.g. CA) or CA province (e.g. ON, QC, BC). |
| from.zip / to.zip | Required | US: 5-digit or ZIP+4. CA: 6-character postal code, e.g. K2P 1L4. |
| from.phone / to.phone | Required | 10 digits. FedEx and UPS reject rate requests without one. Hyphens/spaces are stripped. |
| from.country / to.country | Optional | Defaults to US. Must be US or CA, and both addresses must match. |
| from.name / to.name | Optional | Defaults to "Shipper" / "Recipient". Pass a real name for cleaner labels. |
| from.street2 / to.street2 | Optional | Apt / suite / unit. |
| parcel.weight_oz | Required* | Total weight in ounces. Hard cap 1120 oz (70 lb). *Optional when parcel.predefined_package is a USPS flat-rate package — we default to 200 oz (12.5 lb) for flat-rate boxes and 16 oz (1 lb) for flat-rate envelopes; the price is flat up to 70 lb anyway. USPS still weighs every package and refuses anything over 70 lb. |
| parcel.length / width / height | Required* | Inches. Positive numbers, 1 in or higher. *Optional if parcel.predefined_package is set (US route only). |
| parcel.predefined_package | Optional | US route only. Locks the request to a single carrier's flat-rate packaging (see list below). Ignored on CA route. |
Flat-rate packages (US route only)
Set parcel.predefined_package when you're using carrier-branded packaging — the request is locked to that carrier and dimensions become optional. Weight is optional too: for USPS flat-rate packages the price is flat up to 70 lb, so if you omit weight_oz we default it to 200 oz (12.5 lb) for flat-rate boxes and 16 oz (1 lb) for flat-rate envelopes. Must be genuine USPS-branded packaging — a plain box of the same size gets billed as regular Priority and adjusted later. Canada Post rates on this API are always dimension-based; no predefined packages are supported on the CA route.
| Value | Package |
|---|---|
| FlatRateEnvelope | USPS flat-rate envelope |
| FlatRateLegalEnvelope | USPS legal flat-rate envelope |
| FlatRatePaddedEnvelope | USPS padded flat-rate envelope |
| SmallFlatRateEnvelope | USPS small flat-rate envelope |
| FlatRateWindowEnvelope | USPS window flat-rate envelope |
| SmallFlatRateBox | USPS small flat-rate box |
| MediumFlatRateBox | USPS medium flat-rate box |
| LargeFlatRateBox | USPS large flat-rate box |
| FedExEnvelope | FedEx envelope |
| FedExPak | FedEx pak |
| FedExBox | FedEx box |
| FedExSmallBox | FedEx small box |
| FedExMediumBox | FedEx medium box |
| FedExLargeBox | FedEx large box |
| FedExExtraLargeBox | FedEx extra-large box |
| FedExTube | FedEx tube |
Carrier-specific rules to know
- PO Boxes: USPS only. FedEx silently returns no rates for a PO Box destination — you'll see a
messagesentry explaining why. Canada Post can deliver to Canadian PO boxes at Regular / Expedited service levels. - APO / FPO / DPO & military states (AA, AE, AP): USPS only.
- Alaska / Hawaii / Puerto Rico: Both US carriers service these, but expect carrier surcharges on these zones.
- Canadian territories (YT / NT / NU): Canada Post reaches them, but delivery days extend and Xpresspost may fall back to Expedited.
- Min dimensions: FedEx silently drops sub-1-inch dimensions. Keep length / width / height at 1 in or higher.
- Max weight: 70 lb (1120 oz) is our hard cap on this endpoint across all carriers.
- Residential vs commercial: Auto-detected from the destination. v1 doesn't let you override it.
- Signature, Saturday delivery, insurance, pickup: Not in v1.
When a carrier returns zero rates
We never silently drop carriers. If USPS comes back with rates but FedEx doesn't, your 200 response includes a messages array explaining exactly why — safe to log, safe to show your end users.
{ "rates": [ /* USPS rates here */ ], "shipment_id": "bsl_shp_...", "messages": [ { "carrier": "FedEx", "code": "carrier_no_rates", "detail": "FedEx: address not eligible. PO Box destinations are not supported by FedEx." } ], "request_id": "req_..."
}List past shipments — GET /functions/v1/api-v1-shipments
Paginated history of every label your key has purchased. Filter by carrier, page with an ISO cursor. Great for reconciliation jobs.
curl "https://dbudgkgovfbwyvzvyvgv.supabase.co/functions/v1/api-v1-shipments?limit=25&carrier=USPS" \ -H "Authorization: Bearer sk_live_..."Query params: limit (1–100, default 25), cursor (ISO timestamp, returns rows older than this), carrier (USPS, FedEx, or CanadaPost). Response includes has_more and next_cursor for the next page.
Webhooks
Register a single HTTPS endpoint and we'll POST events as they happen. Every payload is signed with HMAC-SHA256 over the raw body using your webhook secret — verify it before trusting anything.
POST https://your-server.com/webhooks/bsl
X-BSL-Event: label.created
X-BSL-Signature: sha256=... { "event": "label.created", "created_at": "2026-07-19T14:02:11Z", "data": { "tracking_code": "9400111899223344556677", "label_url": "https://dbudgkgovfbwyvzvyvgv.supabase.co/functions/v1/api-v1-label-pdf?token=bsl_lbl_...", "carrier": "USPS", "service": "GroundAdvantage", "cost_usd": 7.49 }
}Current events: label.created, label.refunded, webhook.test. Fire a test payload from your dashboard, or via POST /functions/v1/api-v1-webhook-test. More events can be added on request.
Auth & keys
Format: sk_live_<64 hex chars>. Pass it on every request as Authorization: Bearer sk_live_.... We store only the SHA-256 hash — the raw value is shown to you exactly once on creation. Save it in your secret manager.
Error contract
Every error looks like { error: { code, message, request_id } }. The code is short, stable, and safe to switch on. The full list:
| code | HTTP | When |
|---|---|---|
| unauthorized | 401 / 403 | Missing, invalid, revoked, or inactive API key. |
| invalid_request | 400 | Body or address fields failed validation, or a cross-border route was requested. |
| test_mode_blocked | 403 | sk_test_ key tried to purchase a label. Use sk_live_. |
| billing_not_configured | 402 | Your API account isn't linked to a wallet yet. Contact support. |
| insufficient_credits | 402 | Wallet balance is below the marked-up rate. Top up and retry. |
| carrier_unavailable | 502 | USPS, FedEx, or Canada Post returned an error or no eligible rate. |
| not_found | 404 | Tracking code, shipment, or label token not found for this merchant. |
| carrier_no_rates | 200 (in messages) | One carrier returned rates but another didn't. Full 200 response with a messages array — never a hard error. |
| internal_error | 500 | Something broke on our side. Retry with backoff. |
What v1 covers (and what it doesn't)
Supported
USPS Ground Advantage, Priority Mail, Priority Mail Express
FedEx Ground, Express Saver, 2Day, Standard Overnight, Priority Overnight
Canada Post Regular Parcel, Expedited Parcel, Xpresspost, Priority
4x6 PDF labels (auto-normalized for thermal printers) via signed URL
Idempotent purchases via Idempotency-Key
US→US and CA→CA domestic routes
Atomic wallet debit with auto-refund on carrier failure
Signed webhooks for label.created and label.refunded
Not in v1 (available as custom builds)
Cross-border and international labels (DHL Express, FedEx Intl, UPS Worldwide — ask us)
UPS domestic on the public API (contact us for a dedicated UPS integration)
Signature required, adult signature, Saturday delivery
Driver pickup requests
Bulk / multi-box / commercial invoices (available as a custom pipe)
SMS or email recipient notifications
Rate limits
60 requests/minute and 10 concurrent label purchases per key by default. Hit the ceiling and you get a 429 with a Retry-After header. Need more for a launch or a peak day? Just message us — we'll bump you.
Ready to wire it up?
Keys are issued by hand. We chat for a few minutes, learn what you're shipping, and email your sk_live + sk_test the same day. No contracts, no minimums.