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

console.log(bulk.bulk_purchase_id);
{
  "bulk_purchase_id": 123,
  "country_code": "<string>",
  "quantity": 4503599627370496,
  "total_price": {
    "amount": "1.50",
    "currency_code": "USD"
  },
  "price_per_account": {
    "amount": "1.50",
    "currency_code": "USD"
  },
  "item": {
    "export_id": "550e8400-e29b-41d4-a716-446655440000",
    "archive_url": "/v1/purchases/bulk/123/download",
    "quantity": 10,
    "created_at": "2024-11-19T08:15:00.000Z"
  },
  "created_at": "<string>",
  "updated_at": "<string>"
}

Авторизации

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"

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

Number of accounts to purchase

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

10

callback_url
string<uri>

URL to receive webhook notification when bulk archive is ready. POST request will be sent with WebhookBulkReadyPayload.

Retry policy. If your endpoint does not return HTTP 200, webhook will be retried up to 3 times with delays: immediately, after 10 seconds, after 30 seconds. Any non-200 response triggers retry.

Пример:

"https://example.com/webhooks/code-received"

Ответ

200 - application/json

Response for status 200

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

Unique ID of the bulk purchase request

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

123

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

ISO 3166-1 alpha-2 country code.

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

Number of accounts in this purchase

Требуемый диапазон: 1 <= x <= 9007199254740991
total_price
object
обязательно

Total price for all accounts

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

Price of a single account

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

Archive data (only populated when status is SUCCESS)

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

Current status of bulk purchase

Доступные опции:
PENDING,
SUCCESS,
ERROR,
REFUND
created_at
string
обязательно

Bulk purchase creation timestamp

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

Last update timestamp