Carrier & Shipping Shipping app or label integration in BC → FedEx REST API (OAuth 2.0) FedEx Developer Portal (API Authorization docs; Best Practices) and Inlinex FedEx label error guide

FedEx REST API Returns 401 NOT.AUTHORIZED.ERROR: Access Token Has Expired or Is Invalid

Raw System Error String
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

  1. 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.
  2. Open the shipping app's carrier setup for FedEx. Choose its test-connection or get-token action if it has one.
  3. 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).
  4. 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.
  5. Check the environment: sandbox keys only work against the FedEx sandbox URL, and production keys only against production.
  6. Retry the label for the waiting shipments.

Verification Steps

How to verify: The token request returns an access_token with expires_in 3600, and the next rate or label call returns a label and tracking number.

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.

We respect your privacy. No spam. You will only be contacted when pilot slots open for your stack.