Blog/Category
Shipping Tips & Tricks

UPS API OAuth Migration: Replacing Access Keys (Developer Guide)

November 29, 2026
Founder and CEO
UPS API OAuth Migration: Replacing Access Keys (Developer Guide)

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.

What did UPS retire, and what replaced it?

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:

  • Authentication. A short-lived bearer token in an HTTP header replaces credentials in the payload.
  • Payloads. Integrations built on XML, SOAP or legacy JSON must convert to the RESTful APIs in the API Catalog. Plan to rework how you build requests and parse responses.

If you use a third-party platform or plugin, UPS says the vendor makes the change.

How does the UPS OAuth client credentials flow work?

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:

  1. Log in to the UPS Developer Portal with your UPS.com ID and open My Apps, then Add Apps.
  2. Pick the scenario, link a shipper account, and add the API products you need. OAuth is added to every app by default.
  3. Save the app. Your Client ID and Client Secret appear under App Info.
  4. Call the token endpoint with HTTP Basic auth (Client ID as username, Client Secret as password) and a form body of grant_type=client_credentials.
  5. Send the returned 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.

What are the UPS token URL and base URLs for CIE and production?

ItemCIE (test)Production
Token endpointhttps://wwwcie.ups.com/security/v1/oauth/tokenhttps://onlinetools.ups.com/security/v1/oauth/token
API base URLhttps://wwwcie.ups.com/apihttps://onlinetools.ups.com/api

The token endpoint takes these inputs, per the UPS OAuth Client Credentials OpenAPI spec:

PartValueRequired
MethodPOSTYes
AuthHTTP Basic: Client ID and Client SecretYes
Content-Typeapplication/x-www-form-urlencodedYes
Bodygrant_type=client_credentialsYes
x-merchant-id headerYour UPS account numberNo

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.

How long does a UPS OAuth access token last?

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:

  • The spec types expires_in as a string, so cast it to a number before doing arithmetic.
  • UPS says not to request a new token for every transaction, because the token endpoint's rate limit is "far lower" than that of core APIs like Ship, Track and Rate. Reuse one token across requests and refresh shortly before it expires.

Which headers do UPS REST API calls need?

HeaderValueNotes from the UPS specs
AuthorizationBearer <access_token>Required on every API call. Missing or invalid tokens return 401.
transIdUnique ID per request, up to 32 charactersRequired on Track and Time in Transit; optional on Rating and Shipping.
transactionSrcName of your applicationRequired on Track and Time in Transit; optional on Rating and Shipping.
Content-Typeapplication/jsonRequired on calls with a request body; missing it returns 400.

The simplest rule is to send transId and transactionSrc on every call.

How do old UPS API calls map to the new REST endpoints?

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).

OperationMethod and pathCurrent version
Rate one service or shop all servicesPOST /rating/{version}/{requestoption} (Rate, Shop, Ratetimeintransit, Shoptimeintransit)v2409
Create shipment and labelPOST /shipments/{version}/shipv2409
Void shipmentDELETE /shipments/{version}/void/cancel/{shipmentidentificationnumber}v2409
Label recoveryPOST /labels/{version}/recoveryv1
Track by tracking numberGET /track/v1/details/{inquiryNumber}v1
Address validation and classificationPOST /addressvalidation/{version}/{requestoption} (1 validate, 2 classify, 3 both)v2
Time in transitPOST /shipments/{version}/transittimesv1
LocatorPOST /locations/{version}/search/availabilities/{reqOption}v3
Schedule a pickupPOST /pickupcreation/{version}/pickupv2409
Paperless document uploadPOST /paperlessdocuments/{version}/uploadv2

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.

How do I cache a UPS OAuth token in Python?

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"])

How do I cache a UPS OAuth token in Node.js?

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();
}

What do common UPS OAuth errors mean?

Errors come back as {"response":{"errors":[{"code":"...","message":"..."}]}}. These are from the troubleshooting table in UPS's Getting Started guide:

HTTPCodeMessageLikely cause
40110401ClientId is InvalidWrong or mistyped Client ID
401250002Invalid Authentication Information.Missing or expired bearer token on an API call
40010400Invalid/Missing Authorization HeaderMissing Authorization header (Basic on the token call, Bearer on API calls)
400400Unsupported grant type : nullToken request body missing grant_type or not form-encoded
40010400Invalid or Missing required parameter : Content-TypeNo Content-Type on a call with a body
40310403Access Denied. Merchant requests are blocked temporarilyUPS is temporarily blocking requests for the account; contact UPS
42910429Number of requests exceeded Quota for the time intervalRequest quota exceeded; on the token endpoint, usually from requesting a token per call
50310004The service is temporarily unavailableBackend connection error or timeout; retry with backoff

For retry and backoff patterns around carrier errors, see our guide to shipping API error handling.

Can I keep my SOAP or XML integration and just add OAuth?

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.

Do I need my own UPS OAuth credentials if I use a shipping platform?

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.

Frequently asked questions

What is the UPS OAuth token URL?

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.

Do UPS access keys still work?

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.

How do I refresh a UPS client credentials 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.

Should I request a new UPS token for every API call?

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.

What scopes does the UPS client credentials grant need?

None. UPS's OpenAPI specs declare an empty scope list, and the token request body only takes grant_type.

More shipping developer references

Build shipping with Ship.com

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

References

Joe DiSorbo
About the author
Joe DiSorbo
Founder and CEO

Joe DiSorbo is the founder and CEO of Ship.com, the shipping platform that gives more than 10,000 business customers discounted USPS and UPS rates and simplifies logistics for ecommerce brands and software platforms. Before Ship.com, he founded and led Webgistix, an ecommerce technology and global fulfillment company that grew internationally before Rakuten acquired it in 2013. His background spans global operations, software development, finance and logistics, with experience across the United States and Asia. Joe holds undergraduate degrees in Economics and Geography, masters degrees in Finance and International Management, and is a graduate of Harvard Business School (OPM 41).

Shipping software built for online sellers

Ship.com saves you time and money, giving you more freedom to live your life.

  • No credit card required.
  • Up to 89% off USPS and up to 87% off UPS.
  • Connects with major e-commerce platforms.
  • Free home pickup. Skip the trip to the post office.
Try for free
UPS
UP TO 87% OFF
Daily Rates*
USPS
UP TO 89% OFF
Retail Prices*
Today's orders
Order #1042USPS Ground AdvantageReady
Order #1043UPS Ground SaverReady
Order #1044USPS Priority MailReady
★★★★★Trusted by 10,000+ business customers

More on this topic

See all