For the complete documentation index, see llms.txt. This page is also available as Markdown.

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-key header with the API key provided by GenLogs. Requests without a valid key are rejected with 403 Forbidden.

Endpoint

  • URL: https://api.genlogs.io/auth/token

  • Method: 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 email or password is missing from the body.

  • 401 Unauthorized: The email and password could not be validated, so no tokens were created.

  • 403 Forbidden: The x-api-key header 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-After header.

Response Body

Note: The refresh token is not usable at this time. Please create a new token after your original access token has expired.

  • 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 access and refresh tokens

post

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.

Authorizations
x-api-keystringRequired

API key provided by GenLogs.

Body
emailstring · emailRequired

Email of the user requesting tokens.

passwordstring · passwordRequired

Password of the user requesting tokens.

Responses
200

Access and refresh tokens created successfully.

application/json
user_idintegerRequired
company_idinteger · nullableOptional
customer_namestring · nullableOptional
post/auth/token
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