Authorization and Security
Request service-level access, exchange it for User-specific customer tokens, and manage token expiration securely.
Authorization and Security
Last substantively updated: October 26, 2026.
Use a service-level access token to act as your organization and exchange it for a customer-level access token when acting for a specific User. Both requests use POST /oauth/token; the grant_type selects the operation.
This Guide covers the Partner integration flow for Users created through Creating Users.
Token Levels
| Token | Represents | Use it for |
|---|---|---|
| Service-level token | Your organization or backend service (enterprise/company authentication). | Registering linked customer records, exchanging tokens, and organization-level operations such as inventory or User status management. |
| Customer-level token | One linked InsideTracker customer record for your User. | Customer-authenticated operations such as adding profile data, uploading results, and retrieving outputs. |
Choose the token level and scopes required by the operation. User-related operations can still require organization-level authentication; Managing User Status is one example.
Before You Begin
You need your organization's client ID and client secret, access to the required scopes, and a backend that can store credentials and tokens securely. To request customer access, you also need the User's stored extId.
Use sandbox while building and testing:
https://api.sandbox.insidetracker.comKeep sandbox and production credentials and User mappings separate.
Authentication Workflow
- Request a service-level token with
client_credentials. - Register the User if the linked customer record does not already exist, and store the returned
extId. - Exchange the service-level token for a customer token using
customer:{extId}. - Use the customer token for the customer-authenticated operations your application needs.
- Request replacement access tokens as they expire, using the same grants and the existing User mapping.
Request A Service-Level Token
Call the token endpoint from your backend:
POST /oauth/token
Content-Type: application/json{
"grant_type": "client_credentials",
"client_id": "{client_id}",
"client_secret": "{client_secret}",
"audience": "partner-api",
"scope": "customer:w exchange:customer"
}This example requests organization access for registration and customer-token exchange. Request scopes enabled for your organization and needed by your workflow; other operations can require additional scopes.
| Field | Required? | Use |
|---|---|---|
grant_type | Yes | client_credentials. |
client_id | Yes | Client identifier issued for your organization. |
client_secret | Yes | Client secret issued for your organization. |
audience | No | The example uses partner-api; omitting it uses the server's default audience. |
scope | No | Space-separated requested scopes. Omitting it requests the maximum allowed scopes. |
Use the returned access_token as your service-level token. Retain the returned scope and expiration information with it. See Token Response Handling below.
If you are registering a User, send this service-level token to the registration endpoint, which requires customer:w. Store the successful result's extId before requesting customer access.
Request A Customer-Level Token
Exchange a valid service-level token for access to the intended User:
POST /oauth/token
Content-Type: application/json{
"grant_type": "urn:ietf:params:oauth:grant-type:token-exchange",
"subject_token": "{service_access_token}",
"subject_token_type": "urn:ietf:params:oauth:token-type:jwt",
"requested_subject": "customer:b2d905cd-e5ff-4843-817e-cc27a916c90c",
"audience": "customer-api",
"scope": "basic"
}Replace the example UUID with the stored extId for the User. The service-level token is supplied as subject_token in the JSON body.
| Field | Required? | Use |
|---|---|---|
grant_type | Yes | urn:ietf:params:oauth:grant-type:token-exchange. |
subject_token | Yes | Your valid service-level access token. |
subject_token_type | Yes | urn:ietf:params:oauth:token-type:jwt. |
requested_subject | Yes | customer:{extId} for the intended User. |
audience | Yes | customer-api. |
scope | No | Space-separated customer scopes. The example requests basic; select the scopes required by the operations you will call. |
Use the returned access_token as the customer-level token. Keep it associated with the correct User, environment, granted scopes, and expiration. Requesting access for another User requires a separate exchange using that User's extId.
For example, basic supports the profile, structured blood result, and range calls in Getting Started. Health PROMs requires health-proms; BRU upload and status require bru.upload and bru.status. Check the operation's API Reference for its scope requirements.
Token Response Handling
The token response uses the same field names for both requests:
| Field | Application handling |
|---|---|
access_token | Use this Bearer token for the token level and User context requested. |
token_type | The returned token type is Bearer. |
scope | Retain the granted scope information and check it when diagnosing authorization failures. |
expires_in | Track expiration using the returned lifetime in seconds rather than a fixed duration. |
These service-level and exchanged customer tokens do not have refresh tokens in this integration flow.
Send Authenticated API Requests
Send the access token required by the operation in the Authorization header:
Authorization: Bearer {access_token}For example, retrieving a blood result requires a customer token:
See Get specific blood result for request and response details.
GET /it-web/blood/customer/v1/results/12321
Authorization: Bearer {customer_access_token}Renew Or Replace Access
| Situation | What to do |
|---|---|
| Service-level token expires or is unavailable | Request a new token with client_credentials, using your client ID and client secret. |
| Customer token expires or is unavailable | Repeat token exchange for the stored customer:{extId}, using a valid service-level token. |
| Both tokens need replacement | Request a service-level token first, then exchange it for customer access. |
| A different customer scope is needed | Request customer access with the required scopes, subject to your organization's permissions. |
Retain the User's existing extId mapping when replacing access. Reuse valid access tokens within their lifetime; token expiration does not require registering the User again.
After an authentication failure, obtain valid access before continuing. For a write with an uncertain outcome, use the workflow's readback or recovery operation before deciding to submit the write again.
Troubleshooting
| Outcome | What to check |
|---|---|
Token request returns 400 | Check the request shape for the selected grant, including the exact grant name and required exchange fields. |
Token request returns 401 | Check your organization credentials or subject token against the authentication requirements for that grant. |
Token request returns 429 | Reduce request frequency and reuse still-valid tokens; follow any response retry guidance. |
Resource request returns 401 | Check token expiration, the Authorization header, and the request environment. |
Resource request returns 403 | Check the operation's required token level and scopes. |
| Customer exchange fails | Check the service token, organization permissions, customer:{extId}, and customer-api audience. |
Use the token operation reference for complete request variants, response schemas, and error details.
Security Practices
- Keep client secrets and service-level tokens in your backend's secure credential storage.
- Keep customer tokens associated with the correct User and environment; prevent cross-User reuse.
- Keep credentials and tokens out of source code and application logs.
- Request the access needed for the operations you support.
- Use
extIdas an identity mapping, with the required token for authorization. - Replace credentials through your organization's process if a client secret may have been exposed.
Implementation Checklist
- Your backend can request a service-level token with
client_credentials. - You store the User's successful registration
extId. - You can exchange the service token for
customer:{extId}with audiencecustomer-api. - You use the correct access token and scopes for each operation.
- You track expiration and request replacement tokens through the appropriate grant.
- Your application can recover User access using the existing identity mapping.
Related Documentation
Updated about 1 month ago