
Updated December 2026. Codes and rules verified against carrier documentation; see references at the end.
UPS has deprecated Access Key authorization for all of its APIs and replaced it with OAuth 2.0. To migrate, create an app on the UPS Developer Portal to get a Client ID and Client Secret, exchange them at POST /security/v1/oauth/token for a bearer token, and send that token in an Authorization: Bearer header on every call. You also have to move XML, SOAP and legacy JSON requests to the RESTful endpoints in the UPS API Catalog, which live under https://onlinetools.ups.com/api in production and https://wwwcie.ups.com/api in the Customer Integration Environment (CIE).
This guide is the UPS counterpart to our USPS Web Tools retirement and migration guide.
In the old model, credentials traveled inside the body of every request. UPS's migration guide says UPS "has deprecated the existing Access Key-based authorization for all APIs" and asks integrations to move to OAuth 2.0 as soon as possible.
The change has two parts:
If you use a third-party platform or plugin, UPS says the vendor makes the change.
Client credentials is the grant type for an integration owner who is also the UPS shipper. If your software acts for many UPS customers, UPS points you to the Authorization Code grant instead. The client credentials steps from UPS's Getting Started guide:
grant_type=client_credentials.access_token as Authorization: Bearer <token> on Ship, Rate, Track and other calls.The credentials are tied to the UPS profile that created the app. Only shipper accounts linked to that profile can transact with them.
| Item | CIE (test) | Production |
|---|---|---|
| Token endpoint | https://wwwcie.ups.com/security/v1/oauth/token | https://onlinetools.ups.com/security/v1/oauth/token |
| API base URL | https://wwwcie.ups.com/api | https://onlinetools.ups.com/api |
The token endpoint takes these inputs, per the UPS OAuth Client Credentials OpenAPI spec:
| Part | Value | Required |
|---|---|---|
| Method | POST | Yes |
| Auth | HTTP Basic: Client ID and Client Secret | Yes |
Content-Type | application/x-www-form-urlencoded | Yes |
| Body | grant_type=client_credentials | Yes |
x-merchant-id header | Your UPS account number | No |
The specs declare no OAuth scopes, so you don't request any. The response fields you need are access_token and expires_in.
Two CIE limits to know: UPS says the test endpoints are not for load testing, and Street Level Address Validation in CIE only returns results for New York and California addresses.
Read the expires_in field on each token response. UPS calls it the token's time to live in seconds, and UPS endpoints reject the token once that time passes. Don't hardcode a lifetime. If your refresh timer assumes a fixed number of hours and UPS shortens it, every call after the real expiry fails with a 401.
Two details to handle in code:
expires_in as a string, so cast it to a number before doing arithmetic.| Header | Value | Notes from the UPS specs |
|---|---|---|
Authorization | Bearer <access_token> | Required on every API call. Missing or invalid tokens return 401. |
transId | Unique ID per request, up to 32 characters | Required on Track and Time in Transit; optional on Rating and Shipping. |
transactionSrc | Name of your application | Required on Track and Time in Transit; optional on Rating and Shipping. |
Content-Type | application/json | Required on calls with a request body; missing it returns 400. |
The simplest rule is to send transId and transactionSrc on every call.
Each operation now has its own versioned REST path. Paths are relative to the base URL above, and the version shown is the current default in UPS's OpenAPI specs on GitHub (December 2026).
| Operation | Method and path | Current version |
|---|---|---|
| Rate one service or shop all services | POST /rating/{version}/{requestoption} (Rate, Shop, Ratetimeintransit, Shoptimeintransit) | v2409 |
| Create shipment and label | POST /shipments/{version}/ship | v2409 |
| Void shipment | DELETE /shipments/{version}/void/cancel/{shipmentidentificationnumber} | v2409 |
| Label recovery | POST /labels/{version}/recovery | v1 |
| Track by tracking number | GET /track/v1/details/{inquiryNumber} | v1 |
| Address validation and classification | POST /addressvalidation/{version}/{requestoption} (1 validate, 2 classify, 3 both) | v2 |
| Time in transit | POST /shipments/{version}/transittimes | v1 |
| Locator | POST /locations/{version}/search/availabilities/{reqOption} | v3 |
| Schedule a pickup | POST /pickupcreation/{version}/pickup | v2409 |
| Paperless document upload | POST /paperlessdocuments/{version}/upload | v2 |
Older version values such as v1, v1601 and v2205 still appear in the Rating and Shipping specs, but they are marked deprecated. If your code calls /rating/v1/Shop, it is on a deprecated version and should move to v2409 during the migration. Request bodies are JSON wrapped in a root object such as RateRequest or ShipmentRequest; the samples in each spec are the quickest way to rebuild your payloads.
This class fetches a token, keeps it in memory, and refreshes it 60 seconds before expires_in runs out. The lock stops threads from requesting tokens at the same time.
import os, threading, time
import requests
# CIE (test): https://wwwcie.ups.com Production: https://onlinetools.ups.com
UPS_BASE = os.environ.get("UPS_BASE", "https://wwwcie.ups.com")
class UPSToken:
def __init__(self, client_id, client_secret):
self.client_id, self.client_secret = client_id, client_secret
self._token, self._expires_at = None, 0.0
self._lock = threading.Lock()
def get(self):
with self._lock:
# Refresh 60 seconds before UPS says the token expires
if self._token is None or time.monotonic() > self._expires_at - 60:
self._fetch()
return self._token
def invalidate(self):
with self._lock:
self._token = None
def _fetch(self):
r = requests.post(
f"{UPS_BASE}/security/v1/oauth/token",
auth=(self.client_id, self.client_secret), # HTTP Basic
data={"grant_type": "client_credentials"}, # form-encoded body
timeout=15,
)
r.raise_for_status()
body = r.json()
self._token = body["access_token"]
# The spec types expires_in as a string of seconds, so cast it
self._expires_at = time.monotonic() + int(body["expires_in"])
A Track call with the required headers, retrying once with a fresh token on 401:
import uuid
from urllib.parse import quote
def track(tokens, tracking_number):
url = f"{UPS_BASE}/api/track/v1/details/{quote(tracking_number, safe='')}"
for attempt in range(2):
r = requests.get(url, timeout=15, headers={
"Authorization": f"Bearer {tokens.get()}",
"transId": uuid.uuid4().hex, # unique per request, 32 chars
"transactionSrc": "my-app",
})
if r.status_code == 401 and attempt == 0:
tokens.invalidate() # expired or revoked: fetch a new token once
continue
r.raise_for_status()
return r.json()
tokens = UPSToken(os.environ["UPS_CLIENT_ID"], os.environ["UPS_CLIENT_SECRET"])
This needs Node 20 or later for the global fetch and crypto. The shared promise means concurrent callers trigger a single token request.
const UPS_BASE = process.env.UPS_BASE ?? "https://wwwcie.ups.com";
let cached = null; // { token, expiresAt }; one cache per process, one Client ID
let inflight = null; // one token request shared by concurrent callers
async function fetchToken(clientId, clientSecret) {
const basic = Buffer.from(`${clientId}:${clientSecret}`).toString("base64");
const res = await fetch(`${UPS_BASE}/security/v1/oauth/token`, {
method: "POST",
headers: {
Authorization: `Basic ${basic}`,
"Content-Type": "application/x-www-form-urlencoded",
},
body: new URLSearchParams({ grant_type: "client_credentials" }),
});
if (!res.ok) throw new Error(`UPS token ${res.status}: ${await res.text()}`);
const body = await res.json();
// expires_in is a string of seconds in the UPS spec
return { token: body.access_token, expiresAt: Date.now() + Number(body.expires_in) * 1000 };
}
export async function getUpsToken(clientId, clientSecret) {
if (cached && Date.now() < cached.expiresAt - 60_000) return cached.token;
inflight ??= fetchToken(clientId, clientSecret).finally(() => { inflight = null; });
cached = await inflight;
return cached.token;
}
export async function track(trackingNumber, clientId, clientSecret) {
const res = await fetch(`${UPS_BASE}/api/track/v1/details/${encodeURIComponent(trackingNumber)}`, {
headers: {
Authorization: `Bearer ${await getUpsToken(clientId, clientSecret)}`,
transId: crypto.randomUUID().replaceAll("-", ""), // 32 chars
transactionSrc: "my-app",
},
});
if (res.status === 401) cached = null; // next call fetches a new token
if (!res.ok) throw new Error(`UPS track ${res.status}: ${await res.text()}`);
return res.json();
}
Errors come back as {"response":{"errors":[{"code":"...","message":"..."}]}}. These are from the troubleshooting table in UPS's Getting Started guide:
| HTTP | Code | Message | Likely cause |
|---|---|---|---|
| 401 | 10401 | ClientId is Invalid | Wrong or mistyped Client ID |
| 401 | 250002 | Invalid Authentication Information. | Missing or expired bearer token on an API call |
| 400 | 10400 | Invalid/Missing Authorization Header | Missing Authorization header (Basic on the token call, Bearer on API calls) |
| 400 | 400 | Unsupported grant type : null | Token request body missing grant_type or not form-encoded |
| 400 | 10400 | Invalid or Missing required parameter : Content-Type | No Content-Type on a call with a body |
| 403 | 10403 | Access Denied. Merchant requests are blocked temporarily | UPS is temporarily blocking requests for the account; contact UPS |
| 429 | 10429 | Number of requests exceeded Quota for the time interval | Request quota exceeded; on the token endpoint, usually from requesting a token per call |
| 503 | 10004 | The service is temporarily unavailable | Backend connection error or timeout; retry with backoff |
For retry and backoff patterns around carrier errors, see our guide to shipping API error handling.
Temporarily. UPS offers "Steppingstone" endpoints: create an app, point your requests at the Steppingstone endpoints, get an OAuth token, remove the entire SOAP security header from the request body, and send the token as Authorization: Bearer <token>. UPS says these endpoints will be phased out at a future date with advance notice and strongly recommends moving to REST, so treat Steppingstone as a bridge. Get the Steppingstone endpoint URLs from the UPS Developer Portal.
No. UPS says customers on third-party platforms don't need their own OAuth credentials; the platform handles them. With a multi-carrier provider like Ship.com, you buy UPS labels without your own UPS account, so there are no UPS credentials or tokens for you to manage. If you are wiring shipping into an AI agent, our shipping API guide for AI agents covers that route.
Production is https://onlinetools.ups.com/security/v1/oauth/token and CIE is https://wwwcie.ups.com/security/v1/oauth/token. Send a POST with HTTP Basic auth and a form-encoded body of grant_type=client_credentials.
UPS's migration guide says Access Key authorization is deprecated for all APIs and does not give a date on that page. Plan as if access keys no longer work: use a Client ID and Client Secret from a Developer Portal app, exchanged for a bearer token.
Request a new token with the same Client ID and Secret shortly before expires_in runs out. Refresh tokens belong to the Authorization Code flow, which has its own refresh endpoint.
No. UPS says the token endpoint's rate limit is far lower than that of APIs like Ship, Track and Rate. Cache one token, reuse it across requests, and refresh it shortly before it expires.
None. UPS's OpenAPI specs declare an empty scope list, and the token request body only takes grant_type.
Ship.com gives you USPS and UPS labels at up to 89% off USPS and up to 87% off UPS without your own carrier accounts, usable from your code through the REST API or from AI agents through the MCP server. Every account starts with a 30-day free trial, no credit card required.
Read the Ship MCP setup guide | See plans and pricing