Skip to main content

1. API keys

Let’s test out running Junction locally by cloning the Quickstart app. To create a team and get your API keys, you first need to sign up for a Junction account in the Dashboard. Once registered, you can create a team by hovering over your username at the bottom of the Dashboard sidebar. A team is associated with a region (either EU or US). The region dictates where data is stored. You can learn more at regions. To create your API keys, go to the configuration section of the Dashboard. For each region, you’ll have access to two environments: Sandbox and Production. We’ll start in the Sandbox environment, so create a new Sandbox API key.
If you get stuck at any point in the Quickstart, help is just a click away! Join our Slack channel or send us a message to support@junction.com

2. Running Quickstart locally

Once you have your API keys, it’s time to run the Junction Quickstart locally! The instructions below will guide you through the process of cloning the Quickstart repository, customizing the .env file with your own Junction API_KEY and finally, building and running the app.
1. Clone quickstart and run locally
Open a new shell and start the frontend app. Your app will be running at http://localhost:3000.
2. Run quickstart frontend

3. Creating your first User

When retrieving data or connecting devices, Junction will require a user_id as input. A user_id is a unique representation that we hold for a user. It allows you to fetch data for that user. To create a user, you need to pass a unique id (client_user_id). This represents the user in your system. Our recommendation is to store the Junction user_id in your db against the user row.
Personally identifiable information (PII), such as an email address or phone number, should not be used as input for the client_user_id parameter.
Enter a new client_user_id and tap Create: quickstart This can also be achieved via the API as follows.

4. Connecting a source

A source, at Junction, is a medical device, wearable, or lab. It is a source of information for health data. To connect a source, tap the connect button. This will launch the Junction Link Widget for that user. Once you have entered your credentials and moved to the next screen, you have connected your first source! You can now make API calls to retrieve data for that Source.

How it works

As you might have noticed, you use both a server and a client-side component to access the Junction APIs. A more detailed explanation of how linking works can be found in link flow. The first step is to create a new link_token by making a /link/token request and passing in the required configuration. This link_token is a short-lived, one-time use token that authenticates your app with Junction Link, our frontend module.
Generating a Link Token
Once you have a link_token, you can use it to initialize Link. Link is a drop-in client-side module available for web, iOS, and Android that handles the authentication process. The Quickstart uses Link on the web, which is a pure JavaScript integration that you trigger via your own client-side code.
Generating a Link Token
This is what your users see to connect their medical devices or wearables: Link specific

5. Making your first API request

We can now explore what happens when you press the analyze button in the Quickstart to make an API call. As an example, we’ll look at the Quickstart’s call to /summary/sleep, which retrieves sleep summary data for a user. The request is simple and requires the Junction user_id, start_date and end_date. Getting user sleep data

6. SDKs and Libraries

We offer different SDKs so you can start building your app right away: You can also download our API collection, or install Postman first and click the button below. Run in Postman

Next Steps

Congratulations, you have completed the Junction Quickstart! There are a few directions you can go in now:

Junction Link

A client-side component your users will interact with in order to link their accounts with Junction. It allows you to access their accounts via the Junction API.

Junction SDKs

Native toolkits to integrate Junction into iOS, Android, and Flutter

Junction Webhooks

Webhooks are a way to receive data from Junction. We frequently poll to receive data from the various providers.