> ## 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 Auth

> 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.

## Template parameters

| Placeholder | Type | Description | Required |
| - | - | - | - |
| `RouteName` | string | Name of the Fed Ex Auth connector | no |
| `BaseUrl` | string | Fed Ex Auth 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 |
| - | - | - | - | - | - |
| `GetToken` | POST | `/oauth/token` | `fleet/fedex/token/create` | `fleet/fedex/token/create/response` | `form` |
| `GetTokenChild` | POST | `/oauth/token` | `fleet/fedex/token-child/create` | `fleet/fedex/token-child/create/response` | `form` |

## 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_AUTH"
```

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 FedExAuth 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 GetToken
        WITH SOURCE_TOPIC "fleet/fedex/token/create"
        WITH DESTINATION_TOPIC "fleet/fedex/token/create/response"
        WITH METHOD "POST"
        WITH ENDPOINT "/oauth/token"
        WITH HEADERS
            ADD "Accept" "application/json"
            ADD "User-Agent" "Coreflux-Broker"
            ADD "Content-Type" "application/x-www-form-urlencoded"
        WITH BODY "{value.json.form}"
    ADD EVENT GetTokenChild
        WITH SOURCE_TOPIC "fleet/fedex/token-child/create"
        WITH DESTINATION_TOPIC "fleet/fedex/token-child/create/response"
        WITH METHOD "POST"
        WITH ENDPOINT "/oauth/token"
        WITH HEADERS
            ADD "Accept" "application/json"
            ADD "User-Agent" "Coreflux-Broker"
            ADD "Content-Type" "application/x-www-form-urlencoded"
        WITH BODY "{value.json.form}"
```

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

## Usage example

Call `GetToken` 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/token/create/response' &
mosquitto_pub -t 'fleet/fedex/token/create' -m '{"form": "<form>"}'
```

## 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.