> For the complete documentation index, see [llms.txt](https://pixyleai.gitbook.io/pixyle.ai-documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://pixyleai.gitbook.io/pixyle.ai-documentation/api-endpoints/obtain-a-token/routes.md).

# Routes

## User Login

> Endpoint that generates access and refresh tokens\
> when user's email and password are submitted.<br>

```json
{"openapi":"3.0.3","info":{"title":"Authentication API","version":"1.0.0"},"tags":[{"name":"Authentication","description":"User authentication and token management operations"}],"servers":[{"url":"https://api.pixyle.ai/auth/v1"}],"paths":{"/token":{"post":{"summary":"User Login","description":"Endpoint that generates access and refresh tokens\nwhen user's email and password are submitted.\n","tags":["Authentication"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LoginRequest"}}}},"responses":{"200":{"description":"Login successful","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LoginResponse"}}}},"400":{"description":"Bad request - Missing JSON body","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Unauthorized - Invalid credentials or account not activated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Forbidden - Email not verified (demo accounts)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}}},"components":{"schemas":{"LoginRequest":{"type":"object","required":["email","password"],"properties":{"email":{"type":"string","format":"email","description":"User's email address"},"password":{"type":"string","minLength":1,"description":"User's password"},"permanent_login":{"type":"boolean","default":false,"description":"Whether to create a permanent login session"}},"additionalProperties":false},"LoginResponse":{"type":"object","required":["access_token","expires_in","refresh_token"],"properties":{"access_token":{"type":"string","description":"JWT access token for API authentication"},"expires_in":{"type":"integer","description":"Token expiration time in seconds"},"refresh_token":{"type":"string","description":"JWT refresh token for obtaining new access tokens"}}},"ErrorResponse":{"type":"object","required":["error"],"properties":{"error":{"type":"string","description":"Error message describing what went wrong"}}}}}}
```

## Revoke Access Token

> Set user's access token to be expired.\
> The user needs to provide an access token in the header.<br>

```json
{"openapi":"3.0.3","info":{"title":"Authentication API","version":"1.0.0"},"tags":[{"name":"Authentication","description":"User authentication and token management operations"}],"servers":[{"url":"https://api.pixyle.ai/auth/v1"}],"security":[{"BearerAuth":[]}],"components":{"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"JWT access token for authenticated requests"}},"schemas":{"RevokeResponse":{"type":"object","required":["msg"],"properties":{"msg":{"type":"string","description":"Success message"}}},"ErrorResponse":{"type":"object","required":["error"],"properties":{"error":{"type":"string","description":"Error message describing what went wrong"}}}}},"paths":{"/revoke_access":{"delete":{"summary":"Revoke Access Token","description":"Set user's access token to be expired.\nThe user needs to provide an access token in the header.\n","tags":["Authentication"],"responses":{"200":{"description":"Access token revoked successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RevokeResponse"}}}},"401":{"description":"Unauthorized - Invalid or missing access token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}}}}
```
