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 The API key provided by GenLogs. This header must be included in the request.

Endpoint

Request Parameters

  • email (string, required): The email address of the user requesting the tokens.

  • password (string, required): The password of the user for authentication.

Both email and password must be URL-encoded to ensure correct transmission. Certain characters, such as "+", can cause errors if not encoded. For example, "1234+" should be encoded as "1234%2B".

  • Here's a link to a URL encoder tool that you can use: URL-encoder

Response

  • 200 OK: Successfully generated and returned the access and refresh tokens.

  • 401 Unauthorized: If the provided email, and password, resulting in a failure to create the tokens.

  • 500 Internal Server Error: If an error occurs on the server during token creation.

Response Body

  • access_token_data (TokenSchema): The schema representing the access token and its expiration.

    • token (string): The access token string used for authentication or authorization.

    • expires (datetime): The datetime when the access token will expire.

  • refresh_token_data (TokenSchema): The schema representing the refresh token and its expiration.

    • token (string): The refresh token string used for obtaining a new access token.

    • expires (datetime): The datetime when the refresh token will expire.

  • user_id (string): The ID of the user for whom the tokens were created.

Request Example:

curl -X POST 'https://api.genlogs.io/auth/token/?email={email}&password={password}' \
-H 'accept: application/json' \
-H 'x-api-key: {your_api_key}'

Create Access Token

post

Create and return new access and refresh tokens for a user based on their email and password.

Args: email (str): The email of the user for whom the tokens are created. password (str): The password of the user for authentication.

Returns: AuthSchema: The schema containing the new access and refresh tokens.

Raises: HTTPException: If the token creation fails due to incorrect credentials.

Query parameters
emailstringRequired
passwordstringRequired
Header parameters
acceptstringRequired

application/json

Example: application/json
x-api-keystringRequired

X api key for authentication

Example: [x-api-key]
Responses
200
Successful Response
application/json
post
POST /auth/token HTTP/1.1
Host: api.genlogs.io
accept: application/json
x-api-key: [x-api-key]
Accept: */*
{
  "access_token_data": {
    "token": "text",
    "expires": "2025-06-27T06:31:29.043Z"
  },
  "refresh_token_data": {
    "token": "text",
    "expires": "2025-06-27T06:31:29.043Z"
  },
  "user_id": 1
}

Last updated