Sign in from the Telegram Mini App
curl --request POST \
--url https://my.server.express/api/v1/auth/telegram-miniapp \
--header 'Content-Type: application/json' \
--data '
{
"initData": "<string>"
}
'const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({initData: '<string>'})
};
fetch('https://my.server.express/api/v1/auth/telegram-miniapp', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://my.server.express/api/v1/auth/telegram-miniapp"
payload = { "initData": "<string>" }
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"success": true,
"data": {
"accessToken": "<string>",
"refreshToken": "<string>",
"user": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"email": "[email protected]",
"firstName": "<string>",
"lastName": "<string>",
"role": "CLIENT",
"bannedAt": "2023-11-07T05:31:56Z"
}
}
}{
"success": false,
"error": "<string>"
}{
"success": false,
"error": "<string>"
}{
"success": false,
"error": "<string>"
}Auth
Sign in from the Telegram Mini App
Exchanges Telegram WebApp initData for a session. The HMAC is checked against the bot token and auth_date must be under an hour old. Only works for a Telegram account already linked in Settings — this never creates an account. If the account has a second factor, returns a pre-auth token instead of a session. Any failure from the account lookup (not linked, banned) is a 401 carrying the reason. Not rate-limited.
POST
/
v1
/
auth
/
telegram-miniapp
Sign in from the Telegram Mini App
curl --request POST \
--url https://my.server.express/api/v1/auth/telegram-miniapp \
--header 'Content-Type: application/json' \
--data '
{
"initData": "<string>"
}
'const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({initData: '<string>'})
};
fetch('https://my.server.express/api/v1/auth/telegram-miniapp', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://my.server.express/api/v1/auth/telegram-miniapp"
payload = { "initData": "<string>" }
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"success": true,
"data": {
"accessToken": "<string>",
"refreshToken": "<string>",
"user": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"email": "[email protected]",
"firstName": "<string>",
"lastName": "<string>",
"role": "CLIENT",
"bannedAt": "2023-11-07T05:31:56Z"
}
}
}{
"success": false,
"error": "<string>"
}{
"success": false,
"error": "<string>"
}{
"success": false,
"error": "<string>"
}Body
application/json
The raw Telegram.WebApp.initData query string, including hash, auth_date and user.