Перейти к основному содержанию
POST
/
v1
/
purchases
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 purchase = await client.purchases.create({ country_code: 'US' });

console.log(purchase.id);
{
  "id": 12345,
  "country_code": "US",
  "display_name": {
    "ru": "США",
    "en": "United States"
  },
  "phone_number": "+12025550123",
  "price": {
    "amount": "1.50",
    "currency_code": "USD"
  },
  "status": "SUCCESS",
  "purchase_type": "SINGLE",
  "verification": {
    "code": "12345",
    "password": "secret123",
    "received_at": "2024-11-19T07:52:00.000Z"
  },
  "created_at": "2024-11-19T07:50:00.000Z"
}

Авторизации

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

API-key that you received from Telegram Bot.

Тело

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

ISO 3166-1 alpha-2 country code.

Pattern: ^[A-Z]{2}$
Пример:

"US"

Ответ

200 - application/json

Response for status 200

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

Unique purchase identifier.

Требуемый диапазон: 1 <= x <= 9007199254740991
Пример:

12345

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

ISO 3166-1 alpha-2 country code.

Пример:

"US"

display_name
object
обязательно
phone_number
string | null
обязательно

E.164 International Format. Phone number with country code prefix (e.g., +12025550123 for US, +79991234567 for Russia).

Usage. This is your Telegram account login. Use it with verification.code and verification.password to access the account.

Pattern: ^\+[1-9]\d{1,14}$
Пример:

"+12025550123"

price
object
обязательно

Final Price After Discount. The actual amount deducted from your balance, with your personal discount already applied.

To see pricing breakdown before purchase. Check GET /accounts/:country_code which shows both discounted price and original base_price.

Discount eligibility. Based on your total successful purchase count. Higher volume = bigger discounts.

status
enum<string>
обязательно

Purchase Status Lifecycle. PENDING (initial) → SUCCESS (after code request) or ERROR (provider failure). Any status can transition to REFUND via admin action.

Important. Status is immutable once set to SUCCESS, ERROR, or REFUND.

Filter options

  • PENDING - code not requested.
  • SUCCESS - code ready.
  • ERROR - provider failed.
  • REFUND - money returned.
Доступные опции:
PENDING,
SUCCESS,
ERROR,
REFUND
Пример:

"SUCCESS"

purchase_type
enum<string>
обязательно

Type of purchase: SINGLE (regular), BULK (batch purchase), ADMIN (admin deduction)

Доступные опции:
SINGLE,
BULK,
ADMIN
Пример:

"SINGLE"

verification
object
обязательно

Verification Credentials. Login credentials for the purchased Telegram account. Initially null after purchase creation.

Availability. Populated after calling POST /purchases/:id/request-code. Once received, credentials are permanent and cannot be re-requested.

Security. Verification data is only visible to the purchase owner.

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

Purchase creation time in ISO 8601 format (UTC).

Пример:

"2024-11-19T07:50:00.000Z"