OAuth token-based access is recommended over legacy cookie-based authentication methods to access analytics API.
Step 1: Obtain an OAuth Token
Applications should authenticate with the Director as an API client to obtain an OAuth token. Use the following curl command to request a token (refer sample below):
$ curl -k -H "Content-Type: application/json" -H "Accept: application/json""https://10.70.46.248:9183/auth/token" -d '{
"client_id": "versa-analytics",
"client_secret": "df77fb6823b34434ee945c7e914c925dd3e2b",
"username": "analytics_service_account",
"password": "<PASSWD>",
"grant_type": "password"
}'
{
"access_token": "eyJhbGciOiJIUzI1NiJ9.eyJqdGkiOiJjMGY1NTlmZmUxYjVlOTgyNjFiM2QxMzI5YWY4NmQ3YzI2MjM2YmQ5MjZjYTBiZGQzN2M1MmRmNjA1ZDI5ODU1IiwiaWF0IjoxNzUyODcxNDk4LCJyb2xlIjoiUHJvdmlkZXJEYXRhQ2VudGVyU3lzdGVtQWRtaW4iLCJ1c2VybmFtZSI6ImFuYWx5dGljc19zZXJ2aWNlX2FjY291bnQiLCJleHAiOjkyMjMzNzIwMzY4NTQ3NzV9.ESyG1dxx94wKHu83wY1HX-0aYGb0_OTHQ7tIlGHYGGg",
"issued_at": "2025-07-18T20:44:58.859Z",
"expires_in": "-1",
"token_type": "Bearer",
"refresh_token": "eyJhbGciOiJIUzI1NiJ9.eyJqdGkiOiI1ZGJkOGJlYzVhOGFhYTlkYzAyZmRkZjQxNGE5MDVhZDZiN2M2MDdlMzZjY2QwZTU5ZjE2NDcyZjgzMmMzMDcxIiwiaWF0IjoxNzUyODcxNDk4LCJyb2xlIjoiUHJvdmlkZXJEYXRhQ2VudGVyU3lzdGVtQWRtaW4iLCJ1c2VybmFtZSI6ImFuYWx5dGljc19zZXJ2aWNlX2FjY291bnQiLCJleHAiOjkyMjMzNzIwMzY4NTQ3NzV9.VOvmijmprmrzwNcMhJqCr5dbCpWu6d-mBW4kk-78Mvo",
"user": {
"name": "analytics_service_account",
"firstname": "van",
"lastname": "admin",
"email": "support@versa-networks.com",
"is_external_user": false,
"enable_two_factor": false,
"idle_time_out": 15,
"roles": [
"ProviderDataCenterSystemAdmin"
],
"primaryrole": "ProviderDataCenterSystemAdmin",
"obfuscationEnabled": false,
"isSSOUser": false
},
"auth_context": {
"isAuthInSlaveNode": false
}A successful response returns an access_token which you will use to authorize subsequent API requests.
Step 2: Use the Token to Access the Analytics API
Once you have the access_token, you can call the Analytics APIs by including the token in the Authorization header:
$ curl -k --location 'https: //192.168.1.20/versa/analytics/v1.0.0/data/provider/tenants/Corp-Inline-Customer-1/features/SDWAN/?qt=rangeseries&&start-date=1daysAgo&end-date=today&q=linkstatus(site,accckt)&metrics=availability&ds=aggregate&fq=(siteName:%22HE-DC-Branch-1%22)&count=16' --header 'Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJqdGkiOiJjMGY1NTlmZmUxYjVlOTgyNjFiM2QxMzI5YWY4NmQ3YzI2MjM2YmQ5MjZjYTBiZGQzN2M1MmRmNjA1ZDI5ODU1IiwiaWF0IjoxNzUyODcxNDk4LCJyb2xlIjoiUHJvdmlkZXJEYXRhQ2VudGVyU3lzdGVtQWRtaW4iLCJ1c2VybmFtZSI6ImFuYWx5dGljc19zZXJ2aWNlX2FjY291bnQiLCJleHAiOjkyMjMzNzIwMzY4NTQ3NzV9.ESyG1dxx94wKHu83wY1HX-0aYGb0_OTHQ7tIlGHYGGg'
{
"qTime": 35,
"data": [
{
"name": "Down",
"type": "data",
"metric": "availability",
"data": []
},
{
"name": "Degraded",
"type": "data",
"metric": "availability",
"data": [
[
0,
1752738300000,
1752738900000
],
[
0,
1752748800000,
1752749400000
]
]
},
{
"name": "Up",
"type": "data",
"metric": "availability",
"data": [
[
0,
1752710400000,
1752738300000
],
[
0,
1752738900000,
1752748800000
],
[
0,
1752749400000,
1752871500000
]
]
},
{
"name": "Indeterminable",
"type": "data",
"metric": "availability",
"data": []
}
],
"metadata": {
"categories": [
"HE-DC-Branch-1,Internet-1 (100.00 %)"
],
"type": "range"
},
"totalCount": 1Note: Ensure your token is valid and not expired before making requests. Tokens have an expiration time and must be refreshed when needed.