Skip to main content
POST
/
api
/
v2
/
auth
/
telegram
Telegram Login
curl --request POST \
  --url https://api.example.com/api/v2/auth/telegram \
  --header 'Content-Type: application/json' \
  --data '
{
  "id": 123,
  "first_name": "<string>",
  "auth_date": 123,
  "hash": "<string>",
  "username": "<string>",
  "photo_url": "<string>"
}
'
id
integer
required
Telegram user ID.
first_name
string
required
Telegram first name.
auth_date
integer
required
Unix timestamp of the authorization.
hash
string
required
HMAC-SHA256 signature from Telegram Widget.
username
string
Telegram username (optional, not always set).
photo_url
string
Profile photo URL (optional).

Overview

Pass the full data object returned by the Telegram Login Widget directly to this endpoint.

Request

curl -X POST https://neuralbox.top/api/v2/auth/telegram \
  -H "Content-Type: application/json" \
  -d '{
    "id": 123456789,
    "first_name": "Ivan",
    "username": "ivan_dev",
    "auth_date": 1741432800,
    "hash": "abc123..."
  }'

Response

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