> ## Documentation Index
> Fetch the complete documentation index at: https://docs.coreflux.org/llms.txt
> Use this file to discover all available pages before exploring further.

# Fed Ex Api

> Client-mode REST API connector for the FedEx Developer Portal APIs: OAuth 2.0 client credentials, tracking (tracking number, reference, TCN, multiple-piece shipments, proof of delivery documents, e-mail notifications), rates and transit times, address and postal code validation, service availability, location search, shipments and labels (purchase), cancel, return tags (purchase), pickups (purchase), Global Trade regulatory details, Advanced Integrated Visibility subscriptions (billed) and trade document upload; companion server connector for AIV tracking webhooks

Technical Preview

## Overview

Client-mode REST API connector for the FedEx Developer Portal APIs: OAuth 2.0 client credentials, tracking (tracking number, reference, TCN, multiple-piece shipments, proof of delivery documents, e-mail notifications), rates and transit times, address and postal code validation, service availability, location search, shipments and labels (purchase), cancel, return tags (purchase), pickups (purchase), Global Trade regulatory details, Advanced Integrated Visibility subscriptions (billed) and trade document upload; companion server connector for AIV tracking webhooks.

This is one of the templates in the FedEx Developer Portal REST API app (`fedex-developer-portal`). Deploy it alongside the other connectors of that app when they depend on each other (for example a token connector plus an API connector).

> [!NOTE]
>
> Not yet verified against the live vendor API: No FedEx developer project (API key / secret key) or FedEx shipping account on the factory box (no FEDEX\_\* variables); only static, mock, negative-control and unauthenticated / fake-credential public probes ran.

## Auth

OAuth 2.0 client credentials (credentials in the form body, client\_secret\_post): GetToken posts grant\_type=client\_credentials\&client\_id\&client\_secret (application/x-www-form-urlencoded) to /oauth/token; GetTokenChild uses client\_pc\_credentials or csp\_credentials + child\_Key + child\_secret. Reply access\_token, token\_type bearer, expires\_in 3600, scope; no refresh token. FedExApi / FedExDocs events: Authorization: Bearer \<access\_token> and x-customer-transaction-id; FedExApi also x-locale en\_US. Every event sends User-Agent: Coreflux-Broker.

Auth headers used by the template: `Authorization: Bearer {value.json.access_token}`.

## Template parameters

| Placeholder | Type | Description | Required |
| - | - | - | - |
| `RouteName` | string | Name of the Fed Ex Api connector | no |
| `BaseUrl` | string | Fed Ex Api base URL without trailing slash (e.g. [https://apis.fedex.com](https://apis.fedex.com)) | yes |

`BASE_ADDRESS` default: `https://apis.fedex.com`.

## Events

| Event | Method | Endpoint | Request topic | Response topic | Payload fields |
| - | - | - | - | - | - |
| `TrackByTrackingNumber` | POST | `/track/v1/trackingnumbers` | `fleet/fedex/track/get` | `fleet/fedex/track/get/response` | `access_token`, `body`, `trans_id` |
| `TrackByReference` | POST | `/track/v1/referencenumbers` | `fleet/fedex/track-reference/get` | `fleet/fedex/track-reference/get/response` | `access_token`, `body`, `trans_id` |
| `TrackByTcn` | POST | `/track/v1/tcn` | `fleet/fedex/track-tcn/get` | `fleet/fedex/track-tcn/get/response` | `access_token`, `body`, `trans_id` |
| `TrackMultiPieceShipment` | POST | `/track/v1/associatedshipments` | `fleet/fedex/track-associated/get` | `fleet/fedex/track-associated/get/response` | `access_token`, `body`, `trans_id` |
| `GetTrackingDocument` | POST | `/track/v1/trackingdocuments` | `fleet/fedex/tracking-document/get` | `fleet/fedex/tracking-document/get/response` | `access_token`, `body`, `trans_id` |
| `SendTrackingNotification` | POST | `/track/v1/notifications` | `fleet/fedex/tracking-notification/create` | `fleet/fedex/tracking-notification/create/response` | `access_token`, `body`, `trans_id` |
| `RateQuote` | POST | `/rate/v1/rates/quotes` | `fleet/fedex/rate/get` | `fleet/fedex/rate/get/response` | `access_token`, `body`, `trans_id` |
| `ValidateAddress` | POST | `/address/v1/addresses/resolve` | `fleet/fedex/address/validate` | `fleet/fedex/address/validate/response` | `access_token`, `body`, `trans_id` |
| `ValidatePostalCode` | POST | `/country/v1/postal/validate` | `fleet/fedex/postal-code/validate` | `fleet/fedex/postal-code/validate/response` | `access_token`, `body`, `trans_id` |
| `GetTransitTimes` | POST | `/availability/v1/transittimes` | `fleet/fedex/transit-time/get` | `fleet/fedex/transit-time/get/response` | `access_token`, `body`, `trans_id` |
| `GetPackageAndServiceOptions` | POST | `/availability/v1/packageandserviceoptions` | `fleet/fedex/service-option/get` | `fleet/fedex/service-option/get/response` | `access_token`, `body`, `trans_id` |
| `GetSpecialServiceOptions` | POST | `/availability/v1/specialserviceoptions` | `fleet/fedex/special-service-option/get` | `fleet/fedex/special-service-option/get/response` | `access_token`, `body`, `trans_id` |
| `FindLocations` | POST | `/location/v1/locations` | `fleet/fedex/location/search` | `fleet/fedex/location/search/response` | `access_token`, `body`, `trans_id` |
| `ValidateShipment` | POST | `/ship/v1/shipments/packages/validate` | `fleet/fedex/shipment/validate` | `fleet/fedex/shipment/validate/response` | `access_token`, `body`, `trans_id` |
| `CreateShipment` | POST | `/ship/v1/shipments` | `fleet/fedex/shipment/create` | `fleet/fedex/shipment/create/response` | `access_token`, `body`, `trans_id` |
| `GetShipmentResults` | POST | `/ship/v1/shipments/results` | `fleet/fedex/shipment-results/get` | `fleet/fedex/shipment-results/get/response` | `access_token`, `body`, `trans_id` |
| `CancelShipment` | PUT | `/ship/v1/shipments/cancel` | `fleet/fedex/shipment/cancel` | `fleet/fedex/shipment/cancel/response` | `access_token`, `body`, `trans_id` |
| `CreateTag` | POST | `/ship/v1/shipments/tag` | `fleet/fedex/tag/create` | `fleet/fedex/tag/create/response` | `access_token`, `body`, `trans_id` |
| `CancelTag` | PUT | `/ship/v1/shipments/tag/cancel/{value.json.id}` | `fleet/fedex/tag/cancel` | `fleet/fedex/tag/cancel/response` | `access_token`, `body`, `id`, `trans_id` |
| `CheckPickupAvailability` | POST | `/pickup/v1/pickups/availabilities` | `fleet/fedex/pickup-availability/get` | `fleet/fedex/pickup-availability/get/response` | `access_token`, `body`, `trans_id` |
| `CreatePickup` | POST | `/pickup/v1/pickups` | `fleet/fedex/pickup/create` | `fleet/fedex/pickup/create/response` | `access_token`, `body`, `trans_id` |
| `CancelPickup` | PUT | `/pickup/v1/pickups/cancel` | `fleet/fedex/pickup/cancel` | `fleet/fedex/pickup/cancel/response` | `access_token`, `body`, `trans_id` |
| `GetRegulatoryDetails` | POST | `/globaltrade/v1/shipments/regulatorydetails/retrieve` | `fleet/fedex/regulatory/get` | `fleet/fedex/regulatory/get/response` | `access_token`, `body`, `trans_id` |
| `AssociateTrackingNumbers` | POST | `/webhook/v1/subscriptions/trackingnumbers/association` | `fleet/fedex/aiv-tracking-number/associate` | `fleet/fedex/aiv-tracking-number/associate/response` | `access_token`, `action`, `body`, `trans_id` |
| `AssociateTrackingNumbersSync` | POST | `/webhook/v1/subscriptions/trackingnumbers/syncassociation` | `fleet/fedex/aiv-tracking-number-sync/associate` | `fleet/fedex/aiv-tracking-number-sync/associate/response` | `access_token`, `body`, `trans_id` |
| `GetAssociationJobStatus` | GET | `/webhook/v1/subscriptions/trackingnumbers/jobstatus?{value.json.query}` | `fleet/fedex/aiv-job-status/get` | `fleet/fedex/aiv-job-status/get/response` | `access_token`, `query`, `trans_id` |
| `GetAssociationJobDetails` | GET | `/webhook/v1/subscriptions/trackingnumbers/jobdetails?{value.json.query}` | `fleet/fedex/aiv-job-details/get` | `fleet/fedex/aiv-job-details/get/response` | `access_token`, `query`, `trans_id` |
| `GetAccountSubscription` | GET | `/webhook/v3/subscriptions?{value.json.query}` | `fleet/fedex/aiv-subscription/get` | `fleet/fedex/aiv-subscription/get/response` | `access_token`, `query`, `trans_id` |
| `UpdateAccountSubscription` | PUT | `/webhook/v3/subscriptions` | `fleet/fedex/aiv-subscription/update` | `fleet/fedex/aiv-subscription/update/response` | `access_token`, `body`, `trans_id` |

## Deploy

Get the template card (JSON with `template` and `metadata`) from the broker, then deploy the connector:

```bash theme={"theme":"css-variables","languages":{"custom":["/languages/lot.json"]}}
mosquitto_pub -t '$SYS/Coreflux/Command' -m "-routeCode FED_EX_API"
```

The deployable connector from the REST API app, with `BASE_ADDRESS` already filled in:

```lot theme={"theme":"css-variables","languages":{"custom":["/languages/lot.json"]}}
DEFINE ROUTE FedExApi WITH TYPE REST_API
    ADD REST_API_CONFIG
        WITH BASE_ADDRESS "https://apis.fedex.com"
        WITH ENABLE_CLIENT "true"
        WITH USE_SSL "true"
        WITH REQUEST_TIMEOUT '60'
        WITH DEFAULT_CONTENT_TYPE "application/json"
    ADD EVENT TrackByTrackingNumber
        WITH SOURCE_TOPIC "fleet/fedex/track/get"
        WITH DESTINATION_TOPIC "fleet/fedex/track/get/response"
        WITH METHOD "POST"
        WITH ENDPOINT "/track/v1/trackingnumbers"
        WITH HEADERS
            ADD "Accept" "application/json"
            ADD "User-Agent" "Coreflux-Broker"
            ADD "Authorization" "Bearer {value.json.access_token}"
            ADD "x-customer-transaction-id" "{value.json.trans_id}"
            ADD "x-locale" "en_US"
            ADD "Content-Type" "application/json"
        WITH BODY "{value.json.body}"
    ADD EVENT TrackByReference
        WITH SOURCE_TOPIC "fleet/fedex/track-reference/get"
        WITH DESTINATION_TOPIC "fleet/fedex/track-reference/get/response"
        WITH METHOD "POST"
        WITH ENDPOINT "/track/v1/referencenumbers"
        WITH HEADERS
            ADD "Accept" "application/json"
            ADD "User-Agent" "Coreflux-Broker"
            ADD "Authorization" "Bearer {value.json.access_token}"
            ADD "x-customer-transaction-id" "{value.json.trans_id}"
            ADD "x-locale" "en_US"
            ADD "Content-Type" "application/json"
        WITH BODY "{value.json.body}"
    ADD EVENT TrackByTcn
        WITH SOURCE_TOPIC "fleet/fedex/track-tcn/get"
        WITH DESTINATION_TOPIC "fleet/fedex/track-tcn/get/response"
        WITH METHOD "POST"
        WITH ENDPOINT "/track/v1/tcn"
        WITH HEADERS
            ADD "Accept" "application/json"
            ADD "User-Agent" "Coreflux-Broker"
            ADD "Authorization" "Bearer {value.json.access_token}"
            ADD "x-customer-transaction-id" "{value.json.trans_id}"
            ADD "x-locale" "en_US"
            ADD "Content-Type" "application/json"
        WITH BODY "{value.json.body}"
    ADD EVENT TrackMultiPieceShipment
        WITH SOURCE_TOPIC "fleet/fedex/track-associated/get"
        WITH DESTINATION_TOPIC "fleet/fedex/track-associated/get/response"
        WITH METHOD "POST"
        WITH ENDPOINT "/track/v1/associatedshipments"
        WITH HEADERS
            ADD "Accept" "application/json"
            ADD "User-Agent" "Coreflux-Broker"
            ADD "Authorization" "Bearer {value.json.access_token}"
            ADD "x-customer-transaction-id" "{value.json.trans_id}"
            ADD "x-locale" "en_US"
            ADD "Content-Type" "application/json"
        WITH BODY "{value.json.body}"
    ADD EVENT GetTrackingDocument
        WITH SOURCE_TOPIC "fleet/fedex/tracking-document/get"
        WITH DESTINATION_TOPIC "fleet/fedex/tracking-document/get/response"
        WITH METHOD "POST"
        WITH ENDPOINT "/track/v1/trackingdocuments"
        WITH HEADERS
            ADD "Accept" "application/json"
            ADD "User-Agent" "Coreflux-Broker"
            ADD "Authorization" "Bearer {value.json.access_token}"
            ADD "x-customer-transaction-id" "{value.json.trans_id}"
            ADD "x-locale" "en_US"
            ADD "Content-Type" "application/json"
        WITH BODY "{value.json.body}"
    ADD EVENT SendTrackingNotification
        WITH SOURCE_TOPIC "fleet/fedex/tracking-notification/create"
        WITH DESTINATION_TOPIC "fleet/fedex/tracking-notification/create/response"
        WITH METHOD "POST"
        WITH ENDPOINT "/track/v1/notifications"
        WITH HEADERS
            ADD "Accept" "application/json"
            ADD "User-Agent" "Coreflux-Broker"
            ADD "Authorization" "Bearer {value.json.access_token}"
            ADD "x-customer-transaction-id" "{value.json.trans_id}"
            ADD "x-locale" "en_US"
            ADD "Content-Type" "application/json"
        WITH BODY "{value.json.body}"
    ADD EVENT RateQuote
        WITH SOURCE_TOPIC "fleet/fedex/rate/get"
        WITH DESTINATION_TOPIC "fleet/fedex/rate/get/response"
        WITH METHOD "POST"
        WITH ENDPOINT "/rate/v1/rates/quotes"
        WITH HEADERS
            ADD "Accept" "application/json"
            ADD "User-Agent" "Coreflux-Broker"
            ADD "Authorization" "Bearer {value.json.access_token}"
            ADD "x-customer-transaction-id" "{value.json.trans_id}"
            ADD "x-locale" "en_US"
            ADD "Content-Type" "application/json"
        WITH BODY "{value.json.body}"
    ADD EVENT ValidateAddress
        WITH SOURCE_TOPIC "fleet/fedex/address/validate"
        WITH DESTINATION_TOPIC "fleet/fedex/address/validate/response"
        WITH METHOD "POST"
        WITH ENDPOINT "/address/v1/addresses/resolve"
        WITH HEADERS
            ADD "Accept" "application/json"
            ADD "User-Agent" "Coreflux-Broker"
            ADD "Authorization" "Bearer {value.json.access_token}"
            ADD "x-customer-transaction-id" "{value.json.trans_id}"
            ADD "x-locale" "en_US"
            ADD "Content-Type" "application/json"
        WITH BODY "{value.json.body}"
    ADD EVENT ValidatePostalCode
        WITH SOURCE_TOPIC "fleet/fedex/postal-code/validate"
        WITH DESTINATION_TOPIC "fleet/fedex/postal-code/validate/response"
        WITH METHOD "POST"
        WITH ENDPOINT "/country/v1/postal/validate"
        WITH HEADERS
            ADD "Accept" "application/json"
            ADD "User-Agent" "Coreflux-Broker"
            ADD "Authorization" "Bearer {value.json.access_token}"
            ADD "x-customer-transaction-id" "{value.json.trans_id}"
            ADD "x-locale" "en_US"
            ADD "Content-Type" "application/json"
        WITH BODY "{value.json.body}"
    ADD EVENT GetTransitTimes
        WITH SOURCE_TOPIC "fleet/fedex/transit-time/get"
        WITH DESTINATION_TOPIC "fleet/fedex/transit-time/get/response"
        WITH METHOD "POST"
        WITH ENDPOINT "/availability/v1/transittimes"
        WITH HEADERS
            ADD "Accept" "application/json"
            ADD "User-Agent" "Coreflux-Broker"
            ADD "Authorization" "Bearer {value.json.access_token}"
            ADD "x-customer-transaction-id" "{value.json.trans_id}"
            ADD "x-locale" "en_US"
            ADD "Content-Type" "application/json"
        WITH BODY "{value.json.body}"
    ADD EVENT GetPackageAndServiceOptions
        WITH SOURCE_TOPIC "fleet/fedex/service-option/get"
        WITH DESTINATION_TOPIC "fleet/fedex/service-option/get/response"
        WITH METHOD "POST"
        WITH ENDPOINT "/availability/v1/packageandserviceoptions"
        WITH HEADERS
            ADD "Accept" "application/json"
            ADD "User-Agent" "Coreflux-Broker"
            ADD "Authorization" "Bearer {value.json.access_token}"
            ADD "x-customer-transaction-id" "{value.json.trans_id}"
            ADD "x-locale" "en_US"
            ADD "Content-Type" "application/json"
        WITH BODY "{value.json.body}"
    ADD EVENT GetSpecialServiceOptions
        WITH SOURCE_TOPIC "fleet/fedex/special-service-option/get"
        WITH DESTINATION_TOPIC "fleet/fedex/special-service-option/get/response"
        WITH METHOD "POST"
        WITH ENDPOINT "/availability/v1/specialserviceoptions"
        WITH HEADERS
            ADD "Accept" "application/json"
            ADD "User-Agent" "Coreflux-Broker"
            ADD "Authorization" "Bearer {value.json.access_token}"
            ADD "x-customer-transaction-id" "{value.json.trans_id}"
            ADD "x-locale" "en_US"
            ADD "Content-Type" "application/json"
        WITH BODY "{value.json.body}"
    ADD EVENT FindLocations
        WITH SOURCE_TOPIC "fleet/fedex/location/search"
        WITH DESTINATION_TOPIC "fleet/fedex/location/search/response"
        WITH METHOD "POST"
        WITH ENDPOINT "/location/v1/locations"
        WITH HEADERS
            ADD "Accept" "application/json"
            ADD "User-Agent" "Coreflux-Broker"
            ADD "Authorization" "Bearer {value.json.access_token}"
            ADD "x-customer-transaction-id" "{value.json.trans_id}"
            ADD "x-locale" "en_US"
            ADD "Content-Type" "application/json"
        WITH BODY "{value.json.body}"
    ADD EVENT ValidateShipment
        WITH SOURCE_TOPIC "fleet/fedex/shipment/validate"
        WITH DESTINATION_TOPIC "fleet/fedex/shipment/validate/response"
        WITH METHOD "POST"
        WITH ENDPOINT "/ship/v1/shipments/packages/validate"
        WITH HEADERS
            ADD "Accept" "application/json"
            ADD "User-Agent" "Coreflux-Broker"
            ADD "Authorization" "Bearer {value.json.access_token}"
            ADD "x-customer-transaction-id" "{value.json.trans_id}"
            ADD "x-locale" "en_US"
            ADD "Content-Type" "application/json"
        WITH BODY "{value.json.body}"
    ADD EVENT CreateShipment
        WITH SOURCE_TOPIC "fleet/fedex/shipment/create"
        WITH DESTINATION_TOPIC "fleet/fedex/shipment/create/response"
        WITH METHOD "POST"
        WITH ENDPOINT "/ship/v1/shipments"
        WITH HEADERS
            ADD "Accept" "application/json"
            ADD "User-Agent" "Coreflux-Broker"
            ADD "Authorization" "Bearer {value.json.access_token}"
            ADD "x-customer-transaction-id" "{value.json.trans_id}"
            ADD "x-locale" "en_US"
            ADD "Content-Type" "application/json"
        WITH BODY "{value.json.body}"
    ADD EVENT GetShipmentResults
        WITH SOURCE_TOPIC "fleet/fedex/shipment-results/get"
        WITH DESTINATION_TOPIC "fleet/fedex/shipment-results/get/response"
        WITH METHOD "POST"
        WITH ENDPOINT "/ship/v1/shipments/results"
        WITH HEADERS
            ADD "Accept" "application/json"
            ADD "User-Agent" "Coreflux-Broker"
            ADD "Authorization" "Bearer {value.json.access_token}"
            ADD "x-customer-transaction-id" "{value.json.trans_id}"
            ADD "x-locale" "en_US"
            ADD "Content-Type" "application/json"
        WITH BODY "{value.json.body}"
    ADD EVENT CancelShipment
        WITH SOURCE_TOPIC "fleet/fedex/shipment/cancel"
        WITH DESTINATION_TOPIC "fleet/fedex/shipment/cancel/response"
        WITH METHOD "PUT"
        WITH ENDPOINT "/ship/v1/shipments/cancel"
        WITH HEADERS
            ADD "Accept" "application/json"
            ADD "User-Agent" "Coreflux-Broker"
            ADD "Authorization" "Bearer {value.json.access_token}"
            ADD "x-customer-transaction-id" "{value.json.trans_id}"
            ADD "x-locale" "en_US"
            ADD "Content-Type" "application/json"
        WITH BODY "{value.json.body}"
    ADD EVENT CreateTag
        WITH SOURCE_TOPIC "fleet/fedex/tag/create"
        WITH DESTINATION_TOPIC "fleet/fedex/tag/create/response"
        WITH METHOD "POST"
        WITH ENDPOINT "/ship/v1/shipments/tag"
        WITH HEADERS
            ADD "Accept" "application/json"
            ADD "User-Agent" "Coreflux-Broker"
            ADD "Authorization" "Bearer {value.json.access_token}"
            ADD "x-customer-transaction-id" "{value.json.trans_id}"
            ADD "x-locale" "en_US"
            ADD "Content-Type" "application/json"
        WITH BODY "{value.json.body}"
    ADD EVENT CancelTag
        WITH SOURCE_TOPIC "fleet/fedex/tag/cancel"
        WITH DESTINATION_TOPIC "fleet/fedex/tag/cancel/response"
        WITH METHOD "PUT"
        WITH ENDPOINT "/ship/v1/shipments/tag/cancel/{value.json.id}"
        WITH HEADERS
            ADD "Accept" "application/json"
            ADD "User-Agent" "Coreflux-Broker"
            ADD "Authorization" "Bearer {value.json.access_token}"
            ADD "x-customer-transaction-id" "{value.json.trans_id}"
            ADD "x-locale" "en_US"
            ADD "Content-Type" "application/json"
        WITH BODY "{value.json.body}"
    ADD EVENT CheckPickupAvailability
        WITH SOURCE_TOPIC "fleet/fedex/pickup-availability/get"
        WITH DESTINATION_TOPIC "fleet/fedex/pickup-availability/get/response"
        WITH METHOD "POST"
        WITH ENDPOINT "/pickup/v1/pickups/availabilities"
        WITH HEADERS
            ADD "Accept" "application/json"
            ADD "User-Agent" "Coreflux-Broker"
            ADD "Authorization" "Bearer {value.json.access_token}"
            ADD "x-customer-transaction-id" "{value.json.trans_id}"
            ADD "x-locale" "en_US"
            ADD "Content-Type" "application/json"
        WITH BODY "{value.json.body}"
    ADD EVENT CreatePickup
        WITH SOURCE_TOPIC "fleet/fedex/pickup/create"
        WITH DESTINATION_TOPIC "fleet/fedex/pickup/create/response"
        WITH METHOD "POST"
        WITH ENDPOINT "/pickup/v1/pickups"
        WITH HEADERS
            ADD "Accept" "application/json"
            ADD "User-Agent" "Coreflux-Broker"
            ADD "Authorization" "Bearer {value.json.access_token}"
            ADD "x-customer-transaction-id" "{value.json.trans_id}"
            ADD "x-locale" "en_US"
            ADD "Content-Type" "application/json"
        WITH BODY "{value.json.body}"
    ADD EVENT CancelPickup
        WITH SOURCE_TOPIC "fleet/fedex/pickup/cancel"
        WITH DESTINATION_TOPIC "fleet/fedex/pickup/cancel/response"
        WITH METHOD "PUT"
        WITH ENDPOINT "/pickup/v1/pickups/cancel"
        WITH HEADERS
            ADD "Accept" "application/json"
            ADD "User-Agent" "Coreflux-Broker"
            ADD "Authorization" "Bearer {value.json.access_token}"
            ADD "x-customer-transaction-id" "{value.json.trans_id}"
            ADD "x-locale" "en_US"
            ADD "Content-Type" "application/json"
        WITH BODY "{value.json.body}"
    ADD EVENT GetRegulatoryDetails
        WITH SOURCE_TOPIC "fleet/fedex/regulatory/get"
        WITH DESTINATION_TOPIC "fleet/fedex/regulatory/get/response"
        WITH METHOD "POST"
        WITH ENDPOINT "/globaltrade/v1/shipments/regulatorydetails/retrieve"
        WITH HEADERS
            ADD "Accept" "application/json"
            ADD "User-Agent" "Coreflux-Broker"
            ADD "Authorization" "Bearer {value.json.access_token}"
            ADD "x-customer-transaction-id" "{value.json.trans_id}"
            ADD "x-locale" "en_US"
            ADD "Content-Type" "application/json"
        WITH BODY "{value.json.body}"
    ADD EVENT AssociateTrackingNumbers
        WITH SOURCE_TOPIC "fleet/fedex/aiv-tracking-number/associate"
        WITH DESTINATION_TOPIC "fleet/fedex/aiv-tracking-number/associate/response"
        WITH METHOD "POST"
        WITH ENDPOINT "/webhook/v1/subscriptions/trackingnumbers/association"
        WITH HEADERS
            ADD "Accept" "application/json"
            ADD "User-Agent" "Coreflux-Broker"
            ADD "Authorization" "Bearer {value.json.access_token}"
            ADD "x-customer-transaction-id" "{value.json.trans_id}"
            ADD "x-locale" "en_US"
            ADD "Content-Type" "application/json"
            ADD "x-action" "{value.json.action}"
            ADD "x-type" "tracking"
        WITH BODY "{value.json.body}"
    ADD EVENT AssociateTrackingNumbersSync
        WITH SOURCE_TOPIC "fleet/fedex/aiv-tracking-number-sync/associate"
        WITH DESTINATION_TOPIC "fleet/fedex/aiv-tracking-number-sync/associate/response"
        WITH METHOD "POST"
        WITH ENDPOINT "/webhook/v1/subscriptions/trackingnumbers/syncassociation"
        WITH HEADERS
            ADD "Accept" "application/json"
            ADD "User-Agent" "Coreflux-Broker"
            ADD "Authorization" "Bearer {value.json.access_token}"
            ADD "x-customer-transaction-id" "{value.json.trans_id}"
            ADD "x-locale" "en_US"
            ADD "Content-Type" "application/json"
            ADD "X-Content-Type" "application/json"
        WITH BODY "{value.json.body}"
    ADD EVENT GetAssociationJobStatus
        WITH SOURCE_TOPIC "fleet/fedex/aiv-job-status/get"
        WITH DESTINATION_TOPIC "fleet/fedex/aiv-job-status/get/response"
        WITH METHOD "GET"
        WITH ENDPOINT "/webhook/v1/subscriptions/trackingnumbers/jobstatus?{value.json.query}"
        WITH HEADERS
            ADD "Accept" "application/json"
            ADD "User-Agent" "Coreflux-Broker"
            ADD "Authorization" "Bearer {value.json.access_token}"
            ADD "x-customer-transaction-id" "{value.json.trans_id}"
            ADD "x-locale" "en_US"
    ADD EVENT GetAssociationJobDetails
        WITH SOURCE_TOPIC "fleet/fedex/aiv-job-details/get"
        WITH DESTINATION_TOPIC "fleet/fedex/aiv-job-details/get/response"
        WITH METHOD "GET"
        WITH ENDPOINT "/webhook/v1/subscriptions/trackingnumbers/jobdetails?{value.json.query}"
        WITH HEADERS
            ADD "Accept" "application/json"
            ADD "User-Agent" "Coreflux-Broker"
            ADD "Authorization" "Bearer {value.json.access_token}"
            ADD "x-customer-transaction-id" "{value.json.trans_id}"
            ADD "x-locale" "en_US"
    ADD EVENT GetAccountSubscription
        WITH SOURCE_TOPIC "fleet/fedex/aiv-subscription/get"
        WITH DESTINATION_TOPIC "fleet/fedex/aiv-subscription/get/response"
        WITH METHOD "GET"
        WITH ENDPOINT "/webhook/v3/subscriptions?{value.json.query}"
        WITH HEADERS
            ADD "Accept" "application/json"
            ADD "User-Agent" "Coreflux-Broker"
            ADD "Authorization" "Bearer {value.json.access_token}"
            ADD "x-customer-transaction-id" "{value.json.trans_id}"
            ADD "x-locale" "en_US"
    ADD EVENT UpdateAccountSubscription
        WITH SOURCE_TOPIC "fleet/fedex/aiv-subscription/update"
        WITH DESTINATION_TOPIC "fleet/fedex/aiv-subscription/update/response"
        WITH METHOD "PUT"
        WITH ENDPOINT "/webhook/v3/subscriptions"
        WITH HEADERS
            ADD "Accept" "application/json"
            ADD "User-Agent" "Coreflux-Broker"
            ADD "Authorization" "Bearer {value.json.access_token}"
            ADD "x-customer-transaction-id" "{value.json.trans_id}"
            ADD "x-locale" "en_US"
            ADD "Content-Type" "application/json"
        WITH BODY "{value.json.body}"
```

Deploy it with `-addRoute` (do not include `ADD METADATA`).

## Usage example

Call `TrackByTrackingNumber` by publishing a JSON payload to its request topic, and read the reply on the response topic:

```bash theme={"theme":"css-variables","languages":{"custom":["/languages/lot.json"]}}
mosquitto_sub -t 'fleet/fedex/track/get/response' &
mosquitto_pub -t 'fleet/fedex/track/get' -m '{"access_token": "<access_token>", "body": {}, "trans_id": "<trans_id>"}'
```

## Related

* [REST API Connectors](/latest/lot-language/routes/rest-api-routes)
* [REST API Apps catalog](/latest/lot-language/routes/rest-api-apps)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.