Welcome to the Docs

Here you'll find guides, resources, and references to build with Vital.

Quickstart

To get started with the Vital API first create an account, by signing up to the waitlist. Once approved you'll have access to the Vital Dashboard. You'll be given access to two environments with the corresponding credentials.

Environments

Sandbox

Test environment for data

Production

Live environment to use with customers

API Keys

client_id

Identifier for your team

client_secret

Private secret for your team

Once you have these credentials you can begin using our APIs.

Create User Key

To allow a user to connect to the API, first create a vital_key using the client_user_id. Typically this will be a user ID number from your application. Personally identifiable information, such as an email address or phone number, should not be used in the client_user_id. This should be created initially when a user signs up.

client_user_id
string
A unique ID representing the end user. Typically this will be a user ID number from your application. Personally identifiable information, such as an email address or phone number, should not be used in the client_user_id.

Generate Vital User Key

1
2
3
4
5
6
7
8
9
10
from vital import Client

client = Client(
     client_id, 
     client_secret, 
     environment="sandbox"
     )
client_user_id = "ysad21321-..."
user_key = client.UserKey.create(client_user_id)
   

Once you have the user_key you can use Vital Link. Vital Link is the client-side component your users will interact with to link their accounts to Vital and allow you to access their accounts via the Vital API.

Vital Link

Vital Link can easily be integrated into your applications via our Python and React libraries, which you can use with your credentials to get started today.

Vital Link Flow

1. Once you have your user_key you can use this to generate a link token on your backend.

user_key
string
Unique key to generated in the last step, that is specific to a user.

Generate Link Token

1
2
3
4
5
6
7
8
9
from vital import Client

client = Client(
     client_id, 
     client_secret, 
     environment="sandbox"
     )
 
token = client.Link.create(user_key, "oura")

2. Pass this temporary link token to your front-end and use this to launch Vital Link.

onSuccess
function
Function to receive metadata for connected item
token
string
Link Token received from back-end
environment
string
Sandbox or Prod

Launching Vital Link

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
import 'react-app-polyfill/ie11';
  import * as React from 'react';
  import * as ReactDOM from 'react-dom';
  import { useCallback } from 'react';
  ​
  import { useVitalLink } from '../src';
  import { useState } from 'react';
  ​
  const API_URL = process.env.API_URL ? process.env.API_URL : "http://localhost:3001"
  ​
  const getTokenFromBackend = async (userKey: string, env: string) => {
    const resp = await fetch(<backend_url>);
    return await resp.json();
  };
  ​
  const App = props => {
    const userKey = '560596b9-924b-4af9-a670-cf21870fdac5';
    const [isLoading, setLoading] = useState(false);
  ​
    const onSuccess = useCallback(metadata => {
      // Device is now connected.
    }, []);
  ​
    const onExit = useCallback(metadata => {
      // User has quit the link flow.
    }, []);
  ​
    const onError = useCallback(metadata => {
      // Error encountered in connecting device.
    }, []);
  ​
    const config = {
      onSuccess,
      onExit,
      onError,
      env: "sandbox"
    };
  ​
    const { open, ready, error } = useVitalLink(config);
  ​
    const handleVitalOpen = async () => {
      setLoading(true);
      const token = await getTokenFromBackend(userKey, "sandbox");
      open(token);
      setLoading(false);
    };
  ​
    return (
      <button
        type="button"
        className="button"
        onClick={handleVitalOpen}
        disabled={isLoading || !ready}
      >
        Open Vital Link
      </button>
    );
  };
  ​
  ReactDOM.render(<App />, document.getElementById('root'));

Now the user has connected their devices you can begin using the Vital API to begin pulling data for that user.