create token.md

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

Endpoint

Request Parameters

Credentials must be provided in the JSON request body.

Recommended: JSON request body

Send email and password in a JSON body with the Content-Type: application/json header. No URL-encoding of special characters is needed (e.g. 1234+ can be sent as-is).

curl -X POST 'https://api.genlogs.io/auth/token/'
-H 'accept: application/json'
-H 'Content-Type: application/json'
-H 'x-api-key: {your_api_key}'
-d '{"email": "{email}", "password": "{password}"}'

Body schema:

{ "email": "user@example.com", "password": "your_password" }

Parameters

Response

Response Body

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

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

{"openapi":"3.0.3","info":{"title":"Auth API - Create Token","version":"1.0.0"},"servers":[{"url":"https://api.genlogs.io","description":"GenLogs API"}],"paths":{"/auth/token":{"post":{"tags":["auth"],"summary":"Create access and refresh tokens","description":"Create and return new access and refresh tokens for a user based on their email and password.","operationId":"createAccessToken","parameters":[{"name":"email","in":"query","required":true,"schema":{"type":"string","format":"email"},"description":"Email of the user requesting tokens."},{"name":"password","in":"query","required":true,"schema":{"type":"string","format":"password"},"description":"Password of the user requesting tokens."}],"responses":{"200":{"description":"Access and refresh tokens created successfully.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AuthSchema"}}}},"401":{"description":"Token creation failed because credentials are invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPError"}}}},"422":{"description":"Request validation error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}},"components":{"schemas":{"AuthSchema":{"type":"object","required":["access_token_data","refresh_token_data","user_id"],"properties":{"access_token_data":{"$ref":"#/components/schemas/TokenSchema"},"refresh_token_data":{"$ref":"#/components/schemas/TokenSchema"},"user_id":{"type":"integer"},"company_id":{"type":"integer","nullable":true},"customer_name":{"type":"string","nullable":true}}},"TokenSchema":{"type":"object","required":["token","expires"],"properties":{"token":{"type":"string"},"expires":{"type":"string","format":"date-time"}}},"HTTPError":{"type":"object","properties":{"detail":{"type":"string"}}},"HTTPValidationError":{"type":"object","properties":{"detail":{"type":"array","items":{"$ref":"#/components/schemas/ValidationError"}}}},"ValidationError":{"type":"object","required":["loc","msg","type"],"properties":{"loc":{"type":"array","items":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"msg":{"type":"string"},"type":{"type":"string"}}}}}}