Create token
Create Access Token
The "Create Access Token" endpoint allows a user to generate new access and refresh tokens by providing their email and password. These tokens are essential for authenticating and authorizing API requests.
Authentication
Include your
x-api-keyheader with the API key provided by GenLogs. Requests without a valid key are rejected with 403 Forbidden.
Endpoint
URL:
https://api.genlogs.io/auth/tokenMethod:
POST
Request Parameters
Send email and password in a JSON request body with the Content-Type: application/json header. No URL-encoding of special characters is needed (e.g. 1234+ can be sent as-is).
Body schema:
{ "email": "user@example.com", "password": "your_password" }Parameters
email(string, required): The email address of the user requesting the tokens. Must be a valid email address.password(string, required): The password of the user for authentication.
Request Example
Response
200 OK: The access and refresh tokens were created and returned.
400 Bad Request: The credentials were sent as query parameters, or
emailorpasswordis missing from the body.401 Unauthorized: The email and password could not be validated, so no tokens were created.
403 Forbidden: The
x-api-keyheader is missing or invalid.422 Unprocessable Entity: The password is empty, the email is not a valid email address, or the body is not valid JSON.
429 Too Many Requests: Too many token requests were made for the same account. Retry after the number of seconds in the
Retry-Afterheader.
Response Body
access_token_data (TokenSchema): The schema representing the access token and its expiration.
token (string): The access token string used for authentication and authorization.
expires (datetime): The datetime when the access token expires.
refresh_token_data (TokenSchema): The schema representing the refresh token and its expiration.
token (string): The refresh token string used to obtain a new access token.
expires (datetime): The datetime when the refresh token expires.
user_id (int): The ID of the user for whom the tokens were created.
company_id (int, nullable): The ID of the company associated with the authenticated user. May be
null.customer_name (string, nullable): The name of the customer associated with the authenticated user. May be
null.
Error Responses
400 Bad Request: credentials sent as query parameters
The root key is error, not detail.
400 Bad Request: email or password missing
401 Unauthorized
The same message is returned for every authentication failure. The response includes an X-Correlation-Id header. Include this value when contacting Support so the failure can be traced.
403 Forbidden
Returned by the API gateway before the request reaches the service when x-api-key is missing or invalid.
422 Unprocessable Entity: empty password
detail is a string.
422 Unprocessable Entity: invalid email, or body that is not valid JSON
detail is an array of validation errors, each with loc, msg, and type.
429 Too Many Requests
Token requests are limited per IP address and account, and per account across all sources. The Retry-After response header gives the number of seconds to wait before retrying.
Create and return new access and refresh tokens for a user based on their email and password. Credentials must be sent in the JSON request body. Query parameters are not supported: a request that sends credentials only as query parameters is rejected with HTTP 400.
API key provided by GenLogs.
Email of the user requesting tokens.
Password of the user requesting tokens.
Access and refresh tokens created successfully.
Bad Request. Returned when credentials are sent as query parameters instead of a JSON body (root key error), or when email or password is missing from the body (root key detail).
Unauthorized. The credentials could not be validated. The same generic message is returned for every authentication failure. Include the X-Correlation-Id header value when contacting Support.
Forbidden. The x-api-key header is missing or invalid. Returned by the API gateway before the request reaches the service.
Unprocessable Entity. detail is a string when the password is an empty string, and an array of validation errors when the body is not valid JSON or email is not a valid email address (including an empty string).
Too Many Requests. Login attempts are limited per IP and account, and per account across all sources. Wait the number of seconds in Retry-After before retrying.
POST /auth/token HTTP/1.1
Host: api.genlogs.io
x-api-key: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 55
{
"email": "user@example.com",
"password": "your_password"
}{
"access_token_data": {
"token": "text",
"expires": "2026-01-01T00:00:00.000Z"
},
"refresh_token_data": {
"token": "text",
"expires": "2026-01-01T00:00:00.000Z"
},
"user_id": 1,
"company_id": 1,
"customer_name": "text"
}Last updated