FedEx Integration Guide
Connect FTM’s Transportation Management System (TMS) with FedEx Freight APIs to request real-time LTL rate quotes, including Economy and Priority services.
Overview
The FedEx Freight integration enables FTM users to obtain live rate quotes and transit times directly from FedEx Freight.
Each Lane Quote record can retrieve:
- Accurate Freight charges (Net Charge)
- Estimated Transit Days
- Service Type (Economy or Priority)
This integration consists of two Apex controllers:
- FedexEconomyInteg → For FEDEX_FREIGHT_ECONOMY quotes
- FedexPriorityInteg → For FEDEX_FREIGHT_PRIORITY quotes
Both controllers build, authenticate, and send JSON-based API requests to FedEx, parse the returned rate information, and display the results in Salesforce.
1️⃣ User Information
Purpose
The integration helps users:
- Instantly get Economy and Priority rate quotes within the Lane Quote page.
- Retrieve estimated transit days and total net charge directly from FedEx.
- Avoid manual rate entry or website lookups.
How It Works (User Perspective)
- Open any Lane Quote record in FTM.
- Choose between Economy or Priority quote options.
- Click the “Get Data” button on the Visualforce page:
- For Economy: runs FedexEconomyInteg.getData()
- For Priority: runs FedexPriorityInteg.getData()
- FTM sends your lane’s details (pickup, delivery, freight class, weight, packaging, dimensions, payment type) to FedEx via API.
- Within seconds, the Total Net FedEx Charge and Transit Days are displayed.
- Optional: store these values into the Lane Quote for comparison and decision-making.
Key Features
✅ Supports both Economy and Priority Freight services
✅ Fetches real-time rates from FedEx API
✅ Displays Transit Days and Charges directly in Salesforce
✅ Uses secure OAuth2 authentication
✅ Fully configurable via FTM’s standard Lane Quote fields
✅ Compatible with sandbox and production environments
Important Notes
⚠️ U.S. and Canada addresses only (FedEx Freight service limitation)
⚠️ Requires a valid FedEx Freight Account Number (stored under User fields)
⚠️ No booking is performed, rate quote only
⚠️ Internet-accessible Salesforce org required (for API callouts)
Prerequisites
To use this integration:
- Ensure your User record has these populated:
- FEDEX_AccountNumber__c
- alternateBillingParty_FedExaccountNumber__c
- Ensure your Lane Quote record has valid:
- Pickup & Delivery Address (City, State, Zip, Country)
- Freight Class
- Weight & Dimensions
- Handling Units, Pieces, Sub-Packaging Type
- Payment Type (e.g. “SENDER”, “THIRD_PARTY”)
- Verify you have access to the Visualforce pages connected to each integration.
Fields Used
| Object | Field | Description |
| FreightTM__Lane_Quote__c | FreightTM__Pickup_City__c | Origin City |
| FreightTM__Lane_Quote__c | FreightTM__Delivery_City__c | Destination City |
| FreightTM__Lane_Quote__c | FreightTM__Pickup_Zip_Code__c | Origin Zip |
| FreightTM__Lane_Quote__c | FreightTM__Delivery_Zip_Code__c | Destination Zip |
| FreightTM__Lane_Quote__c | Freight_Class__c | Freight Class Code |
| FreightTM__Lane_Quote__c | Weight_Value__c | Weight Value |
| FreightTM__Lane_Quote__c | weight_unit__c | Weight Unit (e.g., LB) |
| FreightTM__Lane_Quote__c | Pieces__c | Number of Pieces |
| FreightTM__Lane_Quote__c | Handling_Units__c | Handling Units Count |
| FreightTM__Lane_Quote__c | Sub_Packaging_Type__c | Packaging Type (PALLET, BOX, etc.) |
| FreightTM__Lane_Quote__c | FEDEX_PaymentType__c | Payment Type |
| FreightTM__Lane_Quote__c | Role__c | Role (SHIPPER / CONSIGNEE) |
| FreightTM__Lane_Quote__c | Rate_Request_Type__c | ACCOUNT / LIST |
| FreightTM__Lane_Quote__c | length__c, width__c, height__c, Saia_Type__c | Dimensions & Units |
2️ Developer Information
Apex Classes
- FedexEconomyInteg
- FedexPriorityInteg
Each controller:
- Extends ApexPages.StandardController
- Fetches data for the current Lane Quote (quoteId)
- Builds request JSON dynamically using Lane Quote and User fields
- Performs two-step authentication:
- POST /oauth/token → get Bearer Token
- POST /rate/v1/freight/rates/quotes → send quote request
- Parses totalNetFedExCharge and transitDays from response
Endpoints
| Purpose | Method | URL |
| OAuth Token | POST | https://apis.fedex.com/oauth/token |
| Freight Rate Quote | POST | https://apis.fedex.com/rate/v1/freight/rates/quotes |
Authentication (OAuth 2.0)
- Create a FedEx Developer account and register your app.
- Obtain:
- CLIENT_ID
- CLIENT_SECRET
- GRANT_TYPE = client_credentials
- Store them in a static resource named CredFed as JSON:
{
"CLIENT_ID": "your_client_id_here",
"CLIENT_SECRET": "your_secret_here",
"GRANT_TYPE": "client_credentials"
}
4. The Apex code reads it using:
PageReference credentialsPageRef = new PageReference('/resource/CredFed');
String credentialsContent = credentialsPageRef.getContent().toString();

API Request Structure
Endpoint:
POST https://apis.fedex.com/rate/v1/freight/rates/quotes
Body Example (simplified):
{
"rateRequestControlParameters": { "returnTransitTimes": true },
"accountNumber": { "value": "773496030" },
"freightRequestedShipment": {
"serviceType": "FEDEX_FREIGHT_PRIORITY",
"shipper": {
"address": {
"city": "Irving",
"stateOrProvinceCode": "TX",
"postalCode": "75063",
"countryCode": "US"
}
},
"recipient": {
"address": {
"city": "Beverly",
"stateOrProvinceCode": "MA",
"postalCode": "01915",
"countryCode": "US"
}
},
"shippingChargesPayment": {
"paymentType": "SENDER",
"payor": {
"responsibleParty": {
"accountNumber": { "value": "00702520" }
}
}
},
"freightShipmentDetail": {
"role": "SHIPPER",
"alternateBillingParty": {
"accountNumber": { "value": "00702520" },
"address": {
"streetLines": ["314 N MIDDLETOWN RD"],
"city": "MEDIA",
"stateOrProvinceCode": "PA",
"postalCode": "19063",
"countryCode": "US"
}
},
"lineItem": [{
"freightClass": "CLASS_050",
"handlingUnits": "1",
"pieces": 1,
"subPackagingType": "PALLET",
"id": "books",
"weight": { "units": "LB", "value": "1200.00" },
"dimensions": { "length": 40, "width": 69, "height": 48, "units": "IN" }
}]
},
"rateRequestType": ["ACCOUNT"]
}
}
Response Example
{
"transactionId": "abcd123",
"output": {
"rateReplyDetails": [
{
"serviceType": "FEDEX_FREIGHT_PRIORITY",
"ratedShipmentDetails": [
{
"totalNetFedExCharge": 1200.50,
"totalBaseCharge": 1100.00
}
],
"commit": {
"transitDays": {
"description": "2 business days"
}
}
}
]
}
}
Parsed Fields
| JSON Field | Description | Used For |
| output.rateReplyDetails[0].ratedShipmentDetails[0].totalNetFedExCharge | Total charge in USD | Display/Store in FTM |
| output.rateReplyDetails[0].commit.transitDays.description | Transit time text | Extracted as number (e.g., 2) |
| serviceType | FEDEX_FREIGHT_PRIORITY / ECONOMY | Internal reference |
Implementation Notes
- Both classes are global virtual for easy extension.
- FedEx credentials are read from a static resource (CredFed).

- ServiceType differs per integration class:
- FedexEconomyInteg → “FEDEX_FREIGHT_ECONOMY”
- FedexPriorityInteg → “FEDEX_FREIGHT_PRIORITY”
- Handles dynamic country-to-code mapping for 200+ countries.
- Parses and extracts numeric days from text like “2 business days”.
- Displays callout result in Visualforce, optionally updating fields.
Error Handling
| Error | Meaning | Suggested Action |
| 401 Unauthorized | Invalid credentials | Verify CLIENT_ID / CLIENT_SECRET |
| 403 Forbidden | FedEx account not authorized for Freight API | Contact FedEx support |
| 400 Bad Request | Missing required address/fields | Check Lane Quote inputs |
| 500 Server Error | FedEx API temporary issue | Retry after short delay |
Testing
You can simulate requests using a test Lane Quote ID:
FedexPriorityInteg.makeCallout(‘a0HXXXXXXXXXXXX’);
FedexEconomyInteg.makeCallout(‘a0HXXXXXXXXXXXX’);
Or run directly from the Visualforce button “Get Data”.
Deployment Checklist
✅ Add Remote Site Settings for https://apis.fedex.com
✅ Upload CredFed static resource (JSON credentials)
✅ Ensure Lane Quote page references the correct Visualforce page (FedexPriorityInteg.page, FedexEconomyInteg.page)
✅ Verify user field permissions for:
- FEDEX_AccountNumber__c
- alternateBillingParty_FedExaccountNumber__c
✅ Ensure Apex class access is granted to target profiles
Support
📧 FTM Integration Support: [email protected]
📧 FedEx Developer Support: [email protected]