# Managing source details in outgoing requests

While data exchange often focuses on the destination, the <u>**source**</u> is critical for kicking off the exchange and routing data to the right location.

With Redox, you typically only need one source to send data from, unless data is exchanged in multiple formats that require different configurations. A <u>**source**</u>, the initiating point of a request, is identified in either the header or payload with source IDs.

For outgoing requests, you’re responsible for providing your source details for routing purposes.

> **Key takeaways**
>
> - If you have multiple sources, you must provide a `source ID` in outgoing API requests.
> - If you have only one source, providing the `source ID` is optional.
> - The `source ID` is provided in the `Meta.Source.ID` field for the Redox Data Model API or the `Redox-Source-Id` header for the Redox FHIR API.

## When to include a source ID

If you only have one source, it’s entirely optional to include the source ID in an outgoing request. With one source, the source ID only matters if the destination system needs it for their own processing.

> **Source IDs and legacy API keys**
>
> A source ID is tied to a legacy API key. This means that for every source in your system, you’ll have a corresponding legacy API key, even if you use an OAuth API key to authenticate requests. [Learn more about authentication methods](/basics/data-exchange-with-redox/authenticating-and-sending-data-via-redox).

## How to route with multiple sources

If your system has multiple sources (e.g., your system sends data via API and SFTP), you must identify the relevant source ID in any outgoing requests. That way, Redox knows where the request came from, what configuration to apply, and who to notify in case of errors.

> **No need to identify source IDs with DevTools**
>
> If you’re using the Redox dashboard DevTools to send requests, you don’t need to worry about identifying a source ID. DevTools takes care of this for you.

## Where to find a source ID

You can locate the source ID either in the Redox dashboard or via the Platform API.

### Redox Platform API

[Use the `Get sources` endpoint](https://docs.redoxengine.com/permalink/e7d2a75e-db15-5c0b-9690-dd785b4cfd1e-get-sources) to retrieve a list of sources with their corresponding IDs.

### Redox dashboard

Log into the Redox dashboard and navigate to the <u>Developer</u> page to locate the source ID. By default, the <u>Sources</u> tab opens with any configured sources and API keys. Find the source you want to use and copy its ID value.

![Sources tab: Where to find the source ID](https://images.ctfassets.net/cl3wt5ehhnlv/wiG1otRXtI7uS52tUVu59/0a0ce6033aad37364c47a619fa4a9111/sources-tab-source-id.png)

*Sources tab: Where to find the source ID*

Alternatively, navigate to the <u>Connections</u> page to locate the source ID. By default, the <u>Subscriptions</u> tab opens. All of your sources display on the left side of the subscription. Find the source you want to use and copy its ID value.

![Subscriptions tab: Where to find the source ID](https://images.ctfassets.net/cl3wt5ehhnlv/3vFlO0ubqrAu4e0rrKARRB/39ce68a679eba585a7ca6ec03c43fae8/Connections_sourceId.png)

*Subscriptions tab: Where to find the source ID*

## Where to include a source ID

### Redox Data Model API

Identify the source in the `Meta.Source.ID` field of the request payload. Remember that this field is only required if you have more than one source in your environment.

### Redox FHIR API

Identify the source by adding the `Redox-Source-Id` header to an outgoing query. This header is only required if you have more than one source in your environment.

**Example: FHIR source ID header**

```bash
curl 'https://api.redoxengine.com/fhir/R4/{destinationSlug}/{environmentFlag}/{FHIR-resource}/_search' \
--request POST \
  -H "Authorization: Bearer " \
  -H "Redox-Source-Id: {source-id-string}" \
```

For FHIR writeback messages, include a `MessageHeader` resource with this metadata: 

| **Metadata** | **Required** | **Notes** |
| --- | --- | --- |
| `MessageHeader.source.endpoint` | Required | Set to your Redox source ID (`urn:uuid:<source-id>`) or a public endpoint that identifies your organization. For example, we’d use `https://redoxengine.com` to identify Redox. This is required even if `Redox-Source-Id` isn’t. |
| `source.name` | Optional, but recommended | Enter a human-readable name for the source represented by the URL. |
