access_token for that user’s Shippo account. This guide walks through testing that connection end to end: exchange the Bearer token for a JWT, confirm which user you are acting as, put USPS into test mode, and buy a test label.
Every request on this page runs against the live api.goshippo.com host. Nothing here charges the connected account, provided you follow the test-rate check in Create a test rate.
Before you begin
You need:- OAuth credentials for your platform (
client_idandclient_secret). See OAuth to request them. - A completed OAuth flow for a test user, which gives you that user’s Bearer
access_token. - A Shippo account you are comfortable testing against. Use a dedicated test account rather than a production one — see Sandbox testing.
Exchange the Bearer token for a JWT
Callembedded/authz with the user’s Bearer token to mint a JWT. The scope field is required.
Mint a JWT request
Mint a JWT response
token is the JWT. expiresIn is a unix timestamp marking when it expires — tokens are valid for 12 hours. Send the JWT on every subsequent request as Authorization: JWT <JWT_TOKEN>.
note
JWT is the only accepted prefix for this token. Authorization: Bearer <JWT_TOKEN> and Authorization: ShippoToken <JWT_TOKEN> both return 401.Confirm which user you are acting as
Before you create anything, confirm the JWT resolves to the OAuth user you expect. This is the fastest way to catch a token that belongs to the wrong connected account.Check the account request
Check the account response
Decoded JWT payload
Put USPS into test mode
Shippo provisions a test USPS carrier account alongside the live one. List the connected account’s carrier accounts and find the USPS entry with"test": true.
List carrier accounts request
List carrier accounts response
PUT. You must include test in the body alongside active — omitting it returns 400 {"test": ["This field is required."]}.
Activate test mode request
Activate test mode response
Create a test rate
Create a shipment exactly as you would in production. The JWT authenticates the request on behalf of the OAuth user.Create shipment request
Create shipment response (rates excerpt)
Create a test transaction
Purchase the test rate to produce a test label. Guard the selection in code rather than pasting a rate ID by hand:Select and purchase a test rate
Create transaction response
"test": true on the response. A test transaction returns a real, downloadable label PDF and a tracking number, but is not a real shipment and is not billed.
Clean up
Test rates keep appearing in every rate response for the connected account until you deactivate the test carrier account. When you finish testing, turn it back off:Deactivate test mode request