Skip to content

Authentication

Portal API uses the OAuth 2.0 client credentials grant. Your application exchanges a client_id and client_secret for a short-lived Bearer token, which is then passed on every subsequent request.


Credentials

Your client_id and client_secret are provided by your contact person at Track32. Store them securely, particularly the client_secret, as that's something we don't save, and can't provide to you again. If you lost it, please contact us to send you new credentials.


Obtaining a Token

Send a POST request to /v1/auth with your credentials as form fields.

curl -X POST https://portal-api.test-visiontrack.nl/v1/auth \
  -d "client_id=<CLIENT_ID>&client_secret=<CLIENT_SECRET>&grant_type=client_credentials"

import httpx

resp = httpx.post(
    "https://portal-api.test-visiontrack.nl/v1/auth",
    data={
        "client_id": "<CLIENT_ID>",
        "client_secret": "<CLIENT_SECRET>",
        "grant_type": "client_credentials",
    },
)
resp.raise_for_status()
token_data = resp.json()
Again, make sure to replace <CLIENT_ID> and <CLIENT_SECRET> from the secrets provided by Track32.

Request fields

Field Required Value
client_id Yes Your client identifier
client_secret Yes Your client secret
grant_type Yes Must be client_credentials

Response

{
  "access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
  "token_type": "Bearer",
  "expires_in": 3600
}
Field Description
access_token The token to include in subsequent requests
token_type Always Bearer
expires_in Seconds until the token expires (3600 = 1 hour)

Using the Token

Pass the token in the Authorization header on every request to a protected endpoint.

curl https://portal-api.test-visiontrack.nl/v1/batches \
  -H "Authorization: Bearer ACCESS_TOKEN"
import httpx

resp = httpx.get(
    "https://portal-api.test-visiontrack.nl/v1/batches",
    headers={"Authorization": f"Bearer {access_token}"},
)

Token Expiry

Tokens expire after 1 hour. Once expired, repeat the authentication request to obtain a new one. Your integration should handle 401 responses by re-authenticating and retrying.

import httpx

def get_token(client_id: str, client_secret: str) -> str:
    resp = httpx.post(
        "https://portal-api.test-visiontrack.nl/v1/auth",
        data={
            "client_id": client_id,
            "client_secret": client_secret,
            "grant_type": "client_credentials",
        },
    )
    resp.raise_for_status()
    return resp.json()["access_token"]

v2 auth

/v2/auth is also available and behaves identically to /v1/auth.