---
title: "Auth via telegram"
method: POST
path: "/api/v1/auth/tg"
tags: ["auth"]
---

# Auth via telegram

`POST /api/v1/auth/tg`

The token is recorded in the database and in the user's cookies.  If the user logs in under different browsers, then each authorization will have its own token.

## Request body

- TgAuth
  - `id` integer, required
  - `first_name` string
  - `last_name` string
  - `photo_url` string
  - `username` string
  - `hash` string, required
  - `auth_date` integer, required
  - `referral_id` string

## Response `200`

Ok

- Ok
  - `ok` boolean, required

## Other responses

- `400` — Something went wrong on client side
- `403` — Access token is missing or invalid
- `404` — The specified resource was not found
- `500` — Something went wrong on server side

## Changes

- **2024-11-20** `4a33093284b6` — 1 info
  - added the new optional request property `referral_id`
- **2024-06-14** `5d8d7caae34c` — 1 info
  - api operation id `authViaTG` was added

[Change history](https://skmtc.dev/tonkeeper/apis/rest-api-to-ton-console/changes/api/v1/auth/tg/post.md)

---

[API](https://skmtc.dev/tonkeeper/apis/rest-api-to-ton-console.md) · [All operations](https://skmtc.dev/tonkeeper/apis/rest-api-to-ton-console/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/tonkeeper/rest-api-to-ton-console/revisions/bffcc11719d3/schema)
