Перейти к основному содержанию
GET
/
v1
/
profile
JavaScript
import Gmt from 'gmt-typescript-sdk';

const client = new Gmt({
  apiKey: process.env['GMT_API_KEY'], // This is the default and can be omitted
});

const profile = await client.profile.retrieve();

console.log(profile.id);
{
  "id": 123,
  "telegram_id": "123456789",
  "telegram_username": "username",
  "login": "username",
  "balance": {
    "amount": "1.50",
    "currency_code": "USD"
  },
  "statistics": {
    "total_purchases": 42
  },
  "discount": {
    "level": "silver",
    "percent": 5
  },
  "referral": {
    "level": "platinum",
    "percent": 10,
    "referrals_count": 12,
    "balance": {
      "amount": "1.50",
      "currency_code": "USD"
    },
    "profit": {
      "amount": "1.50",
      "currency_code": "USD"
    }
  },
  "created_at": "2024-06-01T12:00:00.000Z"
}

Авторизации

x-api-key
string
header
обязательно

API-key that you received from Telegram Bot.

Ответ

200 - application/json

Successful response.

Successful response.

id
string
обязательно

User Database ID

Пример:

123

telegram_id
string | null
обязательно

User's Telegram ID (null for web-only users)

Пример:

"123456789"

telegram_username
string | null
обязательно

User's Telegram username

Пример:

"username"

login
string | null
обязательно

Web username

Пример:

"username"

balance
object
обязательно
statistics
object
обязательно
discount
object
обязательно
referral
object
обязательно
created_at
string
обязательно

Account creation time in ISO 8601 format (UTC)

Пример:

"2024-06-01T12:00:00.000Z"