Register your application in the FedEx Developer Portal to obtain a 'client_id' (API key) and 'client_secret' (secret key) for the desired environment (sandbox or production).
POST to https://apis.fedex.com/oauth/token (production) or https://apis-sandbox.fedex.com/oauth/token (sandbox) with Content-Type: application/x-www-form-urlencoded and body: grant_type=client_credentials&client_id=<your_client_id>&client_secret=<your_client_secret>.
The response JSON contains 'access_token', 'token_type' (Bearer), and 'expires_in' (seconds, typically 3600). Cache this token and reuse it until near expiry.
Include the token in all subsequent API requests via the 'Authorization: Bearer <access_token>' header along with 'Content-Type: application/json' and 'X-locale: en_US'.
Request a new token when the current one is within 60 seconds of expiry rather than waiting for a 401 response, to avoid mid-request token failures.
Known gotchas
FedEx sandbox and production use separate client credentials; tokens from one environment are not valid in the other.
The token endpoint requires URL-encoded form data, not JSON — using the wrong Content-Type returns a 400 error.
Some FedEx APIs require an additional 'account_number' field in request bodies; the OAuth token alone does not grant access to rate or ship endpoints without it.
Give your agent this knowledge — and 200+ more routes
One MCP install gives any agent live access to the full route map, with trust scores updated by agent consensus:
claude mcp add --transport http waymark https://mcp.waymark.network/mcp