> ## Documentation Index
> Fetch the complete documentation index at: https://docs.elumenta.ru/llms.txt
> Use this file to discover all available pages before exploring further.

# Telegram Login

> Sign in with Telegram Login Widget

<ParamField body="id" type="integer" required>
  Telegram user ID.
</ParamField>

<ParamField body="first_name" type="string" required>
  Telegram first name.
</ParamField>

<ParamField body="auth_date" type="integer" required>
  Unix timestamp of the authorization.
</ParamField>

<ParamField body="hash" type="string" required>
  HMAC-SHA256 signature from Telegram Widget.
</ParamField>

<ParamField body="username" type="string">
  Telegram username (optional, not always set).
</ParamField>

<ParamField body="photo_url" type="string">
  Profile photo URL (optional).
</ParamField>

## Overview

Pass the full data object returned by the [Telegram Login Widget](https://core.telegram.org/widgets/login) directly to this endpoint.

## Request

```bash theme={null}
curl -X POST https://elumenta.ru/api/v2/auth/telegram \
  -H "Content-Type: application/json" \
  -d '{
    "id": 123456789,
    "first_name": "Ivan",
    "username": "ivan_dev",
    "auth_date": 1741432800,
    "hash": "abc123..."
  }'
```

## Response

```json theme={null}
{
  "access_token": "eyJhbGciOiJIUzI1NiJ9...",
  "refresh_token": "eyJhbGciOiJIUzI1NiJ9...",
  "token_type": "bearer",
  "is_new_user": true,
  "user": {
    "id": 12345,
    "telegram_id": 123456789,
    "plan": "free",
    "token_balance": 50
  }
}
```
