FedEx Shipping API Guide: How to Get Rates and Create Shipping Labels
To get FedEx shipping rates and create labels, set up a FedEx Developer Portal project, obtain an OAuth access token, request quotes from the Rates and Transit Times API, then submit a shipment to the Ship API with the selected service and label specifications. A rate quote does not create a shipment: your application must make a separate shipping request and handle its response before treating a label as ready to use.

This guide is for developers and shipping teams building a checkout, order-management, or fulfillment workflow. It focuses on the decisions and checks that make an integration reliable, rather than presenting a sample payload that may not match your account, service, or destination.
Before you make an API request
Start in the FedEx Developer Portal. You need a project with access to the relevant APIs, credentials for the environment you are using, and the FedEx account information required for your integration. Follow the portal’s setup instructions for your account; credential arrangements can differ by project and account configuration. Keep secrets on your server, not in browser code or a public repository.
Prepare a shipment record before calling the rate endpoint. At minimum, your application should know the origin and destination, the intended ship date, package count, each package’s weight and dimensions, and the billing account to use. Some services or destinations require more information. If you quote using estimated package data but create the label using different measurements, the quote may no longer represent the shipment you are buying.
FedEx publishes separate documentation for the Authorization API, Rates and Transit Times API, and Ship API. Use the documentation for the API version and environment configured in your project as the authority for required fields, allowed values, and responses.
Step 1: Authenticate with FedEx
FedEx API requests use an OAuth access token. Your backend obtains a token using its configured credentials and sends that token in the Authorization header of subsequent API requests. Store the token securely and obtain a new one when it expires; do not request a fresh token for every package if a valid token can be reused.
Keep sandbox and production credentials and endpoints separate. A successful sandbox request shows that your application can send a valid test request; it does not, by itself, confirm that production credentials, billing, services, or destination rules are ready. Before launch, verify that your production project has the necessary API access and that the intended FedEx account is correctly associated with it.
Implementation check: Log the request identifier and error details needed for debugging, but redact access tokens, client secrets, and sensitive address information from routine logs.
Step 2: Request rates for the shipment you plan to create
Use the Rates and Transit Times API to ask FedEx for applicable shipping options. Build the request from the same shipment data your label workflow will use: shipper and recipient addresses, package characteristics, pickup or drop-off context, and account information. Specify a service when the user has already chosen one, or request available options when your checkout needs to present a choice. Consult the rate documentation for the supported request structure and service-specific requirements.
Think of a rate response as a set of candidates, not a final shipping purchase. Your application should retain enough information about the selected option to create the corresponding shipment later. When presenting quotes, show the service name and relevant cost details clearly. If your checkout needs an estimated delivery date, confirm which transit information the response supplies rather than assuming every quote includes the same delivery commitment.
Rate amounts need careful interpretation. FedEx documentation distinguishes among rate types and charge details; the value appropriate for your business may depend on the account, the requested rate type, and the amount your checkout intends to display. A quoted transportation charge should not automatically be treated as the final customer-facing total. Customs duties, taxes, surcharges, or other charges may depend on shipment details and billing arrangements. Decide explicitly whether your checkout displays a carrier quote, a shipping charge set by your business, or another amount.
Save a snapshot of the inputs used to quote. If the customer changes the address, package contents, or shipping method, request rates again before creating the label. This prevents a common integration failure: selecting a service for one shipment and submitting a materially different shipment to the Ship API.
What to validate before choosing a quote
- Addresses: Check that the country, postal code, state or province, and city fields are suitable for the destination and service.
- Packages: Confirm that weight and dimensions use the units you intended and that multi-piece shipments are represented correctly.
- Service: Make sure the selected service is returned for the actual origin, destination, and package characteristics.
- Charges: Identify the specific amount and rate type you will store or display; do not choose a field solely because it is the first monetary value in the response.
- Timing: Recheck rates if the planned ship date or fulfillment circumstances change before label creation.
Step 3: Create the shipment and request a label
When the order is ready to ship, submit a request to the Ship API. Include the final sender and recipient details, the chosen service, package information, payment and account information, and label specifications. The Ship API documentation describes the supported label formats, image types, and label stock options. Select a combination your printing workflow can actually use, and test the printed output on the intended printer and stock.
Do not assume that the rate request can be copied unchanged into the shipping request. The APIs serve different purposes and have different schemas. The shipping request may also need operational information that was not required to compare rates, such as contact details, customs information for an international shipment, or service-specific options. Build each request against its own documented schema, while keeping shared shipment facts consistent.
After a successful response, capture the shipment identifiers and the label data or retrieval details supplied for that transaction. Check the actual response before marking the order as labeled. Depending on the shipment and processing path, label handling may not be identical for every request; your integration should follow the response and the Ship API documentation rather than assuming that every call returns a printable file in the same form.
Store labels and shipment references according to your organization’s retention and access rules. A label contains address information, so avoid placing its contents in unrestricted logs or analytics events. If your system supports reprinting, retrieve the stored label or use the relevant FedEx-supported workflow; do not silently create a second shipment simply because a user clicked Print twice.
Build for failure as well as success
The most consequential error is an uncertain result. If your application times out after submitting a Ship API request, it may not know whether FedEx processed the shipment. Blindly resending the same request can create an unwanted second shipment or label. Record the request and its state, check any returned identifiers, and use the applicable FedEx retrieval or support workflow to resolve uncertainty before retrying. Design this recovery path before enabling automatic retries in production.
Handle validation errors separately from temporary failures. A missing or invalid address field calls for corrected shipment data; retrying the same payload will not fix it. Authentication errors call for checking credentials and token handling. Temporary network failures call for bounded retries and investigation when the outcome of a shipping request is unclear. Keep an internal state such as quote requested, service selected, shipment submitted, and label confirmed so an operator can see where an order stopped.
For international shipments, plan additional checks before label creation. Commodity descriptions, declared values, customs documentation, and payer information may be relevant to the shipment. Requirements vary with the destination, service, and shipment contents. Treat an international label as its own tested workflow rather than assuming that a domestic payload only needs a different country code.
A practical test plan before launch
A passing request is not enough. Test the full sequence from order data to a legible printed label, and compare the shipment you created with the quote your user selected.
- Start with a straightforward domestic shipment. Obtain a token, request rates, choose a returned service, create the shipment, and inspect the resulting label and identifiers.
- Vary the package. Test different weights, dimensions, and package counts relevant to your operation. Confirm that the displayed amount corresponds to the rate response your application selected.
- Exercise address validation. Submit incomplete or inconsistent address data in the test environment and verify that errors are understandable to the person who can correct the order.
- Test the printing path. Confirm label dimensions, orientation, barcode clarity, and any document handling required by your warehouse workflow.
- Test interrupted requests. Simulate expired tokens, network timeouts, and a lost response after shipment submission. Verify that retries do not silently create duplicates.
- Test each real shipping scenario. Include international destinations, special services, and multi-piece shipments only if your business uses them, and check the documentation for their additional fields.
The simplest architecture is a server-side workflow in which your checkout or order system sends validated shipment data to your backend, your backend calls FedEx, and the resulting quote and label status return to the order system. Keep the customer-facing rate decision separate from the fulfillment action: quoting helps choose a service; creating the shipment commits your operational workflow to that choice.
FAQ
Does the FedEx Rates and Transit Times API create a shipping label?
No. Use it to request rate and transit information. Create the shipment and request the label through the Ship API.
Can I use a sandbox label to ship a real package?
Do not treat a sandbox result as a production shipment. Use production credentials and the appropriate production workflow for packages you intend to hand to FedEx.
Why does my label request fail after I received a rate?
A successful quote does not guarantee that a separate Ship API request is complete or valid. Compare the two requests for differences in addresses, package details, service selection, billing information, and required shipping fields. Then use the Ship API error response to identify what needs correction.
Should I store the first rate returned by the API?
No. Choose the rate type and service deliberately, based on what your application needs to display and purchase. Preserve the selected service and the underlying quote details so you can review discrepancies during fulfillment.
What should I do if a label request times out?
Do not immediately submit it again. First determine whether the original request created a shipment, using any identifiers you received and the applicable FedEx workflow. Retry only after you have resolved the uncertain outcome.


