Obtain authorization

Get authenticated using your login credentials (username and password) and obtain authorization token needed for subsequent API calls requiring authentication.

  • HTTP Method: POST
  • URL: https://example.domain.tld/api/v1/auth/
  • Require authentication: No

Request parameters

Parameter Type Description Required
username str Your account username Required
password str Your account password Required
otp str One time password Optional

Response parameters

Parameter Type Description
auth dict The authentication status object
username str Your account username
status str Authentication status
message str Authentication status description
auth_token str Authorization token
perm_level str Your account permission level
valid_from int Token start of validity as UNIX timestamp (seconds)
valid_to int Token expiry as UNIX timestamp (seconds)

Example request (Python)

import requests
import json
from pprint import pprint

url = "https://example.domain.tld/api/v1/auth/"
username = "admin"
password = "2xtoC5UGjMNieTBpGsAO"
otp = "378851"
data = {
    "username" : username,
    "password" : password,
    "otp" : otp
}
r = requests.post(url, json=data)
try:
    pprint(r.json())
except:
    print(r.text)

Example request (curl)

curl -X POST https://example.domain.tld/api/v1/auth/ -d '{ "username" : "admin", "password" : "2xtoC5UGjMNieTBpGsAO" }' -H "Content-Type: application/json"

Example response (JSON)

{'auth': {'auth_token': 'Woy1D6tHXVc1heFmzDnSZ5svoR81IbW5fxbA2lZq',
          'message': 'Successfully logged in',
          'perm_level': 'MasterAdmin',
          'status': 'success',
          'username': 'admin',
          'valid_from': 1582536047,
          'valid_to': 1582622447}}