### Perform an API request Source: https://help.send.tg/ru/articles/10279948-crypto-pay-api Example of a GET request to the Crypto Pay API, including the required API token header. ```http GET /api/getMe HTTP/1.1 Host: pay.crypt.bot Crypto-Pay-API-Token: 123456789:AAzQcZWQqQAbsfgPnOLr4FHC8Doa4L7KryC ``` -------------------------------- ### getMe Source: https://help.send.tg/ru/articles/10279948-crypto-pay-api Use this method to test your app's authentication token. It 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 ``` -------------------------------- ### createInvoice Source: https://help.send.tg/ru/articles/10279948-crypto-pay-api Use this method to create a new invoice. On success, it returns an object representing the created invoice. ```APIDOC ## POST createInvoice ### Description Use this method to create a new invoice. On success, returns an object of the created invoice. ### Method POST ### Endpoint /createInvoice ### Parameters #### Request Body - **currency_type** (String) - Optional - Type of the price, can be “crypto” or “fiat”. Defaults to crypto. - **asset** (String) - Optional - Required if currency_type is “crypto”. Cryptocurrency alphabetic code. - **fiat** (String) - Optional - Required if currency_type is “fiat”. Fiat currency code. - **accepted_assets** (String) - Optional - List of cryptocurrency alphabetic codes separated by comma. - **amount** (String) - Required - Amount of the invoice in float. - **swap_to** (String) - Optional - The asset that will be attempted to be swapped into after payment. - **description** (String) - Optional - Description for the invoice. - **hidden_message** (String) - Optional - Text presented to a user after the invoice is paid. - **paid_btn_name** (String) - Optional - Label of the button presented after payment. - **paid_btn_url** (String) - Optional - Required if paid_btn_name is specified. URL opened by the button. - **payload** (String) - Optional - Any data you want to attach to the invoice. - **allow_comments** (Boolean) - Optional - Allow a user to add a comment to the payment. - **allow_anonymous** (Boolean) - Optional - Allow a user to pay the invoice anonymously. - **expires_in** (Number) - Optional - Payment time limit for the invoice in seconds. ``` -------------------------------- ### createCheck Source: https://help.send.tg/ru/articles/10279948-crypto-pay-api Creates a new cryptocurrency check. ```APIDOC ## createCheck ### Description Use this method to create a new check. On success, returns an object of the created check. ### Parameters #### Request Body - **asset** (String) - Required - Cryptocurrency alphabetic code (e.g., USDT, TON, BTC). - **amount** (String) - Required - Amount of the check in float. - **pin_to_user_id** (Number) - Optional - ID of the user who will be able to activate the check. - **pin_to_username** (String) - Optional - Username of the user who will be able to activate the check. ``` -------------------------------- ### getExchangeRates Source: https://help.send.tg/ru/articles/10279948-crypto-pay-api Retrieves the current exchange rates for all supported currencies. ```APIDOC ## getExchangeRates ### Description Use this method to get exchange rates of supported currencies. Requires no parameters. Returns array of ExchangeRate. ``` -------------------------------- ### getCurrencies Source: https://help.send.tg/ru/articles/10279948-crypto-pay-api Retrieves a list of all supported fiat and cryptocurrency codes. ```APIDOC ## getCurrencies ### Description Use this method to get a list of supported currencies. Requires no parameters. Returns a list of fiat and cryptocurrency alphabetic codes. ``` -------------------------------- ### getBalance Source: https://help.send.tg/ru/articles/10279948-crypto-pay-api Retrieves the current balances of the application. ```APIDOC ## getBalance ### Description Use this method to get balances of your app. Requires no parameters. Returns array of Balance. ``` -------------------------------- ### getStats Source: https://help.send.tg/ru/articles/10279948-crypto-pay-api Retrieves application statistics within a specified date range. ```APIDOC ## getStats ### Description Use this method to get app statistics. On success, returns AppStats. ### Parameters #### Query Parameters - **start_at** (String) - Optional - Date from which start calculating statistics in ISO 8601 format. - **end_at** (String) - Optional - The date on which to finish calculating statistics in ISO 8601 format. ``` -------------------------------- ### Authentication Source: https://help.send.tg/ru/articles/10279948-crypto-pay-api All API requests must be made over HTTPS and include the API token in the 'Crypto-Pay-API-Token' header. ```APIDOC ## Authentication ### Description All queries to the Crypto Pay API must be served over HTTPS. The API token must be passed in the header parameter `Crypto-Pay-API-Token`. ### Base URLs - **Mainnet**: https://pay.crypt.bot/api/ - **Testnet**: https://testnet-pay.crypt.bot/api/ ### Request Example ```http GET /api/getMe HTTP/1.1 Host: pay.crypt.bot Crypto-Pay-API-Token: 123456789:AAzQcZWQqQAbsfgPnOLr4FHC8Doa4L7KryC ``` ``` -------------------------------- ### getInvoices Source: https://help.send.tg/ru/articles/10279948-crypto-pay-api Retrieves a list of invoices created by your application. ```APIDOC ## getInvoices ### Description Use this method to get invoices created by your app. On success, returns an array of Invoice objects. ### Parameters #### Query Parameters - **asset** (String) - Optional - Cryptocurrency alphabetic code. Supported assets: “USDT”, “TON”, “BTC”, “ETH”, “LTC”, “BNB”, “TRX”, “USDC”, “JET”. - **fiat** (String) - Optional - Fiat currency code. Supported: “USD”, “EUR”, “RUB”, “BYN”, “UAH”, “GBP”, “CNY”, “KZT”, “UZS”, “GEL”, “TRY”, “AMD”, “THB”, “INR”, “BRL”, “IDR”, “AZN”, “AED”, “PLN”, “ILS”. - **invoice_ids** (String) - Optional - List of invoice IDs separated by comma. - **status** (String) - Optional - Status of invoices to be returned. Available: “active”, “paid”. - **offset** (Number) - Optional - Offset needed to return a specific subset of invoices. Defaults to 0. - **count** (Number) - Optional - Number of invoices to be returned. Values between 1-1000. Defaults to 100. ``` -------------------------------- ### getTransfers Source: https://help.send.tg/ru/articles/10279948-crypto-pay-api Retrieves a list of transfers created by your application. ```APIDOC ## getTransfers ### Description Use this method to get transfers created by your app. On success, returns an array of Transfer objects. ### Parameters #### Query Parameters - **asset** (String) - Optional - Cryptocurrency alphabetic code. Supported assets: “USDT”, “TON”, “BTC”, “ETH”, “LTC”, “BNB”, “TRX”, “USDC”, “JET”. - **transfer_ids** (String) - Optional - List of transfer IDs separated by comma. - **spend_id** (String) - Optional - Unique UTF-8 transfer string. - **offset** (Number) - Optional - Offset needed to return a specific subset of transfers. Defaults to 0. - **count** (Number) - Optional - Number of transfers to be returned. Values between 1-1000. Defaults to 100. ``` -------------------------------- ### getChecks Source: https://help.send.tg/ru/articles/10279948-crypto-pay-api Retrieves a list of checks created by the application, with optional filtering by asset, ID, status, and pagination. ```APIDOC ## getChecks ### Description Use this method to get checks created by your app. On success, returns array of Check. ### Parameters #### Query Parameters - **asset** (String) - Optional - Cryptocurrency alphabetic code. Supported assets: “USDT”, “TON”, “BTC”, “ETH”, “LTC”, “BNB”, “TRX” and “USDC” (and “JET” for testnet). - **check_ids** (String) - Optional - List of check IDs separated by comma. - **status** (String) - Optional - Status of check to be returned. Available statuses: “active” and “activated”. - **offset** (Number) - Optional - Offset needed to return a specific subset of check. - **count** (Number) - Optional - Number of check to be returned. Values between 1-1000 are accepted. ``` -------------------------------- ### transfer Source: https://help.send.tg/ru/articles/10279948-crypto-pay-api Sends coins from your app's balance to a Telegram user. ```APIDOC ## transfer ### Description Use this method to send coins from your app's balance to a user. This method must first be enabled in the security settings of your app. ### Parameters #### Request Body - **user_id** (Number) - Required - User ID in Telegram. - **asset** (String) - Required - Cryptocurrency alphabetic code. - **amount** (String) - Required - Amount of the transfer in float. - **spend_id** (String) - Required - Random UTF-8 string unique per transfer for idempotent requests. - **comment** (String) - Optional - Comment for the transfer. - **disable_send_notification** (Boolean) - Optional - Pass true to not send to the user the notification about the transfer. ``` -------------------------------- ### Webhook Update Structure Source: https://help.send.tg/ru/articles/10279948-crypto-pay-api The structure of the JSON object sent by the Crypto Pay API to your webhook URL. ```APIDOC ## Webhook Update ### Description The JSON object sent via HTTPS POST to your configured webhook URL. ### Fields - **update_id** (Number) - Non-unique update ID. - **update_type** (String) - Webhook update type (e.g., `invoice_paid`). - **request_date** (String) - Date the request was sent in ISO 8601 format. - **payload** (Object) - Contains the Invoice data. ``` -------------------------------- ### Verify Webhook Signature in Node.js Source: https://help.send.tg/ru/articles/10279948-crypto-pay-api Use this function to validate the integrity of incoming webhook requests by comparing the provided signature against a locally generated HMAC-SHA-256 hash. ```javascript const { createHash, createHmac } = require('crypto') const checkSignature = (token, { body, headers }) => { const secret = createHash('sha256').update(token).digest() const checkString = JSON.stringify(body) const hmac = createHmac('sha256', secret).update(checkString).digest('hex') return hmac === signature['crypto-pay-api-signature'] } console.log(checkSignature('XXX:XXXXX', { body: req.body, headers: req.headers })) ``` -------------------------------- ### deleteInvoice Source: https://help.send.tg/ru/articles/10279948-crypto-pay-api Deletes an invoice created by your app. ```APIDOC ## deleteInvoice ### Description Use this method to delete invoices created by your app. Returns True on success. ### Parameters #### Request Body - **invoice_id** (Number) - Required - Invoice ID to be deleted. ``` -------------------------------- ### deleteCheck Source: https://help.send.tg/ru/articles/10279948-crypto-pay-api Deletes a check created by your app. ```APIDOC ## deleteCheck ### Description Use this method to delete checks created by your app. Returns True on success. ### Parameters #### Request Body - **check_id** (Number) - Required - Check ID to be deleted. ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.