Link Search Menu Expand Document
Developer | Sahha

Get Started

Welcome to the Sahha developer resources and documentation website. Here you’ll find all the information you need to start building with Sahha.


Table of contents
  1. Step 1) Register Your Account
  2. Step 2) Access Your API Keys
  3. Step 3) Authenticate Your Account
  4. Step 4) Create a User Profile
  5. Step 5) Authenticate a User Profile
  6. Step 6) Build with Sahha
  7. Step 7) Join the Sahha Slack Community

Step 1) Register Your Account

Tap “Get Started with Sahha” to quickly sign up for an account that your organization can use to access Sahha services.

Get Started with Sahha

Step 2) Access Your API Keys

You will need to access your API Keys in order to start connecting to the Sahha API.

You can find your Client ID and Client Secret inside the Dashboard by going to Developer Tools > API Access.


Step 3) Authenticate Your Account

You will need to authenticate your account to access the Sahha API.

API - Authenticate Account

Use your Client ID and Client Secret from the Dashboard to authenticate your account via the API.

// POST "/oauth/account/token"
{
  "clientId": "MY_CLIENT_ID",
  "clientSecret": "MY_CLIENT_SECRET"
}

You will receive an accountToken that allows you to create new user profiles.

// 200 OK
{
  "accountToken": "MY_ACCOUNT_TOKEN",
  "expiresIn": "86400",
  "tokenType": "Account"
}

Step 4) Create a User Profile

User profiles represent the users of your app or service. They are unique individuals that you would like to use the Sahha service for.

API - Create Profile

Use your accountToken to create new user profiles.

// POST "/profile"
// AUTHORIZATION HEADER "Account MY_ACCOUNT_TOKEN"

// 200 OK
{
  "profileId": "MY_PROFILE_ID"
}

Step 5) Authenticate a User Profile

You will need to authenticate your users in order to upload data and download an analysis for each individual.

API - Authenticate Profile

Use your accountToken and profileId to authenticate a user profile via the API.

// POST "/oauth/profile/token"
// AUTHORIZATION HEADER "Account MY_ACCOUNT_TOKEN"
{
  "profileId": "MY_PROFILE_ID"
}

You will receive a profileToken that allows that specific user profile to connect to the Sahha API.

// 200 OK
{
  "profileToken": "MY_PROFILE_TOKEN",
  "expiresIn": "86400",
  "tokenType": "Profile",
  "refreshToken": "MY_REFRESH_TOKEN"
}

If you also install the Sahha SDK in your app, you will need to pass the profileToken to the authenticate method.

Android Example

Sahha.authenticate(profileToken: "MY_PROFILE_TOKEN", refreshToken:  "MY_REFRESH_TOKEN") { error, success ->
    if (success) greeting = "Successful"
    else greeting = error ?: "Failed"
}

Step 6) Build with Sahha

It’s time to start building with Sahha!

You can connect the Sahha API directly to your service.

You can also integrate a platfom-specific Sahha SDK into your app.

Disclaimer

We recommend sending behavioral data using one of the available sdk’s instead of directly via the API. Behavioral data that is uploaded via the API may differ in the stucture and frequency typical of the device sensors. This could lead to reduced accuracy in your data analysis results.


Step 7) Join the Sahha Slack Community

Sahha hosts an open Slack community for developers. Please join us on Slack to get help from the Sahha team and fellow developers to better integrate Sahha into your project.

Sahha Slack