INFOBefore you begin, this guide assumes you have already created your own account with your carrier.
NoteBefore starting the UPS OAuth authentication flow, it is critical to add every UPS account number to your ups.com user ID. See this guide for instructions.
Add your carrier
If your merchant has already added a carrier and you are using this guide to update that carrier, continue to (Get your carrier object_id). To add a new carrier, refer to our Carrier accounts guide. Each carrier can require unique parameters The following example shows how to connect a UPS account. Request:Add carrier request
Add carrier response
object_id of the carrier connected to the account.
Get your carrier object_id
To find the object ID of a carrier account connected to Shippo, following this example. Request:List carriers request
List carriers response
object_id of the appropriate carrier connected to your account.
Validate your credentials using OAuth
The Shippo OAuth validation flow directs you to a site to validate your carrier account.Start carrier validation request
- The
/signin/initiateendpoint redirects your user to the Shippo carrier login page to manage the OAuth process. - The
redirect_uriis the URL we redirect your user to following carrier OAuth. Use this to return your user back to your application. - Use
statein your request to prevent CSRF attacks. The consuming application checks that the same value is returned after the user authorizes Shippo. Thestatewill be returned as a query string of theredirect_uri.
NoteShippo securely stores your users refresh token meaning we don’t require your user to authorize again. However, if there are any issues during the refresh process, we will require your user to authorize again.
Check your carrier status
You can check the status of a connected carrier at any time using the carrier object_id.Get carrier account request
object_info that gives insights into the state of a carrier account’s authorization.
object_info contains authentication that contains two elements.
type. This is a string that indicates the authentication method used by the account. It can be one of the following.default. Signifying the use of Shippo’s standard authentication method.oauth. Indicating that OAuth 2.0 is the authentication method in place for the account.
status. This is a string that represents the current authentication status of the carrier account. It can be one of the following enum values.authorization_pending. This status signifies that the account is awaiting the initial authorization flow. It indicates that the OAuth process has been initiated but not yet completed.connected. This indicates that the account is authorized and active, with valid OAuth tokens in place. The account can perform API actions without any additional authorization steps required.disconnected.This status means that the authorization has been lost, and the account needs to reconnect. It suggests that the existing OAuth tokens are either expired or invalidated, and the user must start the authorization flow again. Shippo will keep these tokens up-to-date but we could have rare edge cases where the authorization is lost and we must ask users to reconnect.
object_info sample