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

# Junction API

> Overview of the Junction API including production and sandbox environments, regional endpoints, authentication methods, and core API capabilities.

You use Junction API to:

* manage users and demographic information in your Team with the [Core API](https://docs.junction.com/api-reference/user/create-user.md);
* manage user connections, pull ingested device data, and inspect connection backfill statuses through the [Devices API](https://docs.junction.com/wearables/connecting-providers/introduction.md);
* order lab tests, manage appointments and pull the results through the [Lab Testing API](https://docs.junction.com/lab/overview/introduction.md); and
* aggregate ingested device data with the [Junction Sense API](https://docs.junction.com/sense/overview.md).

> [!NOTE]
>
> For managing Team configuration and Org resources programmatically, see [Junction Management API](https://docs.junction.com/api-details/junction-management-api.md).

## Environments

Junction provides two Sandbox environments and two Production environments today:

| Environment | Base URL | Team API Key Prefix |
| - | - | - |
| 🇺🇸 Production US | `https://api.us.junction.com/` | `pk_us_*` |
| 🇪🇺 Production EU | `https://api.eu.junction.com/` | `pk_eu_*` |
| 🇺🇸 Sandbox US | `https://api.sandbox.us.junction.com/` | `sk_us_*` |
| 🇪🇺 Sandbox EU | `https://api.sandbox.eu.junction.com/` | `sk_eu_*` |

> [!NOTE]
>
> If you are using a `*.tryvital.io` Base URL, it is still supported alongside `*.junction.com`.

Sandbox environments are functionally identical to Production environments, except that:

1. Each Team can have only up to 50 Users in Sandbox;
2. You can create [Synthetic Device connections](https://docs.junction.com/wearables/providers/test_data.md); and
3. You can [simulate and transition an order through its lifecycle](https://docs.junction.com/lab/overview/sandbox.md).

## Authentication

Junction API accepts two team-scoped credential types — pick one per request.

| Credential | Lifetime | Header | Provisioned via |
| - | - | - | - |
| [Team API Key](https://docs.junction.com/api-reference/org-management/team-api-keys/create-team-api-key.md) | Long-lived until revoked | `X-Vital-API-Key: <key>` | Team Config page in the [Junction Dashboard](https://app.junction.com) or [Create Team API Key](https://docs.junction.com/api-reference/org-management/team-api-keys/create-team-api-key.md) |
| [Team API Access Token](https://docs.junction.com/api-reference/org-management/team-api-access-token/create-team-api-access-token.md) | Several minutes | `Authorization: Bearer <token>` | Created programmatically via [Create Team API Access Token](https://docs.junction.com/api-reference/org-management/team-api-access-token/create-team-api-access-token.md) |

### When to use a Team API Key

Choose a Team API Key when your system can safely store a pre-shared secret and you intend to issue separate team-scoped keys to your own divisions or environments. Keys are listed and rotated from the Team Config page in the [Junction Dashboard](https://app.junction.com), or programmatically through the Management API via [Create Team API Key](https://docs.junction.com/api-reference/org-management/team-api-keys/create-team-api-key.md).

```bash cURL theme={null}
curl --request GET \
  --url 'https://api.us.junction.com/v2/providers' \
  --header 'X-Vital-API-Key: <YOUR-TEAM-API-KEY>'
```

### When to use a Team API Access Token

Choose a Team API Access Token when you are integrating Junction into a multi-tenant EMR or similar platform and need to act on behalf of many customer teams without provisioning and storing a Team API Key for each one. Mint a token on demand from your backend by calling the Management API endpoint [Create Team API Access Token](https://docs.junction.com/api-reference/org-management/team-api-access-token/create-team-api-access-token.md) with your Management Key, then call Junction API with the returned token.

```bash cURL theme={null}
curl --request GET \
  --url 'https://api.us.junction.com/v2/providers' \
  --header 'Authorization: Bearer <YOUR-TEAM-API-ACCESS-TOKEN>'
```

> [!WARNING]
>
> Tokens are short-lived (several minutes) and the Create Team API Access Token endpoint is rate limited. Cache and reuse each token until it expires rather than minting per request. When a Junction API call returns `401 Unauthorized`, mint a fresh token by calling the endpoint again, then retry the request.

> [!NOTE]
>
> A [Management Key](https://docs.junction.com/api-details/junction-management-api.md) used by Junction Management API does not function as a Team API Key.
> However, you can provision Team API Keys and mint Team API Access Tokens through a Management Key.

## Junction Mobile SDKs

[Junction Mobile SDKs](https://docs.junction.com/wearables/sdks/) support two authentication methods:

| Scheme | Authorization | Recommended use case |
| - | - | - |
| [Sign-In Token](https://docs.junction.com/wearables/sdks/authentication.md#junction-sign-in-token) | User-scoped access | Production mobile apps |
| [Team API Keys](https://docs.junction.com/wearables/sdks/authentication.md#junction-team-api-keys) | Full Team data access | Proof-of-concept |

Refer to the [Mobile SDK Authentication](https://docs.junction.com/wearables/sdks/authentication.md) documentation for more information.


## Related topics

- [API](https://docs.junction.com/changelog/core/api.md)
- [Junction](https://docs.junction.com/home/welcome.md)
- [Using Junction API](https://docs.junction.com/api-reference/org-management/connect/using-junction-api.md)
- [Junction Management API](https://docs.junction.com/api-details/junction-management-api.md)
- [Using Query API](https://docs.junction.com/sense/using-query-api.md)


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