Connect Retool to the FedEx API using a REST API Resource with OAuth 2.0 client credentials authentication. Exchange your FedEx API key and secret for a bearer token, then query tracking, rating, and shipment endpoints to build fulfillment dashboards that monitor FedEx packages, calculate shipping rates, and manage shipments alongside data from other carriers and order management tools.
| Fact | Value |
|---|---|
| Tool | FedEx API |
| Category | Other |
| Method | REST API Resource |
| Difficulty | Intermediate |
| Time required | 25 minutes |
| Last updated | April 2026 |
Build FedEx Shipping and Tracking Dashboards in Retool
FedEx's API enables operations and fulfillment teams to go beyond the standard FedEx website tracking experience, building dashboards that monitor dozens or hundreds of shipments simultaneously, trigger alerts on delivery exceptions, calculate and compare shipping rates before purchasing labels, and combine FedEx data with order management system data already in Retool. The API covers the full shipping lifecycle: rate quotes, shipment creation, label generation, tracking, and address validation.
FedEx migrated from legacy SOAP-based web services to a modern REST API in recent years. The REST API uses OAuth 2.0 client credentials flow — you exchange your API key and secret for a bearer token that is valid for one hour. All subsequent API calls include this token in the Authorization header. This token-based approach adds a small amount of configuration complexity compared to static API keys, but is straightforward once set up in Retool using a dedicated token-fetch query.
Common Retool apps built on the FedEx API include: shipment tracking dashboards that aggregate status for all outbound orders with exception highlighting, rate comparison tools that show FedEx service options and pricing for a given package and destination, fulfillment operations panels that combine FedEx tracking with order data from Shopify or your database, and exception management dashboards that surface delivery failures, address issues, and customs holds for proactive customer communication.
Integration method
FedEx's modern REST API uses OAuth 2.0 client credentials authentication. Your FedEx developer credentials (API key and secret) are exchanged for a short-lived bearer token using a token endpoint, and that token is included in all subsequent API requests. In Retool, this requires a token-fetch query that runs before your operational queries, or a Retool Workflow that periodically refreshes the token. All requests are proxied server-side through Retool.
Prerequisites
- A FedEx account enrolled in FedEx Developer Portal (developer.fedex.com) with Production or Test credentials
- A FedEx API project with API key and secret key from the Developer Portal
- Your FedEx account number for shipment creation and billing (visible in your FedEx account settings)
- A Retool account with permission to create Resources
- Basic understanding of OAuth 2.0 token-based authentication
Step-by-step guide
Create a FedEx Developer project and obtain API credentials
Navigate to developer.fedex.com and log in with your FedEx account credentials. If you do not have a FedEx developer account, create one using your business FedEx account number. Once logged in, click 'Create API Project' and select the APIs you need access to — at minimum, select 'Track' for tracking queries and 'Rate' for rate calculations. If you plan to create shipments, also select 'Ship'. Complete the project creation wizard, selecting whether you want Test environment access (for sandbox testing with simulated shipments) or Production environment access (for real shipment data). After creating the project, FedEx displays your API key and secret key. Copy both values — the secret key is shown only once at project creation. If you lose the secret, you must regenerate it from the project settings page. Note your FedEx account number separately, as it is required for shipment creation and some rating requests. For development and testing, start with the Test environment where you can use simulated tracking numbers beginning with '123456789012'.
Pro tip: FedEx Test and Production environments are completely separate. Credentials from one do not work in the other. Use the Test environment base URL 'https://apis-sandbox.fedex.com' during development, then switch to 'https://apis.fedex.com' when moving to production.
Expected result: You have a FedEx API key and secret key for your chosen environment, plus your FedEx account number noted for shipment operations.
Create the FedEx REST API Resource and configure token authentication
In Retool, navigate to the Resources tab and click 'Create New'. Select 'REST API'. Set the Base URL to 'https://apis.fedex.com' for production (or 'https://apis-sandbox.fedex.com' for the test environment). Under Authentication, leave it as 'None' because FedEx uses a token that must be fetched separately via a query before each session. Click 'Save Resource'. Next, store your credentials in Retool Settings → Configuration Variables: add 'FEDEX_API_KEY' and 'FEDEX_SECRET_KEY' as secret variables. FedEx OAuth tokens expire after one hour, so you need a token-fetch query that runs when the app loads. Create a query using the FedEx resource: set method to POST, path to '/oauth/token', body type to 'x-www-form-urlencoded', and body to 'grant_type=client_credentials&client_id={{ retoolContext.configVars.FEDEX_API_KEY }}&client_secret={{ retoolContext.configVars.FEDEX_SECRET_KEY }}'. Enable 'Run this query on page load' so the token is always fresh. Store the resulting access_token in a Retool state variable using the query's success event handler.
1// POST /oauth/token (body: x-www-form-urlencoded)2// grant_type=client_credentials3// client_id={{ retoolContext.configVars.FEDEX_API_KEY }}4// client_secret={{ retoolContext.configVars.FEDEX_SECRET_KEY }}56// On success event handler:7// storeValue('fedex_token', getToken.data.access_token);8// storeValue('fedex_token_expires', Date.now() + (data.expires_in * 1000));Pro tip: FedEx tokens are valid for 3600 seconds (one hour). If your Retool app is used for longer sessions, add a check in a JavaScript query that compares the stored expiry time against Date.now() and triggers a token refresh if within 5 minutes of expiry before making tracking or shipping API calls.
Expected result: The token fetch query runs on page load and stores the FedEx access token in a Retool state variable. Subsequent queries can reference this token via {{ appState.fedex_token }}.
Query FedEx tracking data for package status
Create a tracking query using the FedEx resource. Set the method to POST, the path to '/track/v1/trackingnumbers', and the body type to JSON. Include the Authorization header in the query's Headers section with value 'Bearer {{ appState.fedex_token }}' — this references the token stored during the authentication step. The request body requires a 'trackingInfo' array where each element contains a 'trackingNumberInfo' object with the 'trackingNumber' field. You can include up to 30 tracking numbers in a single request for bulk tracking. Each response item includes 'trackResults' with the current status, estimated delivery window, tracking events array (most recent first), service type (FEDEX_GROUND, PRIORITY_OVERNIGHT, etc.), and any exception information. The 'status' field uses FedEx-specific codes like 'DE' (Delivered), 'IT' (In Transit), 'OD' (Out for Delivery), and 'DL' (Delay). Add a transformer to map these codes to human-readable labels.
1// POST /track/v1/trackingnumbers2// Headers: Authorization: Bearer {{ appState.fedex_token }}3// Body (JSON):4{5 "trackingInfo": [6 {7 "trackingNumberInfo": {8 "trackingNumber": "{{ trackingInput.value }}"9 }10 }11 ],12 "includeDetailedScans": true13}1415// Transformer: format tracking response16const results = data && data.output && data.output.completeTrackResults17 ? data.output.completeTrackResults18 : [];1920const statusLabels = {21 'DE': 'Delivered',22 'IT': 'In Transit',23 'OD': 'Out for Delivery',24 'DL': 'Delay',25 'PU': 'Picked Up',26 'OC': 'Order Created',27 'AN': 'At Destination Sort',28 'SE': 'Exception'29};3031return results.map(result => {32 const track = result.trackResults && result.trackResults[0]33 ? result.trackResults[0]34 : {};35 const latestEvent = track.trackingEventDetails && track.trackingEventDetails[0]36 ? track.trackingEventDetails[0]37 : {};3839 return {40 tracking_number: result.trackingNumber,41 status_code: track.latestStatusDetail && track.latestStatusDetail.code,42 status: statusLabels[track.latestStatusDetail && track.latestStatusDetail.code] || track.latestStatusDetail && track.latestStatusDetail.description || 'Unknown',43 service: track.serviceDetail && track.serviceDetail.description || 'Unknown Service',44 estimated_delivery: track.dateAndTimes45 ? (track.dateAndTimes.find(d => d.type === 'ESTIMATED_DELIVERY') || {}).dateTime || 'N/A'46 : 'N/A',47 last_event: latestEvent.eventDescription || 'No events',48 last_location: latestEvent.scanLocation49 ? `${latestEvent.scanLocation.city || ''}, ${latestEvent.scanLocation.stateOrProvinceCode || ''}`50 : 'Unknown'51 };52});Pro tip: For bulk tracking of multiple packages, pass all tracking numbers in the trackingInfo array in a single request rather than looping individual requests. FedEx allows up to 30 per request, which is far more efficient than 30 separate API calls and avoids rate limiting.
Expected result: The tracking query returns structured data for each tracking number including status, service type, estimated delivery date, and last scan location. The data is formatted and ready for display in a Retool Table.
Build the rate calculation query
Create a rate query for calculating shipping options. Set method to POST, path to '/rate/v1/rates/quotes', and include the Authorization header. The FedEx Rate API request body requires an 'accountNumber' object (your FedEx account number), 'requestedShipment' object with origin and destination addresses, ship date, and packaging details including weight and dimensions. The 'requestedPackageLineItems' array defines the package — include 'weight' (in LBS or KG), 'dimensions' (length, width, height in IN or CM), and 'declaredValue' if needed. Set 'rateRequestType' to 'LIST' to get standard list rates, or 'ACCOUNT' to get your negotiated account rates. The response includes 'rateReplyDetails' array with each available service showing serviceType, commit times, and a 'ratedShipmentDetails' array with the rate amounts. Add a transformer that extracts service name, transit days, and total charge from each rate option into a flat array for display in a sortable Retool Table.
1// POST /rate/v1/rates/quotes2// Headers: Authorization: Bearer {{ appState.fedex_token }}3// Body (JSON):4{5 "accountNumber": {6 "value": "{{ retoolContext.configVars.FEDEX_ACCOUNT_NUMBER }}"7 },8 "requestedShipment": {9 "shipper": {10 "address": {11 "postalCode": "{{ originZip.value }}",12 "countryCode": "US"13 }14 },15 "recipient": {16 "address": {17 "postalCode": "{{ destZip.value }}",18 "countryCode": "US",19 "residential": {{ isResidential.value || false }}20 }21 },22 "pickupType": "DROPOFF_AT_FEDEX_LOCATION",23 "rateRequestType": ["ACCOUNT", "LIST"],24 "requestedPackageLineItems": [{25 "weight": {26 "units": "LB",27 "value": {{ weightInput.value || 1 }}28 },29 "dimensions": {30 "length": {{ lengthInput.value || 12 }},31 "width": {{ widthInput.value || 12 }},32 "height": {{ heightInput.value || 12 }},33 "units": "IN"34 }35 }]36 }37}Pro tip: FedEx rate quotes for residential addresses include a residential delivery surcharge. Set 'residential: true' in the recipient address when shipping to homes rather than businesses to get accurate pricing. The difference can be $4-6 per package, which matters for high-volume shippers.
Expected result: The rate query returns a table of available FedEx service options with transit times and pricing for the entered package specifications. The cheapest and fastest options are clearly identifiable from the sortable results.
Assemble the tracking dashboard with exception highlighting
Build a Retool Container with two panels: a tracking overview Table and a shipment detail panel. The Table shows all shipments from your orders database joined with FedEx tracking status — use a JavaScript query to merge order data (from your database Resource) with the tracking response. Configure row colors in the Table based on the status_code field: green for 'DE' (Delivered), blue for 'OD' (Out for Delivery), yellow for 'IT' (In Transit), and red for 'SE' (Exception) or 'DL' (Delay). When a user selects a row, the detail panel displays the full tracking event history from the trackingEventDetails array, showing each scan with timestamp, event description, and location. Add Retool Stat components at the top of the dashboard showing count of shipments by status category. For proactive exception management, add a Retool Workflow (scheduled daily) that queries all active shipments, identifies exceptions, and posts a summary to a Slack channel using the Slack resource.
1// JavaScript query: merge database orders with FedEx tracking data2const orders = getOrders.data || [];3const trackingData = {};45// Build lookup from tracking results6(getFedExTracking.data || []).forEach(t => {7 trackingData[t.tracking_number] = t;8});910return orders.map(order => {11 const tracking = trackingData[order.tracking_number] || {};12 return {13 order_id: order.id,14 customer_name: order.customer_name,15 tracking_number: order.tracking_number,16 order_date: order.created_at,17 status: tracking.status || 'Not Tracked',18 status_code: tracking.status_code || '',19 estimated_delivery: tracking.estimated_delivery || 'Unknown',20 last_event: tracking.last_event || '',21 last_location: tracking.last_location || '',22 is_exception: ['SE', 'DL'].includes(tracking.status_code)23 };24}).sort((a, b) => (b.is_exception ? 1 : 0) - (a.is_exception ? 1 : 0));Pro tip: For large order volumes (hundreds of shipments), batch your tracking numbers into groups of 30 and run multiple tracking queries in sequence using Retool Workflows. The Workflow can store combined results in a Retool database table that the dashboard reads from, rather than fetching live from FedEx on every page load.
Expected result: The dashboard displays all active shipments with color-coded status, exception shipments sorted to the top, and a detail panel showing full tracking history for the selected shipment.
Common use cases
Build a shipment status monitoring dashboard
Load a list of active FedEx tracking numbers from your order management database or a manually maintained Retool table. For each tracking number, query the FedEx Tracking API to get current status, estimated delivery date, and the latest tracking event. Display all shipments in a Retool Table with color-coded status indicators — green for on-time, yellow for delayed, red for exception or failed delivery — giving the fulfillment team a real-time view of all outbound packages.
Build a Retool FedEx tracking dashboard that accepts a list of tracking numbers from a connected database query, fetches current status for each from the FedEx Tracking API, and displays them in a Table with columns for tracking number, recipient, status, last event, and estimated delivery date. Color-code rows based on delivery status.
Copy this prompt to try it in Retool
Create a shipping rate calculator and comparison tool
Build a Retool form where warehouse staff enter package weight, dimensions, origin, and destination ZIP codes, then click to see all available FedEx service options with pricing. Display service options (FedEx Ground, Express Saver, 2Day, Priority Overnight) with their transit times and rates in a sortable table. Allow staff to select the best option and proceed to shipment creation, reducing manual lookup time and shipping cost errors.
Create a Retool shipping rate calculator with inputs for origin ZIP, destination ZIP, package weight (lbs), and dimensions (L x W x H in inches). Query the FedEx Rate API and display available shipping services in a Table sorted by price, showing service name, transit days, and rate. Include a 'Select' button on each row.
Copy this prompt to try it in Retool
Build an exception management and delivery alert panel
Query all shipments with 'exception' or 'delivery_failed' status from the FedEx Tracking API. Display these in a prioritized exception panel showing the tracking number, customer name (from your order database), exception type, and recommended next action. Allow the operations team to initiate address correction requests or schedule redeliveries directly from the Retool interface by triggering FedEx ship management API calls.
Build a Retool delivery exception dashboard that shows all FedEx shipments with exception statuses, linked to customer order data from the database. Display exception type, affected customer, tracking number, and days since exception. Include action buttons to copy the FedEx tracking URL and log a note in the order record.
Copy this prompt to try it in Retool
Troubleshooting
Token fetch returns 401 Unauthorized or 'invalid_client' error
Cause: The API key or secret key is incorrect, the project credentials belong to a different environment than the base URL being used, or the credentials have been regenerated since they were stored.
Solution: Verify your credentials in the FedEx Developer Portal: navigate to your API project and check the API key. If the secret was generated again after initial setup, update the FEDEX_SECRET_KEY configuration variable in Retool Settings. Confirm you are using the Test environment URL (apis-sandbox.fedex.com) with Test credentials, or the Production URL (apis.fedex.com) with Production credentials — mixing environments is the most common cause of this error.
Tracking query returns 401 or 'token.expired' error mid-session
Cause: FedEx OAuth tokens expire after one hour. If the page has been open longer than an hour without a token refresh, all subsequent queries will fail with authentication errors.
Solution: Add a token expiry check at the start of each operational query. Before making tracking or rate calls, run a JavaScript query that compares the stored token expiry time (appState.fedex_token_expires) against Date.now(). If the token expires within the next 5 minutes, trigger the token fetch query first. Alternatively, enable 'Run this query on page load' on the token fetch query and set the page to auto-refresh every 50 minutes.
1// Check token validity before each API call2const expiresAt = appState.fedex_token_expires || 0;3if (Date.now() > expiresAt - 300000) {4 // Token expires in < 5 min, refresh it5 await getToken.trigger();6}Rate query returns 'SERVICE.RATE.ERROR' or no rateReplyDetails in response
Cause: The account number is not properly associated with the API credentials, the package dimensions or weight are outside valid ranges, or a required field in the request body is missing.
Solution: Verify your FedEx account number is correctly stored in configuration variables. Check that weight is greater than 0 and dimensions are positive integers. FedEx requires all three dimensions and weight for accurate rates — if any are zero or missing, the rate engine may return errors or no results. For simple scenarios, set a minimum weight of 0.5 LB to ensure at minimum one service is returned.
Tracking returns 'TRACKING.TRACKINGNUMBER.NOTFOUND' for a valid package
Cause: The tracking number may be too new (FedEx tracking data becomes available after the label is scanned, not at label creation), or the package belongs to a different carrier but was entered in the FedEx tracking query.
Solution: FedEx tracking data typically becomes available 2-4 hours after label creation when the first scan occurs. Verify the carrier by checking the tracking number format — FedEx Express uses 12-digit numbers starting with '7', FedEx Ground uses 15-22 digit numbers starting with '96'. If the number format does not match FedEx's patterns, it may be a UPS or other carrier shipment entered incorrectly.
Best practices
- Store FedEx API key and secret in Retool configuration variables as secrets — these credentials can be used to create real shipments billed to your FedEx account and must not be exposed in frontend code
- Always check token expiry before making FedEx API calls and refresh proactively before the one-hour limit — implementing token management at the query level prevents mid-session authentication failures
- Batch tracking number requests up to 30 per API call rather than making individual requests per shipment — batching is more efficient, faster, and avoids rate limit issues for dashboards tracking many packages
- Use the FedEx sandbox environment (apis-sandbox.fedex.com) for all development and testing — sandbox tracking numbers like '449044304137821' return realistic test data without affecting your production account
- Cache rate quotes for a given origin/destination/package combination for 15-30 minutes — FedEx rates change daily but not within a session, and repeated rate calls slow the user experience unnecessarily
- Include residential vs. commercial address detection in your rate queries — residential surcharges can add $4-6 per package, making accurate addressing critical for cost estimates
- Use Retool Workflows for exception monitoring rather than real-time dashboard polling — schedule a Workflow to check tracking status every few hours and send Slack or email alerts for exceptions, keeping the dashboard load fast without constant API calls
Alternatives
UPS offers a very similar REST API with OAuth 2.0 authentication for domestic and international shipping, making it a natural alternative or complement when your business uses both carriers.
ShipStation aggregates multiple carriers including FedEx into a single API with simpler authentication, making it better suited if you need multi-carrier shipping management without managing separate carrier API credentials.
Shippo provides a unified API for rate comparison and label generation across FedEx, UPS, USPS, and other carriers with a simpler API key authentication model, better suited for teams wanting multi-carrier support without managing individual carrier credentials.
Frequently asked questions
Does Retool have a native FedEx connector?
No, Retool does not have a native FedEx connector. You connect using a REST API Resource with FedEx's OAuth 2.0 token-based authentication. The integration requires an initial token-fetch step before making tracking, rate, or shipping API calls, but once configured the REST API Resource provides access to all FedEx API capabilities.
Can I create actual FedEx shipping labels from Retool?
Yes. FedEx's Ship API supports shipment creation and label generation. Use POST to /ship/v1/shipments with a complete shipment object including shipper and recipient addresses, package details, service type, and account number. The response includes a label in Base64 or a URL for download. This is a billable operation that creates real FedEx shipments — always test against the sandbox environment before using in production.
How do I track multiple packages at once rather than one at a time?
The FedEx Track API supports batch tracking of up to 30 tracking numbers in a single POST request. Include all tracking numbers as separate objects in the trackingInfo array. This is significantly more efficient than individual requests. For dashboards tracking hundreds of packages, split your tracking numbers into batches of 30 and run sequential queries, or use a Retool Workflow to process all batches and cache results.
Can I use the FedEx API without a FedEx account?
You need a FedEx account number to create shipments and access account-specific negotiated rates. However, the tracking and rate list price APIs can be used with developer credentials alone for reading publicly available tracking data and standard list rates. Register at developer.fedex.com and link your existing FedEx business account to get full API access including your negotiated rates.
What is the difference between FedEx Test and Production environments?
The FedEx sandbox (apis-sandbox.fedex.com) uses separate credentials and simulated data — tracking numbers return pre-defined test responses, and no real shipments or charges are created. Production (apis.fedex.com) connects to live FedEx systems where shipment creation results in real labels and billing. Always develop and test against the sandbox environment, then create a separate set of Production credentials in the Developer Portal when ready to go live.
Talk to an Expert
Our team has built 600+ apps. Get personalized help with your project.
Book a free consultation