Obtain a FedEx OAuth 2.0 access token by POSTing to the FedEx token endpoint with your API key and secret using the client credentials grant; the response returns 'access_token' and 'token_type' (verify endpoint path and required parameters in current FedEx developer docs).
Include the access token as a Bearer token in the Authorization header of all subsequent FedEx API requests.
POST to the FedEx Ship REST API shipments endpoint with a request body containing 'shipper', 'recipients', 'requestedShipment' (including 'serviceType', 'packagingType', 'requestedPackageLineItems' with weight and dimensions), and 'labelSpecification' (format and stock type); verify all required fields in current FedEx Ship API documentation.
Parse the response; a successful shipment creation returns 'output.transactionShipments' containing 'masterTrackingNumber', 'pieceResponses' with individual tracking numbers, and 'packageDocuments' containing base64-encoded label data.
Decode the base64 label data and write it to a file in the requested format (PDF, PNG, or ZPL depending on 'labelSpecification.imageType').
Store the master tracking number and individual piece tracking numbers for tracking purposes.
Known gotchas
FedEx access tokens expire (verify TTL in current docs, typically one hour); implement token caching with refresh logic rather than requesting a new token on every API call.
The FedEx Ship REST API has replaced the legacy SOAP web services; if migrating, field names and request structures differ significantly — do not attempt a direct mapping without reviewing current REST API docs.
FedEx sandbox and production use separate credentials and base URLs; ensure you switch both the token endpoint URL and the API base URL when moving to production.
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