Skip to content

Authorization

System authorization

INFO

System authorization

POST v2/login Authorization method
http
https://client.adstat.pro/api/v2/login

Request body FormData

ParameterTypeDescription
usernamestringUser login
passwordstringUser password

Content-Type:

  • application/x-www-form-urlencoded
  • multipart/form-data

Request:

username=user@example.com
password=string

Response:

json
{
	"user_id": "3fa85f64-5717-4562-b3fc-2c922263f66a",
	"access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9",
	"refresh_token": "dGhpcyBpcyBhIHJlZnJlc2ggdG9rZW4gdXNlZCB0byBnZXQgYW4gbmV3IGFjY2VzcyB0b2tlbiB3aGVuIHRoZSBjdXJyZW50IGFjY2VzcyB0b2tlbiBleHBpcmVz"
}

Pass <access_token> in HTTP request headers as:

  • Bearer <access_token>

Use <refresh_token> in the v2/access_token endpoint when <access_token> has expired to refresh <access_token>

Issuing a new access_token

INFO

Issuing a new access_token

GET v2/access-token

Example:

http
https://client.adstat.pro/api/v2/access-token

Parameters

Pass <refresh_token> in the HTTP header as:

  • refresh_token: <refresh_token>

Example successful response:

json
{
	"access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9",
	"token_type": "Bearer"
}

Lifetime and errors

refresh_token is automatically deactivated 30 days after issuance.

If no active refresh_token is found when refreshing (for example, it expired or was deactivated), the API returns:

json
{
	"detail": "Refresh Token Expired",
	"status_code": 401
}

In this case, the user must authenticate again (log in) to obtain new access_token and refresh_token.