All NikoHealth API requests must be authorized using OAuth 2.0 with the Client Credentials flow. You exchange your Client ID and Client Secret for an access token, then send that token with every API call.
Your Credentials
Your Client ID and Client Secret are provided with your API subscription.
🔒 Keep these secret. Never embed or expose them in HTML, JavaScript or any public-facing application. Use them only in code that runs in a trusted, controlled environment and connects directly to the NikoHealth APIs.
Step 1: Request an Access Token
POST https://{yourDomain}.nikohealth.com/api/identity/connect/token
Headers
Header | Value |
|
|
Form Parameters
Parameter | Value |
|
|
| Your Client ID |
| Your Client Secret |
|
|
Example
curl --location 'https://{yourDomain}.nikohealth.com/api/identity/connect/token' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'grant_type=client_credentials' \
--data-urlencode 'client_id=YOUR_CLIENT_ID' \
--data-urlencode 'client_secret=YOUR_CLIENT_SECRET' \
--data-urlencode 'scope=external'
Response: 200 OK
{
"access_token": "BE55CF536EC46D12F9FDBF1EFD831E086B121939B9806DF43F3A6043C67DB0AC",
"expires_in": 1200,
"token_type": "Bearer",
"scope": "external"
}Field | Description |
| The token you send with every API request |
| The token lifetime in seconds. |
| Always |
|
|
⏱️ Tokens expire after 20 minutes, and there’s no refresh token. Cache the token and reuse it for all requests until shortly before it expires, then request a new one. Don’t request a new token for every API call.
Step 2: Call the API
Pass the access token as a Bearer token in the Authorization header of every request.
Base URL: https://{yourDomain}.nikohealth.com/api/external
curl --request GET \
--url 'https://{yourDomain}.nikohealth.com/api/external/v1/patients' \
--header 'Authorization: Bearer {access_token}' \
--header 'Accept: application/json'
If the token is missing, expired or invalid, the API returns 401 Unauthorized. Request a new token and retry.
Using Swagger
The Swagger interface you’ve been given lets you try the APIs directly while you build your integration. To authorize in Swagger:
Click the green Authorize button at the top right of the page.
Enter your Client ID in the client_id field.
Enter your Client Secret in the client_secret field.
Under Scopes, check external.
Click Authorize.
Swagger requests and attaches the token for you, so you can call any endpoint from the page.
Common Errors
Code | Meaning |
400 (token endpoint) | Invalid request, such as a wrong |
401 (API) | The token is missing, expired or invalid |
403 (API) | The token is valid, but your client doesn’t have permission for that resource |
429 | Too many requests |

