### Example API Request using GET Source: https://help.send.tg/en/articles/10279948-crypto-pay-api Demonstrates a typical GET request to the Crypto Pay API, including the host and the required API token header. This format is used for most API interactions. ```http GET /api/getMe HTTP/1.1 Host: pay.crypt.bot Crypto-Pay-API-Token: 123456789:AAzQcZWQqQAbsfgPnOLr4FHC8Doa4L7KryC ``` -------------------------------- ### GET /api/getMe Source: https://help.send.tg/ru/articles/10279948-crypto-pay-api This endpoint is used to get basic information about the bot and the user behind it. ```APIDOC ## GET /api/getMe ### Description This method returns basic information about the bot and the user behind it. ### Method GET ### Endpoint `/api/getMe` ### Parameters #### Query Parameters - **Crypto-Pay-API-Token** (string) - Required - Your API token. ### Request Example ``` GET /api/getMe HTTP/1.1 Host: pay.crypt.bot Crypto-Pay-API-Token: 123456789:AAzQcZWQqQAbsfgPnOLr4FHC8Doa4L7KryC ``` ### Response #### Success Response (200) - **ok** (boolean) - True if the request was successful. - **result** (object) - Contains information about the bot and user. - **user** (object) - Information about the user. - **id** (integer) - Unique identifier for the user. - **is_bot** (boolean) - True if the user is a bot. - **first_name** (string) - First name of the user. - **username** (string) - Username of the user. - **chat** (object) - Information about the chat (the bot itself). - **id** (integer) - Unique identifier for the bot. - **is_bot** (boolean) - True. - **first_name** (string) - First name of the bot. - **username** (string) - Username of the bot. #### Response Example ```json { "ok": true, "result": { "user": { "id": 1234567890, "is_bot": true, "first_name": "Crypto Testnet Bot", "username": "CryptoTestnetBot" }, "chat": { "id": 1234567890, "is_bot": true, "first_name": "Crypto Testnet Bot", "username": "CryptoTestnetBot" } } } ``` ``` -------------------------------- ### GET /getMe Source: https://help.send.tg/ru/articles/10279948-crypto-pay-api Tests your app's authentication token. On success, it returns basic information about the app. ```APIDOC ## GET /getMe ### Description Use this method to test your app's authentication token. Requires no parameters. On success, returns basic information about an app. ### Method GET ### Endpoint /getMe ### Parameters No parameters are required for this method. ### Response #### Success Response (200) - **ok** (Boolean) - Indicates if the request was successful. - **result** (Object) - Contains the app's basic information if `ok` is true. #### Response Example ```json { "ok": true, "result": { "id": 12345, "is_bot": true, "first_name": "MyBot" } } ``` ``` -------------------------------- ### GET /getStats Source: https://help.send.tg/ru/articles/10279948-crypto-pay-api Retrieves statistics about your application's usage. ```APIDOC ## GET /getStats ### Description Retrieves statistics about your application's usage. ### Method GET ### Endpoint /getStats ### Parameters No parameters are required for this method. ### Response #### Success Response (200) - **ok** (Boolean) - Indicates if the request was successful. - **result** (Object) - An object containing statistics if `ok` is true. Example: `{"total_invoices": 100, "total_checks": 50, "total_transfers": 200}` #### Response Example ```json { "ok": true, "result": { "total_invoices": 100, "total_checks": 50, "total_transfers": 200 } } ``` ``` -------------------------------- ### GET /getCurrencies Source: https://help.send.tg/ru/articles/10279948-crypto-pay-api Retrieves a list of supported currencies (both crypto and fiat). ```APIDOC ## GET /getCurrencies ### Description Retrieves a list of supported currencies (both crypto and fiat). ### Method GET ### Endpoint /getCurrencies ### Parameters No parameters are required for this method. ### Response #### Success Response (200) - **ok** (Boolean) - Indicates if the request was successful. - **result** (Object) - An object containing lists of supported crypto and fiat currencies if `ok` is true. #### Response Example ```json { "ok": true, "result": { "crypto": ["USDT", "TON", "BTC"], "fiat": ["USD", "EUR", "RUB"] } } ``` ``` -------------------------------- ### Getting Updates Source: https://help.send.tg/ru/articles/10279948-crypto-pay-api Information on how to receive updates for your app, either by polling with getInvoices or using Webhooks for real-time notifications. ```APIDOC # **Getting updates** There are two ways of receiving updates for your app — you can use getInvoices method to get a list of created invoices or Webhooks to receive updates in realtime. ``` -------------------------------- ### GET /getInvoices Source: https://help.send.tg/ru/articles/10279948-crypto-pay-api Retrieves a list of invoices. Supports filtering by status. ```APIDOC ## GET /getInvoices ### Description Retrieves a list of invoices. Supports filtering by status. ### Method GET ### Endpoint /getInvoices ### Parameters #### Query Parameters - **status** (String) - Optional. Filter invoices by status (e.g., "waiting", "paid", "expired"). ### Response #### Success Response (200) - **ok** (Boolean) - Indicates if the request was successful. - **result** (Array) - An array of invoice objects if `ok` is true. #### Response Example ```json { "ok": true, "result": [ { "invoice_id": "654321", "amount": "10.50", "status": "waiting" }, { "invoice_id": "123456", "amount": "25.00", "status": "paid" } ] } ``` ``` -------------------------------- ### GET /getExchangeRates Source: https://help.send.tg/en/articles/10279948-crypto-pay-api Retrieves the exchange rates of supported currencies. Requires no parameters. ```APIDOC ## GET /getExchangeRates ### Description Use this method to get exchange rates of supported currencies. Requires no parameters. Returns array of ExchangeRate. ### Method GET ### Endpoint /getExchangeRates ### Parameters Requires no parameters. ### Response #### Success Response (200) - **exchange_rates** (Array of Object) - Array of ExchangeRate objects. #### Response Example ```json { "exchange_rates": [ { "asset": "USDT", "rate": "1.00", "currency": "USD" } ] } ``` ``` -------------------------------- ### GET /getCurrencies Source: https://help.send.tg/en/articles/10279948-crypto-pay-api Retrieves a list of supported currencies (both fiat and cryptocurrency). Requires no parameters. ```APIDOC ## GET /getCurrencies ### Description Use this method to get a list of supported currencies. Requires no parameters. Returns a list of fiat and cryptocurrency alphabetic codes. ### Method GET ### Endpoint /getCurrencies ### Parameters Requires no parameters. ### Response #### Success Response (200) - **currencies** (Object) - An object containing lists of supported crypto and fiat currencies. #### Response Example ```json { "currencies": { "crypto": ["USDT", "TON", "BTC"], "fiat": ["USD", "EUR", "RUB"] } } ``` ``` -------------------------------- ### GET /getStats Source: https://help.send.tg/ru/articles/10279948-crypto-pay-api Retrieves statistics for your app. You can specify a date range using `start_at` and `end_at` parameters. ```APIDOC ## GET /getStats ### Description Use this method to get app statistics. On success, returns AppStats. ### Method GET ### Endpoint /getStats ### Parameters #### Query Parameters - **start_at** (String) - Optional - Date from which start calculating statistics in ISO 8601 format. Defaults is current date minus 24 hours. - **end_at** (String) - Optional - The date on which to finish calculating statistics in ISO 8601 format. Defaults is current date. ### Response #### Success Response (200) - **app_stats** (Object) - App statistics object. #### Response Example ```json { "app_stats": { "total_users": 1000, "total_transactions": 5000, "total_volume": "100000.00" } } ``` ``` -------------------------------- ### GET /getExchangeRates Source: https://help.send.tg/ru/articles/10279948-crypto-pay-api Retrieves the exchange rates for supported currencies. This endpoint requires no parameters. ```APIDOC ## GET /getExchangeRates ### Description Use this method to get exchange rates of supported currencies. Requires no parameters. Returns array of ExchangeRate. ### Method GET ### Endpoint /getExchangeRates ### Parameters No parameters required. ### Response #### Success Response (200) - **exchange_rates** (Array of Objects) - An array of ExchangeRate objects. #### Response Example ```json { "exchange_rates": [ { "asset": "USDT", "currency": "USD", "rate": "1.00" } ] } ``` ``` -------------------------------- ### GET /getMe Source: https://help.send.tg/en/articles/10279948-crypto-pay-api Tests your app's authentication token. Requires no parameters and returns basic information about the app on success. ```APIDOC ## GET /getMe ### Description Use this method to test your app's authentication token. Requires no parameters. On success, returns basic information about an app. ### Method GET ### Endpoint /getMe ### Parameters No parameters are required for this method. ### Request Example ``` GET /getMe ``` ### Response #### Success Response (200) - **ok** (Boolean) - Indicates if the request was successful. - **result** (Object) - Contains basic information about the app if `ok` is true. - **user_id** (Number) - The unique identifier of the app. - **first_name** (String) - The name of the app. - **username** (String) - The username of the app. #### Response Example ```json { "ok": true, "result": { "user_id": 123456789, "first_name": "MyAwesomeApp", "username": "MyAwesomeAppBot" } } ``` #### Error Response (e.g., 401) - **ok** (Boolean) - Indicates if the request was successful. - **error** (Object) - Contains error details if `ok` is false. - **error_code** (String) - The error code (e.g., `PARAM_SHORT_NAME_REQUIRED`). - **description** (String) - A description of the error. ``` -------------------------------- ### GET /getBalance Source: https://help.send.tg/ru/articles/10279948-crypto-pay-api Retrieves the current balance of your application. ```APIDOC ## GET /getBalance ### Description Retrieves the current balance of your application. ### Method GET ### Endpoint /getBalance ### Parameters No parameters are required for this method. ### Response #### Success Response (200) - **ok** (Boolean) - Indicates if the request was successful. - **result** (Object) - An object containing balance information if `ok` is true. Example: `{"asset": "USDT", "balance": "1000.50"}` #### Response Example ```json { "ok": true, "result": { "asset": "USDT", "balance": "1000.50" } } ``` ``` -------------------------------- ### Authorization and Base URL Source: https://help.send.tg/ru/articles/10279948-crypto-pay-api This section explains how to authorize your application with the Crypto Pay API and provides the base URLs for both testnet and mainnet. ```APIDOC ## Authorizing your app First, you need to create a new app and get API token. Open @CryptoBot (@CryptoTestnetBot for testnet), go to **Crypto Pay** and tap **Create App** to get API Token. All queries to Crypto Pay API must be served over **HTTPS**. Use either URL query string or _application/json_ or _application/x-www-form-urlencoded_ or _multipart/form-data_ for passing parameters. API Token must be passed in the header parameter `Crypto-Pay-API-Token`. ### Testnet: Bot: @CryptoTestnetBot URL: `https://testnet-pay.crypt.bot/` ### Mainnet: Bot: @CryptoBot URL: `https://pay.crypt.bot/` ``` -------------------------------- ### GET /getBalance Source: https://help.send.tg/en/articles/10279948-crypto-pay-api Retrieves the balances of your app. Requires no parameters. ```APIDOC ## GET /getBalance ### Description Use this method to get balances of your app. Requires no parameters. Returns array of Balance. ### Method GET ### Endpoint /getBalance ### Parameters Requires no parameters. ### Response #### Success Response (200) - **balances** (Array of Object) - Array of Balance objects. #### Response Example ```json { "balances": [ { "asset": "USDT", "balance": "1000.00" } ] } ``` ``` -------------------------------- ### Crypto Pay API - Methods Source: https://help.send.tg/en/articles/10279948-crypto-pay-api Documentation for various methods available in the Crypto Pay API. ```APIDOC ## Crypto Pay API Methods ### getMe #### Description Returns basic information about the bot. #### Method GET #### Endpoint `/api/getMe` ### createInvoice #### Description Creates a new invoice for a payment. #### Method POST #### Endpoint `/api/createInvoice` #### Parameters ##### Query Parameters - **currency_type** (string) - Optional - Specifies the currency type for the invoice. - **fiat** (string) - Optional - Specifies the fiat currency for the invoice. - **accepted_assets** (string) - Optional - Comma-separated list of accepted crypto assets. #### Request Body * **user_id** (integer) - Required - The ID of the user to send the invoice to. * **amount** (string) - Required - The amount to be paid. * **asset** (string) - Required - The cryptocurrency asset to be paid. * **description** (string) - Optional - Description of the invoice. * **swap_to** (string) - Optional - Specifies the asset to swap to after payment. ### deleteInvoice #### Description Deletes an existing invoice. #### Method POST #### Endpoint `/api/deleteInvoice` #### Parameters ##### Request Body - **invoice_id** (string) - Required - The ID of the invoice to delete. ### createCheck #### Description Creates a check for a user. #### Method POST #### Endpoint `/api/createCheck` #### Parameters ##### Request Body - **asset** (string) - Required - The cryptocurrency asset for the check. - **amount** (string) - Required - The amount of the check. ### deleteCheck #### Description Deletes an existing check. #### Method POST #### Endpoint `/api/deleteCheck` #### Parameters ##### Request Body - **check_id** (string) - Required - The ID of the check to delete. ### transfer #### Description Sends coins to a user. #### Method POST #### Endpoint `/api/transfer` #### Parameters ##### Request Body - **user_id** (integer) - Required - The ID of the user to send coins to. - **amount** (string) - Required - The amount of coins to send. - **asset** (string) - Required - The cryptocurrency asset to send. ### getInvoices #### Description Returns a list of invoices. #### Method GET #### Endpoint `/api/getInvoices` #### Parameters ##### Query Parameters - **count** (integer) - Optional - The number of invoices to return. - **offset** (integer) - Optional - The offset for retrieving invoices. - **status** (string) - Optional - Filter invoices by status (e.g., 'paid', 'unpaid'). ### getChecks #### Description Returns a list of checks. #### Method GET #### Endpoint `/api/getChecks` #### Parameters ##### Query Parameters - **count** (integer) - Optional - The number of checks to return. - **offset** (integer) - Optional - The offset for retrieving checks. ### getTransfers #### Description Returns a list of transfers. #### Method GET #### Endpoint `/api/getTransfers` #### Parameters ##### Query Parameters - **count** (integer) - Optional - The number of transfers to return. - **offset** (integer) - Optional - The offset for retrieving transfers. - **spend_id** (string) - Optional - Filter transfers by spend ID. ### getBalance #### Description Returns the balance of the app. #### Method GET #### Endpoint `/api/getBalance` ### getExchangeRates #### Description Returns the current exchange rates. #### Method GET #### Endpoint `/api/getExchangeRates` ### getCurrencies #### Description Returns a list of supported currencies. #### Method GET #### Endpoint `/api/getCurrencies` ### getStats #### Description Returns statistics about the app. #### Method GET #### Endpoint `/api/getStats` ``` -------------------------------- ### GET /getExchangeRates Source: https://help.send.tg/ru/articles/10279948-crypto-pay-api Retrieves current exchange rates between supported currencies. ```APIDOC ## GET /getExchangeRates ### Description Retrieves current exchange rates between supported currencies. ### Method GET ### Endpoint /getExchangeRates ### Parameters No parameters are required for this method. ### Response #### Success Response (200) - **ok** (Boolean) - Indicates if the request was successful. - **result** (Array) - An array of exchange rate objects if `ok` is true. Example: `{"crypto_asset": "USDT", "fiat_asset": "USD", "rate": "1.00"}` #### Response Example ```json { "ok": true, "result": [ { "crypto_asset": "USDT", "fiat_asset": "USD", "rate": "1.00" }, { "crypto_asset": "BTC", "fiat_asset": "USD", "rate": "35000.00" } ] } ``` ``` -------------------------------- ### Crypto Pay API - General Information Source: https://help.send.tg/en/articles/10279948-crypto-pay-api Information on API authorization, endpoints, and general usage guidelines. ```APIDOC ## Crypto Pay API General Information ### Description Provides details on how to authorize your application with the Crypto Pay API, including obtaining an API token and the base URLs for both testnet and mainnet. ### Authorization 1. Create a new app and get an API token by interacting with @CryptoBot (or @CryptoTestnetBot for testnet). 2. All API requests must be made over HTTPS. 3. API Token must be passed in the header parameter `Crypto-Pay-API-Token`. ### Endpoints - **Mainnet:** `https://pay.crypt.bot/api/` - **Testnet:** `https://testnet-pay.crypt.bot/api/` ### Request Format Parameters can be passed via URL query string, `application/json`, `application/x-www-form-urlencoded`, or `multipart/form-data`. ### Example Request Header ``` GET /api/getMe HTTP/1.1 Host: pay.crypt.bot Crypto-Pay-API-Token: 123456789:AAzQcZWQqQAbsfgPnOLr4FHC8Doa4L7KryC ``` ``` -------------------------------- ### GET /getChecks Source: https://help.send.tg/ru/articles/10279948-crypto-pay-api Retrieves a list of checks. Supports filtering by status. ```APIDOC ## GET /getChecks ### Description Retrieves a list of checks. Supports filtering by status. ### Method GET ### Endpoint /getChecks ### Parameters #### Query Parameters - **status** (String) - Optional. Filter checks by status (e.g., "active", "used", "expired"). ### Response #### Success Response (200) - **ok** (Boolean) - Indicates if the request was successful. - **result** (Array) - An array of check objects if `ok` is true. #### Response Example ```json { "ok": true, "result": [ { "check_id": "123456", "amount": "50.00", "status": "active" }, { "check_id": "789012", "amount": "100.00", "status": "used" } ] } ``` ```