FedEx REST API Returns 401 NOT.AUTHORIZED.ERROR: Access Token Has Expired or Is Invalid
401 Unauthorized — NOT.AUTHORIZED.ERROR: Access token has expired or is invalid.What It Means
Rate, label or tracking calls to FedEx fail for every shipment. Packing stations cannot print FedEx labels until a valid token is used.
Root Cause
The FedEx REST APIs use an OAuth access token from the /oauth/token endpoint. FedEx states the token expires in an hour (expires_in 3600). If the shipping app caches the token and does not get a new one on HTTP 401, every call after expiry fails. The same 401 appears when the API key or secret is wrong, was regenerated in the FedEx Developer Portal, or when test (sandbox) credentials are sent to the production URL (or the reverse).
Step-by-Step Fix
- Find the full FedEx response in the shipping app's log in Business Central. Confirm the HTTP status is 401 and the code is NOT.AUTHORIZED.ERROR.
- Open the shipping app's carrier setup for FedEx. Choose its test-connection or get-token action if it has one.
- If a new token works, the old one had expired. Ask the app vendor to make the app request a new token when FedEx returns 401 (FedEx best practice: cache the token until a 401, then regenerate it).
- If a new token fails too, compare the API Key and Secret Key in the setup with the project in the FedEx Developer Portal. Re-enter them if the project credentials were regenerated.
- Check the environment: sandbox keys only work against the FedEx sandbox URL, and production keys only against production.
- Retry the label for the waiting shipments.
Verification Steps
Sources & References
Early Access · 30-Day Sandbox Pilot
Stop Order Sync Failures Before Customers Notice
The Order Flow Doctor monitors Microsoft Dynamics 365 Business Central order flows across Shopify, EDI (TrueCommerce, SPS), 3PLs, and carriers. Get automated root-cause diagnosis and one-click fixes.