Blog/Category
Shipping Tips & Tricks

USPS and UPS Tracking Event Codes: A Developer's Mapping Guide

December 2, 2026
Founder and CEO
USPS and UPS Tracking Event Codes: A Developer's Mapping Guide

Updated December 2026. Codes and rules verified against carrier documentation; see references at the end.

USPS tracking events carry a two-character eventCode (for example GX label created, OF out for delivery, 01 delivered) plus a USPS.com status category, while UPS events carry a one- or two-letter status type (M, I, D, X, MV, U) and a numeric statusCode. To show one status in your app, map both into a small normalized set: label_created, in_transit, out_for_delivery, delivered, exception and returned. Map on the code first and use the event text, category or type to break ties, because a few codes (USPS GX and 10, for example) cover more than one meaning.

For what each status means to a recipient, see USPS tracking statuses explained.

Which tracking APIs do USPS and UPS offer?

APIEndpoint (production)Notes from the carrier spec
USPS Tracking v3r2POST https://apis.usps.com/tracking/v3r2/trackingBody is an array of 1 to 35 tracking requests; tracking numbers are 4 to 34 characters. OAuth scope tracking.
USPS Tracking v3 (legacy)https://apis.usps.com/tracking/v3USPS says the legacy Tracking 3.0 and Subscriptions 3.0 APIs retire July 31, 2027. Migrate to v3r2.
USPS Subscriptions - Tracking v3r2https://apis.usps.com/subscriptions-tracking/v3r2/subscriptionsPush notifications by Mailer ID (MID) or tracking number.
UPS Track APIGET https://onlinetools.ups.com/api/track/v1/details/{inquiryNumber}Inquiry numbers are 7 to 34 characters. Data rolls off after a 120-day retention period. Test host: wwwcie.ups.com.
UPS Track Alert v2POST https://onlinetools.ups.com/api/track/v2/subscription/{type}/packageWebhook subscriptions for 1Z and 1R (Roadie) tracking numbers.

USPS notes that v3r2 can show different messaging, and sometimes different events, than USPS.com and legacy v3.

What are the USPS tracking event codes?

The API points to Pub 199 Appendix G-4 for eventCode values, which now refers you to the PostalPro list "USPS Domestic Tracking Scan Events." The table below uses its November 2026 edition. The status category column is what USPS.com shows; v3r2 returns the same idea in statusCategory.

eventCodeEvent (USPS.com wording)Status categoryNormalize to
GXShipping Label Created, USPS Awaiting ItemPre-Shipmentlabel_created
GXLabel CancelledPre-Shipmentexception (voided)
MAPre-Shipment, USPS Awaiting Item (manifest received)Pre-Shipmentlabel_created
03USPS picked up item / USPS in possession of itemAcceptedin_transit
OAAccepted at USPS Origin FacilityAcceptedin_transit
SFDeparted Post OfficeIn Transitin_transit
10Arrived at / Processing at USPS FacilityIn Transitin_transit
A1, E1, A2Arrived at / Departed USPS Facility; In Transit to Next FacilityIn Transitin_transit
07Arrived at Post OfficeIn Transitin_transit
OFOut for DeliveryOut for Deliveryout_for_delivery
59Out for Delivery / Out for RedeliveryOut for Deliveryout_for_delivery
01Delivered (mailbox, front door, parcel locker, PO Box and other attributes)Delivereddelivered
43Picked Up (delivered at a postal facility)Delivereddelivered
02Notice Left (subcodes 54, 55, 56)Delivery Attempt: Action Neededexception
14Available for PickupAvailable for Pickupexception
30No Access to Delivery LocationAlertexception
57Delivery Exception, Local Weather DelayAlertexception
DXAwaiting Delivery (no delivery event within 18 hours of out for delivery)Alertexception
44Intercepted; item overweight, oversize or damaged, pickup required; hazmat holdAlertexception
04Refused (being returned to sender)Alertreturned
09Return to Sender (subcodes 21 to 29)Alertreturned
21, 22, 23, 26, 27No Such Number, Insufficient Address, Moved Left No Address, Vacant, UnclaimedAlertreturned

Three codes need the event text as well as the code. GX covers both label created and label cancelled. 10 is normally a facility scan, but USPS also uses it for "Seized by USPS for Counterfeit Postage" and "Unpaid postage, item will not be delivered," both in the Alert category. 01 with the "Delivered, To Original Sender" wording is a delivered return, which your customer sees very differently from a delivery.

What do UPS status types I, D, X, M and U mean?

The Tracking API appendix lists these under "Package Activity Types." Track Alert uses the same letters with slightly different definitions, which matters for out for delivery.

TypeTrack API appendixTrack Alert definitionNormalize to
MBilling Information ReceivedManifestlabel_created
MVBilling Information VoidedManifest Voidexception (voided)
IIn Transit, Out for DeliveryIn-progress (on the way)in_transit, or out_for_delivery by statusCode
DDeliveredDelivery information: loaded on delivery vehicle, out for delivery, delivereddelivered or out_for_delivery by statusCode
XExceptionPackage Exceptionexception, or returned by statusCode
UUpdates (Track Alert API only)Updated delivery date or timekeep previous status
NANot AvailableNot listedunknown
DO, DD, WFreight only (delivered origin CFS, delivered destination CFS, warehousing)Not listedhandle separately

The numeric statusCode (the "Status/Description Codes" table in the appendix; Track Alert calls it descriptionCode) is more specific. API examples show it zero-padded, such as '003' and 021, so compare it as an integer.

statusCodeUPS descriptionNormalize to
3, 157Shipment Ready for UPSlabel_created
7Shipment Information Voidedexception (voided)
5, 10, 25On the Wayin_transit
38Picked Up by UPSin_transit
6, 21, 37, 89, 91, 146, 162Out for Deliveryout_for_delivery
11Delivereddelivered
26Delivered by Local Post Officedelivered
143Delivered to Agentdelivered
13Exceptionexception
29Exception: Action Requiredexception
22, 24First Attempt Made / Final Attempt Madeexception
17Held for Customer Pickupexception
34, 35, 36Returned to Sender / Returning to Senderreturned

How do you normalize USPS and UPS events into one status?

Map specific codes first (returned beats delivered), then the carrier's category or type. These two functions pass test cases built from the tables above. The code sets also include a few related codes from the same carrier lists that the tables leave out.

# USPS Tracking v3r2: map one trackingEvents[] item (or the top-level
# status fields) to a normalized status. Codes: PTR Domestic Scan Events.
USPS_RETURNED = {"04", "09", "21", "22", "23", "24", "25", "26", "27", "28", "29"}
USPS_DELIVERED = {"01", "17", "43", "60"}
USPS_OUT_FOR_DELIVERY = {"OF", "59"}
USPS_LABEL = {"GX", "MA"}
USPS_EXCEPTION = {"02", "14", "30", "44", "54", "55", "56", "57", "DX"}
USPS_EXCEPTION_CATEGORIES = ("alert", "delivery attempt", "available for")

def normalize_usps(event_code, event_type="", status_category=""):
    code = (event_code or "").strip().upper()
    text = (event_type or "").lower()
    category = (status_category or "").lower()
    if code in USPS_RETURNED or "original sender" in text:
        return "returned"
    if code in USPS_DELIVERED:
        return "delivered"
    if code in USPS_OUT_FOR_DELIVERY:
        return "out_for_delivery"
    if code in USPS_LABEL:
        return "exception" if "cancel" in text else "label_created"
    if (code in USPS_EXCEPTION or category.startswith(USPS_EXCEPTION_CATEGORIES)
            or "seized" in text or "unpaid postage" in text):
        return "exception"
    return "in_transit"
# UPS Track API (currentStatus / activity[].status) or Track Alert
# (activityStatus). Codes: UPS Tracking API appendix.
UPS_DELIVERED = {11, 26, 143}
UPS_OUT_FOR_DELIVERY = {6, 21, 37, 89, 91, 146, 162}
UPS_RETURNED = {34, 35, 36, 67, 81}
UPS_LABEL = {3, 80, 157, 166}
UPS_EXCEPTION = {7, 13, 17, 22, 24, 29}

def normalize_ups(status_type, status_code="", description=""):
    t = (status_type or "").strip().upper()
    num = int(status_code) if str(status_code).strip().isdigit() else None
    for codes, label in ((UPS_RETURNED, "returned"), (UPS_DELIVERED, "delivered"),
                         (UPS_OUT_FOR_DELIVERY, "out_for_delivery"),
                         (UPS_LABEL, "label_created"), (UPS_EXCEPTION, "exception")):
        if num in codes:
            return label
    if t == "M":
        return "label_created"
    if t in ("X", "MV"):
        return "exception"
    if t == "D":  # Track Alert also uses D for out-for-delivery scans
        return "delivered" if (description or "").lower().startswith("delivered") else "out_for_delivery"
    if t == "U":  # date/time update only: keep the previous status
        return None
    if t == "I":
        return "in_transit"
    return "unknown"

Pickup-ready events map to exception here because the recipient has to act; add a seventh status if you message pickup differently. Store the raw code, type and text beside the normalized value so you can remap history when carriers add codes.

Should you poll the tracking API or use webhooks?

Both carriers offer push. Polling is still useful for backfill: UPS states that Track Alert keeps no history, so call the Track API for events before you subscribed.

ItemUSPS Subscriptions - Tracking v3r2UPS Track Alert v2
Subscribe byMailer ID or single tracking numberTracking numbers, up to 100 per request (error VSS220 above that)
Event filterALL_UPDATES, DELIVERY_ACTIVITY, PACKAGE_DELAYED; SCAN_EVENT_EXTRACT for MID subscriptionsOptional preferences D, I, M, X (enhanced users)
How long it lastsUSPS may delete a subscription after 30 days with no traffic to the listener URL; warning email at 25 days14 days per tracking number; resubscribe if not delivered
Failed deliveriesRetries for 24 hours, then suspends every subscription on that listener URL and discards pending eventsNot stated in the FAQ or spec
SecurityOptional IP allowlisting and HMAC-SHA256 in the X-HMAC header (32-character secret)HTTPS on port 443 only; in v2, webhook credentials are managed on the UPS Manage Webhook Credentials page
Other limitsUp to 10 unique listener URLs per Home CRIDCIE test numbers 1ZCIETST0111111114, 1ZCIETST0422222228, 1ZCIEPIC0111111116

If you poll, cache. UPS's tracking best practices say to avoid redundant calls for the same number and warn that frequent polling can lead to throttling. USPS states that its APIs have usage limits and that higher limits are requested through USPS API Support; the tracking spec documents HTTP 429 with a Retry-After header. Batch USPS lookups up to the 35-item request limit.

To verify a USPS notification, concatenate the body's timestamp and payload strings, HMAC them with your secret using SHA-256, Base64-encode the result and compare it with X-HMAC. The payload field is itself a JSON string.

import base64, hashlib, hmac, json

def verify_usps_notification(raw_body: bytes, x_hmac: str, secret: str):
    """Return the parsed tracking payload if X-HMAC matches, else None."""
    body = json.loads(raw_body)
    message = (body["timestamp"] + body["payload"]).encode("utf-8")
    digest = hmac.new(secret.encode("utf-8"), message, hashlib.sha256).digest()
    expected = base64.b64encode(digest).decode("ascii")
    if not hmac.compare_digest(expected.encode(), (x_hmac or "").encode()):
        return None
    return json.loads(body["payload"])  # payload is a JSON string

Return HTTP 200 quickly and process the event on a queue. A slow handler that times out for a day can suspend every USPS subscription on that URL.

What tracking gotchas trip up developers?

  • Event order differs. USPS returns events in reverse chronological order. UPS returns activity most recent first but milestones oldest first.
  • Label created is not acceptance. USPS describes MA as electronic manifest data that "does not signify receipt of the shipment." Don't start delivery-time SLAs until an Accepted or first in-transit scan.
  • Duplicate tracking numbers exist. USPS returns uniqueTrackingID and mailingDate to separate them, and event 46 flags a duplicate label ID.
  • UPS test data is fake. In CIE, all tracking numbers return the same sample response, so test your normalizer with fixtures, not CIE calls.

For retry and error patterns in agent tools that call these APIs, see error handling for shipping agents. If you are still on USPS Web Tools, start with the USPS Web Tools retirement and migration guide.

Frequently asked questions

What does USPS event code GX mean?

GX is "Shipping Label Created, USPS Awaiting Item." USPS has not scanned the package yet. The same code is also used for "Label Cancelled," so check the event text before you mark a shipment as created.

How do I detect out for delivery across USPS and UPS?

For USPS, use eventCode OF or 59. For UPS, use statusCode 6, 21, 37, 89, 91, 146 or 162. The Track API appendix lists out for delivery under type I, while the Track Alert FAQ includes it under type D, so the letter alone is ambiguous.

When does the USPS legacy Tracking v3 API retire?

USPS says Tracking 3.0 legacy and Subscriptions Tracking 3.0 legacy retire July 31, 2027. The replacements are Tracking v3r2 and Subscriptions - Tracking v3r2.

What does UPS tracking status type X mean?

X is an exception. Read the numeric statusCode for detail: in the appendix, 34 to 36 are returns to sender and 22 and 24 are delivery attempts.

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, 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 or 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