Skip to content
Main site Contact

Token endpoint

Use this endpoint to get either an app token or a user token.

ItemValue
MethodPOST
Path/api/Token
AuthNo bearer token
Content-Typeapplication/x-www-form-urlencoded
ResponseJSON object with access_token, refresh_token, token_type, expires_in
FieldRequiredValuesNotes
grant_typeYesclient_credentials, password, refresh_tokenSelects the auth flow.
client_idYesAPI client GUID/string issued by VizSeekRequired for every flow.
usernamePassword flow onlyUser email addressUse with grant_type=password.
passwordPassword flow onlySHA-1 hex digestNot raw text. Not base64.
refresh_tokenRefresh flow onlyRefresh token returned by a previous token responseUse with grant_type=refresh_token.

Use this when the endpoint only needs the API client identity.

Terminal window
curl -X POST "https://your-server.example.com/api/Token" \
-H "Content-Type: application/x-www-form-urlencoded" \
--data-urlencode "grant_type=client_credentials" \
--data-urlencode "client_id=YOUR_CLIENT_ID"
import requests
server = "https://your-server.example.com"
client_id = "YOUR_CLIENT_ID"
resp = requests.post(
f"{server}/api/Token",
headers={"Content-Type": "application/x-www-form-urlencoded"},
data={
"grant_type": "client_credentials",
"client_id": client_id,
},
)
resp.raise_for_status()
token_data = resp.json()
print(token_data["access_token"])

Use this when the endpoint needs a signed-in user.

POST /api/Token HTTP/1.1
Host: your-server.example.com
Content-Type: application/x-www-form-urlencoded
grant_type=password&client_id=YOUR_CLIENT_ID&username=user%40example.com&password=SHA1_HEX_PASSWORD
import hashlib
import requests
server = "https://your-server.example.com"
client_id = "YOUR_CLIENT_ID"
username = "user@example.com"
password = "YourPlainTextPassword"
sha1_hex = hashlib.sha1(password.encode("utf-8")).hexdigest()
resp = requests.post(
f"{server}/api/Token",
headers={"Content-Type": "application/x-www-form-urlencoded"},
data={
"grant_type": "password",
"client_id": client_id,
"username": username,
"password": sha1_hex,
},
)
resp.raise_for_status()
token_data = resp.json()
print(token_data["access_token"])
print(token_data["refresh_token"])

Use this when your access token has expired and you still have a valid refresh token.

Terminal window
curl -X POST "https://your-server.example.com/api/Token" \
-H "Content-Type: application/x-www-form-urlencoded" \
--data-urlencode "grant_type=refresh_token" \
--data-urlencode "client_id=YOUR_CLIENT_ID" \
--data-urlencode "refresh_token=YOUR_REFRESH_TOKEN"
resp = requests.post(
f"{server}/api/Token",
headers={"Content-Type": "application/x-www-form-urlencoded"},
data={
"grant_type": "refresh_token",
"client_id": client_id,
"refresh_token": existing_refresh_token,
},
)
resp.raise_for_status()
new_token_data = resp.json()

Typical response:

{
"access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"refresh_token": "95c0858d-b0a0-4110-a81d-18978ae78ec0",
"token_type": "bearer",
"expires_in": "1799"
}
FieldMeaning
access_tokenJWT bearer token used in the Authorization header
refresh_tokenOpaque token used only with grant_type=refresh_token
token_typeAlways bearer
expires_inLifetime in seconds, returned as a string
  • client_id missing.: you did not send client_id.
  • 'client_id' incorrect. or client_id incorrect.: the API client ID is not recognized.
  • User authentication failed.: wrong email, wrong password hash, or wrong client ID for that user flow.
  • Invalid request: missing or expired refresh token, or an unsupported grant type.