Build Shipping Into Your App in a Weekend
Updated
A practical REST tutorial: quote USPS, UPS and FedEx (DHL abroad) in one request, buy a label, store the artifacts, let signed webhooks sync your app.
Get free rate quotes Free account. No card needed.
A minimal shipping integration is four moves: send an address and a parcel to a quote endpoint and get USPS, UPS and FedEx prices back in one response (DHL too on international lanes); buy the quote you want; store the label file and tracking number your app gets back; and stand up one webhook endpoint so shipment updates push to you instead of you polling for them. On GoatLabels the REST API comes with unlimited calls on every plan and pay-per-label pricing, so the weekend version of this project costs you the price of one test label — and this guide walks through all four moves.
What does a minimal shipping integration actually need?
Strip away the enterprise ceremony and a shipping feature is a short contract between your app and the API:
- Your app supplies a destination address, a parcel (weight and dimensions), and — for international — customs items.
- The API supplies validated addresses, carrier quotes with one price per rate, purchased labels, tracking numbers, and event pushes when anything changes.
- Your database keeps its own shipment row per order: the shipment ID, chosen rate, cost, label URL, tracking number, and status.
That's it. You don't need a queue, an orders-sync engine, or a carrier abstraction layer of your own — the API is the abstraction layer. Authentication is an API key in a header; there are no per-request fees and no call quotas to engineer around, which is a deliberate contrast to per-label-fee APIs (the comparison lives at EasyPost alternative with a free API).
Here's the whole weekend, milestone by milestone:
| Milestone | What you call | What your app stores |
|---|---|---|
| 1. Quote a shipment | POST a quote request with address + parcel |
Nothing yet — quotes are free and disposable |
| 2. Buy a label | POST a purchase for the chosen rate |
Shipment ID, carrier, service, cost, label URL, tracking number |
| 3. Serve the artifacts | GET the shipment by ID when you need to re-fetch |
Label PDF path for reprints; tracking number surfaced to the buyer |
| 4. Receive webhooks | Your endpoint; verify the signature on each event | Shipment status transitions; adjustment records with their wallet delta |
| 5. Handle adjustments | shipment.adjustment.created event (also queryable via API) |
The adjustment record linked to its shipment, for true per-order cost |
Exact request and response schemas are in the API docs — this guide is the map, not the reference.
How do you quote several carriers with one request?
The quote endpoint is where a shipping integration stops being intimidating. One request (recipient address, parcel weight, dimensions) returns rate objects for USPS, UPS and FedEx on a domestic parcel, plus DHL on an international one, each carrying a rate ID, the service name, an estimated transit time, and one price. No per-carrier accounts to register, no four integrations wearing a trench coat.
Two behaviors at quote time do real work for you:
- Address validation is built into the quote. The destination is checked for deliverability and badged residential or commercial before you see prices. Your checkout can surface a bad address while the customer is still on the page — the cheapest possible moment to fix it — instead of discovering it as a returned package.
- Extras fold into the price. Insurance is a per-shipment toggle, and a signature requirement is set per shipment; include them in the quote request and the fee shows up inside the quoted price, not as a surprise line on a bill later.
Quotes cost nothing and there's no call quota, so use them liberally: quote at checkout to show live shipping prices, re-quote in your admin view before fulfillment, quote speculatively to build a "lowest-priced option" default. Your only decision is selection logic — lowest-priced rate always, or lowest-priced within a transit-time ceiling. Persist nothing at this stage; a quote you didn't buy is garbage-collectible.
For international destinations, add customs items to the request — description, declared value, origin country, and HS code per item. You supply the HS codes (the API doesn't classify goods for you), and saved customs templates mean your app can attach a stored declaration for repeat products instead of rebuilding it per order.
How do you buy a label and store the artifacts?
Purchase is a second call: take the rate ID your logic (or your user) selected and post the buy. The price is drawn from your prepaid wallet — the same wallet you fund by card — and the response hands back everything your app should keep:
- The shipment ID — your foreign key for everything that follows: re-fetches, webhook correlation, adjustments.
- The label file — store your copy or store the URL, but either way make reprinting a first-class feature. "The label didn't print" is the most common support ticket a shipping feature generates, and re-download beats re-buy.
- The tracking number — write it to the order and surface it to the buyer. Every shipment also gets a branded tracking page and tracking emails out of the box, so "where's my order" has an answer you didn't build.
- The cost actually charged — record it per shipment now and per-order shipping economics become a query instead of a spreadsheet project.
Model the shipment as its own table keyed by shipment ID, linked to your order — one order can legitimately produce several shipments (split orders, reships, return labels). Treat GoatLabels as the source of truth for shipment state and your database as a synchronized read model; when in doubt, GET the shipment by ID and reconcile.
How do signed webhooks keep your app in sync?
Polling every shipment for status is the pattern that turns weekend projects into cron-job zoos. Webhooks invert it: you expose one HTTPS endpoint, and events arrive as shipments move — status transitions your UI can mirror, and the operationally important shipment.adjustment.created when a carrier reweighs or remeasures a package after acceptance and the cost is corrected.
Three rules make the endpoint production-grade in an afternoon:
- Verify the signature on every event. Every webhook is signed; check the signature before trusting the payload, and reject what doesn't verify. A tracking-update endpoint that skips this is an unauthenticated write path into your order system.
- Acknowledge fast, process async. Return a success response immediately and hand the payload to your own job queue. Slow handlers get retried, and retries mean you must also...
- Be idempotent. Key processing on the event ID so a redelivered event is a no-op, not a duplicate status change.
Handle adjustments as data, not surprises: adjustments arrive as records — via the webhook and queryable through the API — each with its delta. Link the record to its shipment and roll it into that order's true cost. Note the wallet nuance for your billing assumptions: an adjustment draws on wallet balance, and if the balance doesn't cover it, the card on file is charged. Event-by-event handler design, retry semantics, and which events a small app can safely ignore get a full treatment in shipping webhooks explained.
What does testing look like before real money moves?
The quote flow is free to exercise as hard as you like — no purchase, no cost, unlimited calls. So the bulk of your integration test suite (address handling, validation failures, rate selection, extras folding into prices) runs without money moving at all (on Free, address validations are capped at 100 a month, cache hits excluded, and created shipments count toward the 50, so point repeated test runs at /v1/rates/quote). When you're ready to prove the purchase path end to end:
- Buy a label with a Sandbox key. The same endpoints run on test data: the purchase draws on a test balance that starts at $1,000.00 and returns a tracking number that starts GLTEST. Assert your app stored the shipment ID, label, cost, and tracking number correctly.
- Print it and eyeball it. A label PDF that renders wrong at 4×6 is a bug no JSON assertion catches.
- Exercise the webhook path by registering an endpoint with the Sandbox key, moving tracking with POST /v1/sandbox/shipments/{id}/simulate and watching the events arrive: signature verifies, handler acknowledges fast, replayed event no-ops.
- Void it. A sandbox void restores the test balance in the same call; on a Live key the credit posts after the carrier accepts the void. Nothing is charged to your real wallet.
Also test your failure UX on purpose: quote an address with a nonexistent street number and confirm your checkout surfaces the validation failure gracefully. The unhappy path is half the integration.
What will this cost at your volume?
The pleasant answer: the API itself costs nothing at any volume. Unlimited API calls on every plan, no monthly fee on Free (up to 50 shipments a month), no per-label API fee — you pre-fund the wallet (funded by card) and pay the label price when you buy. Ten labels a month costs ten labels; zero labels costs zero. That makes shipping a feature you can ship before you know your volume, which is precisely the position a weekend-project app is in.
Past 50 shipments a month you need Pro, a flat $40/mo with unlimited shipments. Until then, the free tier (50 shipments a month) includes USPS, UPS and FedEx on every domestic parcel, and DHL on international lanes, plus Billy in the web app, the API, webhooks, and branded tracking. Details at pricing.
FAQ
Do I need my own carrier accounts with USPS, UPS and FedEx on every domestic parcel, and DHL on international lanes? No. One API key gets you quotes and labels from USPS, UPS and FedEx (DHL on international lanes) with one price per rate, and there's no per-carrier registration or rate negotiation on your side.
Is the API rate-limited or metered on the free plan? API calls are unlimited on every plan, and quoting is free. On Free, address validations are capped at 100 a month (cache hits excluded) and every shipment you create counts toward the 50 shipments a month, so point repeated test runs at /v1/rates/quote. You pay only the price of labels you actually purchase, drawn from your prepaid wallet.
How does my app find out about carrier billing adjustments? Subscribe to shipment.adjustment.created. Each adjustment arrives as a record with its delta, linked to the shipment, and is also queryable via the API. Note that if an adjustment exceeds your wallet balance, the card on file is charged for the difference.
Can I test purchases without spending real money? Yes. A Sandbox key runs the same endpoints on test data: quotes are the real prices, purchases draw on a test balance that starts at $1,000.00, the label is a sample no carrier accepts, and nothing is charged to your wallet. Switch to a Live key when the flow works.
What must my webhook endpoint do to be safe? Three things: verify the signature on every event before trusting it, respond quickly and process asynchronously, and deduplicate by event ID so retries don't double-apply. That's the entire hardening checklist for a small app.
Before you commit to a vendor, the shipping API comparison shows how the shipping APIs differ on per-label fees, metered calls and carriers.