Skip to content

Issue access token

auth.issue_access_token(AuthIssueAccessTokenParams**kwargs) -> AuthIssueAccessTokenResponse
POST/v1/auth/access-tokens

Issues a short-lived access token from the authenticated API key. Access tokens can optionally be bound to a specific employer or employee for scoped access. Tokens expire after 15 minutes.

ParametersExpand Collapse
grant_type: Literal["client_credentials"]
  • client_credentials - client_credentials
bound_entity: Optional[BoundEntity]

Optional entity to bind the token to for scoped access

id: str

Prefixed entity ID to bind the token to (empr_* for employer, empl_* for employee)

type: Type
  • employer - employer
  • employee - employee
One of the following:
"employer"
"employee"
ReturnsExpand Collapse
class AuthIssueAccessTokenResponse:
access_token: str

The issued access token (vit_at_*)

expires_in: int

Token lifetime in seconds

token_type: str

Token type, always 'Bearer'

bound_entity: Optional[BoundEntity]

Entity the token is bound to, if any

id: str

Prefixed entity ID the token is bound to (empr_* or empl_*)

type: Type
  • employer - employer
  • employee - employee
One of the following:
"employer"
"employee"

Issue access token

import os
from vitable_connect import VitableConnect

client = VitableConnect(
    api_key=os.environ.get("VITABLE_CONNECT_API_KEY"),  # This is the default and can be omitted
)
response = client.auth.issue_access_token(
    grant_type="client_credentials",
)
print(response.access_token)
{
  "access_token": "vit_at_abc123def456...",
  "token_type": "Bearer",
  "expires_in": 910,
  "bound_entity": {
    "id": "empr_SGVsbG8gV29ybGQ",
    "type": "employer"
  }
}
Returns Examples
{
  "access_token": "vit_at_abc123def456...",
  "token_type": "Bearer",
  "expires_in": 910,
  "bound_entity": {
    "id": "empr_SGVsbG8gV29ybGQ",
    "type": "employer"
  }
}