FedEx (Apps step)

Updated Nov 23, 2026
DataMagik Automate

FedEx

Tracks FedEx packages, quotes rates, creates shipments with labels and checks addresses through the FedEx REST APIs.

Use it to ship and follow FedEx packages from a workflow: print a label when an order is packed, compare service prices, or check every open shipment's tracking status each morning.

Beta. This step has not yet been checked against a live FedEx account, so treat its first runs as a test, and tell us if an operation does not answer as described.

Find it in the workflow editor's palette under Apps. See Apps steps for what every Apps step has in common.

Set it up

  1. Sign in at developer.fedex.com, open My Projects › Create a project, choose the Track, Rate, Ship and Address Validation APIs the workflow uses, and link the FedEx account number the plant ships on.
  2. Copy the project's API Key and Secret Key (the test keys work only against apis-sandbox.fedex.com; production keys come after FedEx moves the project to production).
  3. In DataMagik, open Script Engine › Credentials and add an OAuth 2.0 credential with grant "Client credentials", the API Key as the client ID and the Secret Key as the client secret, token URL https://apis.fedex.com/oauth/token, the client sent in the body, and the scope left empty.
  4. Add apis.fedex.com (or apis-sandbox.fedex.com for testing) to Allowed Domains in the workflow's Script settings.

Credential: An OAuth 2.0 client credentials credential for a FedEx developer project: its API Key as the client ID and Secret Key as the client secret, sent in the body to the FedEx token URL.

Signing in with OAuth 2.0

Grant typeClient credentials
Token URLhttps://apis.fedex.com/oauth/token
ScopeLeave it empty.

FedEx takes no scope, so leave the credential's Scope empty. FedEx reads the client ID and secret as form fields, so set the credential to send the client in the body, not as a Basic header. The sandbox token URL is https://apis-sandbox.fedex.com/oauth/token. The app signs in as itself, so no one clicks Connect.

Hosts it calls: apis.fedex.com, apis-sandbox.fedex.com

Connection

FieldRequiredWhat to put
FedEx environmentYesapis.fedex.com for real shipments; apis-sandbox.fedex.com for FedEx's test environment, with the project's test keys in a credential whose token URL is https://apis-sandbox.fedex.com/oauth/token. For example apis.fedex.com.

Operations

OperationWhat it does
Tracking › TrackReads the status and scan history of up to 30 packages by their tracking numbers.
Rating › RateQuotes the price of a shipment for one FedEx service, or for every service when the request names none.
Shipping › ShipCreates a shipment and its labels; on apis.fedex.com the shipment is real and billed to the account.
Address › ValidateChecks and standardizes addresses and tells a business from a residence.

Tracking › Track

Reads the status and scan history of up to 30 packages by their tracking numbers.

Calls POST /track/v1/trackingnumbers.

FieldRequiredWhat to put
Tracking numbersYesA JSON list with one {"trackingNumberInfo": {"trackingNumber": "…"}} entry per package, at most 30, as in the placeholder. For example [{"trackingNumberInfo": {"trackingNumber": "{{ $json.tracking_no }}"}}].
Include every scanNoOn, each package comes with its full scan history; off, only its latest status.

What comes out: One item per tracking number: {{ $json.trackingNumber }} and {{ $json.trackResults }}, whose first entry holds {{ $json.trackResults[0].latestStatusDetail.description }} (such as Delivered) and its code ({{ $json.trackResults[0].latestStatusDetail.code }}, DL when delivered), {{ $json.trackResults[0].dateAndTimes }} and, with every scan included, {{ $json.trackResults[0].scanEvents }}. A number FedEx does not know has {{ $json.trackResults[0].error }} instead.

Example: Track the day's tracking numbers in one call and email customer service the ones whose status code is DE (delivery exception).

Rating › Rate

Quotes the price of a shipment for one FedEx service, or for every service when the request names none.

Calls POST /rate/v1/rates/quotes.

FieldRequiredWhat to put
Rate requestYesThe whole request body, as in the FedEx Rate API reference. Leave serviceType out to get every service; add "serviceType": "FEDEX_GROUND" to price only that one. For example {"accountNumber": {"value": "123456789"}, "requestedShipment": {"shipper": {"address": {"postalCode": "46526", "countryCode": "US"}}, "recipient": {"address": {"postalCode": "{{ $json.zip }}", "countryCode": "US"}}, "pickupType": "DROPOFF_AT_FEDEX_LOCATION", "rateRequestType": ["ACCOUNT"], "requestedPackageLineItems": [{"weight": {"units": "LB", "value": {{ $json.weight }}}}]}}.

What comes out: One item per FedEx service quoted: {{ $json.serviceType }} (such as FEDEX_GROUND), {{ $json.serviceName }} and {{ $json.ratedShipmentDetails }}, whose entries hold {{ $json.ratedShipmentDetails[0].totalNetCharge }} and {{ $json.ratedShipmentDetails[0].rateType }} (ACCOUNT for your rate, LIST for the list price).

Example: Rate each order's ZIP code and weight with no service named, then keep the cheapest quote for the order.

Shipping › Ship

Creates a shipment and its labels; on apis.fedex.com the shipment is real and billed to the account.

Calls POST /ship/v1/shipments.

FieldRequiredWhat to put
Shipment requestYesThe whole request body, as in the FedEx Ship API reference. labelResponseOptions LABEL returns the label itself; URL_ONLY returns a link to it. imageType PDF, PNG or ZPLII sets the label's format. For example {"labelResponseOptions": "LABEL", "accountNumber": {"value": "123456789"}, "requestedShipment": {"shipper": {…}, "recipients": [{…}], "pickupType": "USE_SCHEDULED_PICKUP", "serviceType": "FEDEX_GROUND", "packagingType": "YOUR_PACKAGING", "shippingChargesPayment": {"paymentType": "SENDER"}, "labelSpecification": {"imageType": "ZPLII", "labelStockType": "STOCK_4X6"}, "requestedPackageLineItems": [{"weight": {"units": "LB", "value": {{ $json.weight }}}}]}}.

What comes out: One item: FedEx's answer. The shipment is {{ $json.output.transactionShipments[0] }}, with {{ $json.output.transactionShipments[0].masterTrackingNumber }}; each package is in its pieceResponses, and the label is {{ $json.output.transactionShipments[0].pieceResponses[0].packageDocuments[0].encodedLabel }}, base64 text in the format asked for (or .url with URL_ONLY), not a file.

Example: When an order is packed, Ship it with a ZPLII label, save the master tracking number on the order, and send the decoded label to the dock's Zebra printer.

Address › Validate

Checks and standardizes addresses and tells a business from a residence.

Calls POST /address/v1/addresses/resolve.

FieldRequiredWhat to put
Address requestYesThe whole request body, as in the FedEx Address Validation API reference: one entry in addressesToValidate per address. For example {"addressesToValidate": [{"address": {"streetLines": ["{{ $json.street }}"], "city": "{{ $json.city }}", "stateOrProvinceCode": "{{ $json.state }}", "postalCode": "{{ $json.zip }}", "countryCode": "US"}}]}.

What comes out: One item per address checked: the standardized {{ $json.streetLinesToken }}, {{ $json.city }}, {{ $json.stateOrProvinceCode }}, {{ $json.postalCode }} and {{ $json.countryCode }}, {{ $json.classification }} (BUSINESS, RESIDENTIAL, MIXED or UNKNOWN) and {{ $json.attributes }} with FedEx's findings, such as whether the address resolved.

Example: Validate each new ship-to address and set the order's residential flag from {{ $json.classification }} before rating it.

Example

A Schedule trigger lists yesterday's FedEx shipments from Plex; FedEx › Track reads up to 30 tracking numbers in one call, and each number whose {{ $json.trackResults[0].latestStatusDetail.code }} is DL (delivered) is marked delivered on the order.

Tips

  • The Rate, Ship and Validate address bodies are the JSON FedEx documents for each API; copy the example from the FedEx API reference and put {{ }} expressions where the order's values go.
  • Your FedEx account number goes in the body as {"accountNumber": {"value": "123456789"}} for Rate and Ship.
  • FedEx answers an error with HTTP 400 and an errors list ({{ $json.errors[0].code }} and message); turn off "Fail on a non-2xx response" to handle it in the workflow.
  • Ship creates a real, billed shipment on apis.fedex.com, on test runs too: build and test the workflow against apis-sandbox.fedex.com first.

Settings every Apps step has

  • More query parameters: any query parameter the fields do not offer, sent as is.
  • More body fields: a JSON object merged into the request body; nested objects merge, other values replace.
  • Most requests per second: spaces the calls out for rate limits. A "too many requests" (429) answer is retried after the wait the API asks for.
  • Most pages: for operations that follow pages, the most pages to fetch (10 unless you change it, up to 100). The run warns when it stops with more to get.
  • Fail on a non-2xx response: on by default. Turn it off to handle errors yourself.

FedEx's own API documentation: https://developer.fedex.com/api/en-us/catalog.html

Was this page helpful?