๐Ÿ“˜

NOTE

In previous versions of the software, we offered the API_KEY as an alternate authentication option. The API_KEY is now deprecated.

๐Ÿ“˜

Authentication and SSO

If your environment has single sign-on (SSO) activated and youโ€™re using the /login API endpoint, you must get your JSON Web Token (JWT) from your TDP account page. Otherwise, the following procedure wonโ€™t work.

TetraScience uses a JSON Web Token (JWT) to allow access to the API. You can create a new JWT on our platform in two ways:

The JWT can be passed as header in two ways:

  • as a custom header ts-auth-token
  • in the standard Authorization header, as a bearer token (eg. Authorization Bearer [token])

You will also need to provide your org slug in the x-org-slug header.

An example of the JWT payload schema:

{
  tsTokenSchemaVersion: 1,
  authStacks: {
    informatics : {
      systemRoles: [],
      userId: <user_id>,
      organizations: {
        <organization_id>: {
          slug: <org_slug>,
          roles: [
             <role based access control...>
          ]
        }
      }
    }
  }
}

The ts-auth-token can be retrieved by using the login API ( /login ), with email and password provided in the POST request body.

For example, POST to https://api.tetrascience.com/login

{
  email: "[email protected]", 
  password: "#######"
}

Once authenticated, your result payload should look something like:

{
  "id": "<your id>",
  "firstName": "John",
  "lastName": "Smith",
  "email": "[email protected]",
  "systemRole": "ts-admin",
  "status": "active",
  "roles": [
    {
      "id": "<your id>",
      "userId": "<your user id>",
      "organizationId": "<your organization id>",
      "orgSlug": "<your organization's slug>",
      "orgName": "<your organization's name>",
      "role": "<your role>"
    }
  ],
  "token": "<JSON web token>"
}

Authorization: Bearer Authenticated headers examples:

{
--header 'Authorization: Bearer <JWT Token>'\
--header 'x-org-slug: <YOUR ORGANIZATION>' \
}
{
 "Authorization: "Bearer <JSON web token>",
 "x-org-slug": "diagnostic"
}

ts-auth-token Authenticated headers examples:

{
--header 'ts-auth-token: <JWT Token>' \
--header 'x-org-slug: <YOUR ORGANIZATION>' \
}
{
  "ts-auth-token": "<JSON web token>",
  "x-org-slug": "tetrascience",
}