### API Rate Limiting Headers Example Source: https://brasilbitcoin.com.br/api/docs/index This example demonstrates the headers returned by the API to indicate rate limiting status. It shows the maximum weight limit, remaining weight, used weight, and the weight of the current request. ```json { 'x-ratelimit-limit': '1500', 'x-ratelimit-remaining': '1450', 'x-ratelimit-used': '50', 'x-ratelimit-request-weight': '10' } ``` -------------------------------- ### User Wallets Response Example Source: https://brasilbitcoin.com.br/api/docs/index This is an example of a successful response from the /getUserWallets endpoint. It returns a JSON object containing a 'data' field, which includes a mapping of coin symbols to lists of wallet addresses and network details. ```json { "success": true, "data": { "BTC": [ { "address": "1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa", "coin": "BTC", "network": "bitcoin", "networkName": "Bitcoin" } ], "ETH": [ { "address": "0x742d35Cc6634C0532925a3b8D6c4D1c", "coin": "ETH", "network": "ethereum", "networkName": "Ethereum" } ] } } ``` -------------------------------- ### GET /serverTime Source: https://brasilbitcoin.com.br/api/docs/index Retrieves the current server time as a Unix timestamp (in milliseconds). This is a public endpoint. ```APIDOC ## GET /serverTime ### Description Retrieves the current server time as a Unix timestamp (in milliseconds). This is a public endpoint. ### Method GET ### Endpoint https://brasilbitcoin.com.br/api/v2/serverTime ### Parameters #### Headers - **Authentication** (string) - Required - API key obtained from Brasil Bitcoin account settings. ### Response #### Success Response (200) - **serverTime** (number) - The current server time in Unix timestamp format (milliseconds). #### Response Example ```json { "serverTime": 1731155469000 } ``` ``` -------------------------------- ### GET /getUserWallets Source: https://brasilbitcoin.com.br/api/docs/index Retrieves the user's wallet information. Requires API Key authentication. ```APIDOC ## GET /getUserWallets ### Description Retrieves the user's wallet information. This endpoint requires API Key authentication. ### Method GET ### Endpoint https://brasilbitcoin.com.br/api/v2/getUserWallets ### Parameters #### Query Parameters * **coin** (string) - Optional - The coin for which to retrieve wallet information (e.g., BTC). #### Headers * **Authentication** (string) - Required - The API key for authentication. Example: `QUxMIFlPVVIgQkFTRSBBUkUgQkVMT05HIFRPIFVT` ### Request Example ```json { "method": "GET", "url": "https://brasilbitcoin.com.br/api/v2/getUserWallets?coin=BTC", "headers": { "Authentication": "QUxMIFlPVVIgQkFTRSBBUkUgQkVMT05HIFRPIFVT" } } ``` ### Response #### Success Response (200) * **data** (object) - User wallet information. * **status** (integer) - Response status code. #### Response Example ```json { "data": { "BTC": { "balance": "0.5", "available": "0.4" }, "LTC": { "balance": "10.0", "available": "9.5" } }, "status": 200 } ``` ``` -------------------------------- ### GET /checkFiatDepositLimit Source: https://brasilbitcoin.com.br/api/docs/index Checks the user's monthly fiat deposit limit. Returns the total limit, amount used, and available limit. ```APIDOC ## GET /checkFiatDepositLimit ### Description Checks the user's monthly fiat deposit limit. Provides details on the total limit, amount used, and the remaining available limit. ### Method GET ### Endpoint /checkFiatDepositLimit ### Headers - **Authentication** (string) - Required - API Key obtained from Brasil Bitcoin account settings. ### Request Example ```json { "Authentication": "YOUR_TOKEN" } ``` ### Response #### Success Response (200) - **success** (boolean) - Indicates if the request was successful. - **totalLimit** (string) - The total monthly fiat deposit limit. - **usedLimit** (string) - The amount of the deposit limit already used. - **availableLimit** (string) - The remaining available amount for deposit. - **resetTime** (integer) - The Unix timestamp when the deposit limit resets. #### Response Example ```json { "success": true, "totalLimit": "50000.00", "usedLimit": "10000.00", "availableLimit": "40000.00", "resetTime": 1643760000 } ``` ``` -------------------------------- ### GET /getUserBalances Source: https://brasilbitcoin.com.br/api/docs/index Retrieves the user's available balances for BRL and all supported cryptocurrencies. Balances are formatted with 8 decimal places. ```APIDOC ## GET /getUserBalances ### Description Returns the user's available balances for BRL and all supported cryptocurrencies. The endpoint returns balances formatted with 8 decimal places for all supported currencies. ### Method GET ### Endpoint /getUserBalances ### Headers - **Authentication** (string) - Required - API Key collected from Brasil Bitcoin account settings ### Response #### Success Response (200) - **success** (boolean) - Indicates if the request was successful. - **data** (object) - Contains the balances for different currencies. - **[Currency]** (object) - Object containing the balance for a specific currency. - **available** (string) - The available balance for the currency, formatted with 8 decimal places. ### Request Example ```shell curl --request GET \ --url https://brasilbitcoin.com.br/api/v2/getUserBalances \ --header 'Authentication: YOUR_TOKEN' ``` ### Response Example (200) ```json { "success": true, "data": { "BRL": { "available": "1250.50000000" }, "BTC": { "available": "0.00500000" }, "ETH": { "available": "0.15000000" } } } ``` ``` -------------------------------- ### User Balances Response Structure Source: https://brasilbitcoin.com.br/api/docs/index Example JSON response when successfully retrieving user balances. It includes 'available' amounts for different currencies like BRL, BTC, and ETH. ```json { "success": true, "data": { "BRL": { "available": "1250.50000000" }, "BTC": { "available": "0.00500000" }, "ETH": { "available": "0.15000000" } } } ``` -------------------------------- ### Get User Balances with cURL Source: https://brasilbitcoin.com.br/api/docs/index Retrieves the user's available balances for BRL and all supported cryptocurrencies. The response is formatted with 8 decimal places. Requires an 'Authentication' header with a valid API key. ```shell curl --request GET \ --url https://brasilbitcoin.com.br/api/v2/getUserBalances \ --header 'Authentication: YOUR_TOKEN' ``` -------------------------------- ### GET /checkFiatWithdrawsLimit Source: https://brasilbitcoin.com.br/api/docs/index Checks the user's monthly fiat withdrawal limit. Returns the total limit, amount used, and available limit. ```APIDOC ## GET /checkFiatWithdrawsLimit ### Description Checks the user's monthly fiat withdrawal limit. Provides details on the total limit, amount used, and the remaining available limit. ### Method GET ### Endpoint /checkFiatWithdrawsLimit ### Headers - **Authentication** (string) - Required - API Key obtained from Brasil Bitcoin account settings. ### Request Example ```json { "Authentication": "YOUR_TOKEN" } ``` ### Response #### Success Response (200) - **success** (boolean) - Indicates if the request was successful. - **totalLimit** (string) - The total monthly fiat withdrawal limit. - **usedLimit** (string) - The amount of the withdrawal limit already used. - **availableLimit** (string) - The remaining available amount for withdrawal. - **resetTime** (integer) - The Unix timestamp when the withdrawal limit resets. #### Response Example ```json { "success": true, "totalLimit": "50000.00", "usedLimit": "15000.00", "availableLimit": "35000.00", "resetTime": 1643760000 } ``` ``` -------------------------------- ### Get User Wallets using cURL Source: https://brasilbitcoin.com.br/api/docs/index This snippet shows how to fetch the user's cryptocurrency wallets using the API. It requires an 'Authentication' header with the user's API key. The endpoint supports filtering by a specific coin. ```shell curl --request GET \ --url https://brasilbitcoin.com.br/api/v2/getUserWallets \ --header 'Authentication: YOUR_TOKEN' ``` -------------------------------- ### User Crypto Deposits Response Structure Source: https://brasilbitcoin.com.br/api/docs/index Example JSON response for successful retrieval of cryptocurrency deposit history. Each deposit entry includes details such as ID, amount, coin, address, hash, network, fee, status, and timestamp. ```json { "success": true, "data": [ { "id": 12345, "amount": "0.00500000", "coin": "BTC", "address": "1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa", "hash": "0x1234567890abcdef", "network": "bitcoin", "networkName": "Bitcoin", "fee": "0.00001000", "status": "credited", "timestamp": 1640995200 } ] } ``` -------------------------------- ### Get Send Crypto Status API Source: https://brasilbitcoin.com.br/api/docs/index This endpoint allows you to check the status of a cryptocurrency withdrawal transaction using its ID. ```APIDOC ## GET /getSendCryptoStatus ### Description Verifica o status de uma transação de envio de criptomoeda. ### Method GET ### Endpoint /getSendCryptoStatus ### Parameters #### Query Parameters - **id** (integer) - Required - ID da transação a ser consultada #### Headers - **Authentication** (string) - Required - Chave de API coletada nos ajustes de conta da Brasil Bitcoin ### Request Example ```curl curl --request GET \ --url 'https://brasilbitcoin.com.br/api/v2/getSendCryptoStatus?id=12345' \ --header 'Authentication: YOUR_TOKEN' ``` ### Response #### Success Response (200) - **success** (boolean) - Indicates if the request was successful. - **data** (object) - Contains the transaction details. - **id** (integer) - The transaction ID. - **coin** (string) - The cryptocurrency symbol. - **network** (string) - The network used for the transaction. - **amount** (string) - The amount of cryptocurrency sent. - **fee** (string) - The transaction fee. - **address** (string) - The recipient's address. - **status** (string) - The current status of the transaction. - **timestamp** (integer) - The Unix timestamp of the transaction. - **hash** (string) - The transaction hash. #### Response Example (200) ```json { "success": true, "data": { "id": 12345, "coin": "USDT", "network": "eth", "amount": "10.000000", "fee": "0.5000000", "address": "0x742d35Cc6634C0532925a3b8D6c4D1c", "status": "processing", "timestamp": 1640995200, "hash": "0x1234567890abcdef" } } ``` #### Error Responses - **401**: Não autorizado - Autenticação inválida - **404**: Recurso não encontrado - **429**: Transação não encontrada ``` -------------------------------- ### GET /getUserWallets Source: https://brasilbitcoin.com.br/api/docs/index Retrieves the user's wallet addresses for available cryptocurrencies. This endpoint can be filtered by a specific cryptocurrency using the `coin` query parameter. ```APIDOC ## GET /getUserWallets ### Description Retrieves the user's wallet addresses for the available cryptocurrencies. You can filter by a specific cryptocurrency using the `coin` parameter. ### Method GET ### Endpoint /getUserWallets ### Query Parameters - **coin** (string) - Optional - Filter by a specific cryptocurrency. Example: `BTC` ### Headers - **Authentication** (string) - Required - API key collected from Brasil Bitcoin account settings ### Request Example ```bash curl --request GET \ --url https://brasilbitcoin.com.br/api/v2/getUserWallets \ --header 'Authentication: YOUR_TOKEN' ``` ### Response #### Success Response (200) - **success** (boolean) - Indicates if the request was successful. - **data** (object) - Contains the wallet information. - **[coin_symbol]** (array) - An array of wallet objects for the specified coin. - **address** (string) - The wallet address. - **coin** (string) - The cryptocurrency symbol. - **network** (string) - The network name (e.g., 'bitcoin'). - **networkName** (string) - The human-readable network name (e.g., 'Bitcoin'). #### Response Example ```json { "success": true, "data": { "BTC": [ { "address": "1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa", "coin": "BTC", "network": "bitcoin", "networkName": "Bitcoin" } ], "ETH": [ { "address": "0x742d35Cc6634C0532925a3b8D6c4D1c", "coin": "ETH", "network": "ethereum", "networkName": "Ethereum" } ] } } ``` #### Error Response (401) - **success** (boolean) - Indicates if the request was successful. - **message** (string) - Error message describing the issue (e.g., 'Unauthorized'). ``` -------------------------------- ### Get User Fiat Deposits API Source: https://brasilbitcoin.com.br/api/docs/index Retrieves the history of fiat (BRL) deposits for the user, with options for filtering by date range, transaction ID, and result limit. ```APIDOC ## GET /getUserFiatDeposits ### Description Retorna o histórico de depósitos em moeda fiat (BRL) do usuário. ### Method GET ### Endpoint /getUserFiatDeposits ### Parameters #### Query Parameters - **startDate** (integer) - Optional - Data inicial do filtro de pesquisa em timestamp Unix. Exemplo: `1640995200` - **endDate** (integer) - Optional - Data final do filtro de pesquisa em timestamp Unix. Exemplo: `1672531199` - **id** (integer) - Optional - Filtrar por ID específico da transação. Exemplo: `12345` - **limit** (integer) - Optional - Limite de resultados (máximo 1000). Padrão: 100. Exemplo: `50` #### Headers - **Authentication** (string) - Required - Chave de API coletada nos ajustes de conta da Brasil Bitcoin ### Request Example ```curl curl --request GET \ --url https://brasilbitcoin.com.br/api/v2/getUserFiatDeposits \ --header 'Authentication: YOUR_TOKEN' ``` ### Response #### Success Response (200) - **success** (boolean) - Indicates if the request was successful. - **data** (array) - A list of fiat deposit objects. - **id** (integer) - The transaction ID. - **value** (string) - The deposit amount. - **coin** (string) - The currency symbol (should be 'BRL'). - **bank** (string) - The bank used for the deposit. - **status** (string) - The status of the deposit. - **timestamp** (integer) - The Unix timestamp of the deposit. #### Response Example (200) ```json { "success": true, "data": [ { "id": 12345, "value": "1000.00", "coin": "BRL", "bank": "Banco do Brasil", "status": "credited", "timestamp": 1640995200 } ] } ``` #### Error Responses - **401**: Não autorizado - Autenticação inválida - **404**: Recurso não encontrado - **429**: Limite de requisições excedido - Weight da API excedido ``` -------------------------------- ### GET /getUserCryptoDeposits Source: https://brasilbitcoin.com.br/api/docs/index Retrieves the user's cryptocurrency deposit history. Filtering is available by date range, coin, address, transaction ID, or hash. ```APIDOC ## GET /getUserCryptoDeposits ### Description Returns the user's cryptocurrency deposit history. It is possible to filter by period, cryptocurrency, address, transaction ID, or hash. ### Method GET ### Endpoint /getUserCryptoDeposits ### Query Parameters - **startDate** (integer) - Optional - Start date for the search filter in Unix timestamp. Example: `1640995200` - **endDate** (integer) - Optional - End date for the search filter in Unix timestamp. Example: `1672531199` - **coin** (string) - Optional - Filter by specific cryptocurrency. Example: `BTC` - **address** (string) - Optional - Filter by specific cryptocurrency address. Example: `1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa` - **id** (integer) - Optional - Filter by specific transaction ID. Example: `12345` - **hash** (string) - Optional - Filter by specific transaction hash. Example: `0x1234567890abcdef` - **limit** (integer) - Optional - Maximum: 1000, Default: 100. Limit of results (maximum 1000). Example: `50` ### Headers - **Authentication** (string) - Required - API Key collected from Brasil Bitcoin account settings ### Response #### Success Response (200) - **success** (boolean) - Indicates if the request was successful. - **data** (array) - An array of deposit objects. - **id** (integer) - The ID of the deposit transaction. - **amount** (string) - The amount deposited. - **coin** (string) - The cryptocurrency coin deposited. - **address** (string) - The deposit address. - **hash** (string) - The transaction hash. - **network** (string) - The network used for the deposit. - **networkName** (string) - The name of the network. - **fee** (string) - The network fee for the deposit. - **status** (string) - The status of the deposit (e.g., 'credited'). - **timestamp** (integer) - The timestamp of the deposit. ### Request Example ```shell curl --request GET \ --url 'https://brasilbitcoin.com.br/api/v2/getUserCryptoDeposits?startDate=1640995200&endDate=1672531199&coin=BTC' \ --header 'Authentication: YOUR_TOKEN' ``` ### Response Example (200) ```json { "success": true, "data": [ { "id": 12345, "amount": "0.00500000", "coin": "BTC", "address": "1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa", "hash": "0x1234567890abcdef", "network": "bitcoin", "networkName": "Bitcoin", "fee": "0.00001000", "status": "credited", "timestamp": 1640995200 } ] } ``` ``` -------------------------------- ### GET /getUserCryptoWithdraws Source: https://brasilbitcoin.com.br/api/docs/index Retrieves the user's cryptocurrency withdrawal history. It can be filtered by period, cryptocurrency, address, transaction ID, or hash. ```APIDOC ## GET /getUserCryptoWithdraws ### Description Retrieves the user's cryptocurrency withdrawal history. It can be filtered by period, cryptocurrency, address, transaction ID, or hash. ### Method GET ### Endpoint /getUserCryptoWithdraws ### Query Parameters - **startDate** (integer) - Optional - Initial date for the search filter in Unix timestamp format. - **endDate** (integer) - Optional - Final date for the search filter in Unix timestamp format. - **coin** (string) - Optional - Filter by specific cryptocurrency. - **address** (string) - Optional - Filter by specific cryptocurrency address. - **id** (integer) - Optional - Filter by specific transaction ID. - **hash** (string) - Optional - Filter by specific transaction hash. - **limit** (integer) - Optional - Maximum results to return (default: 100, max: 1000). ### Headers - **Authentication** (string) - Required - API Key collected from Brasil Bitcoin account settings. ### Request Example ```bash curl --request GET \ --url https://brasilbitcoin.com.br/api/v2/getUserCryptoWithdraws \ --header 'Authentication: YOUR_TOKEN' ``` ### Response #### Success Response (200) - **success** (boolean) - Indicates if the request was successful. - **data** (array) - An array of withdrawal objects. - **id** (integer) - Transaction ID. - **amount** (string) - Withdrawal amount. - **coin** (string) - Cryptocurrency symbol. - **address** (string) - Destination address. - **hash** (string) - Transaction hash. - **network** (string) - Blockchain network. - **networkName** (string) - Name of the blockchain network. - **fee** (string) - Transaction fee. - **status** (string) - Withdrawal status. - **timestamp** (integer) - Unix timestamp of the transaction. #### Response Example ```json { "success": true, "data": [ { "id": 12345, "amount": "0.00500000", "coin": "BTC", "address": "1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa", "hash": "0x1234567890abcdef", "network": "bitcoin", "networkName": "Bitcoin", "fee": "0.00001000", "status": "sent", "timestamp": 1640995200 } ] } ``` ``` -------------------------------- ### Get User Fiat Deposit History with cURL Source: https://brasilbitcoin.com.br/api/docs/index This snippet shows how to retrieve the history of fiat (BRL) deposits for a user using cURL. It requires an 'Authentication' header with your API key and can optionally filter by date range, transaction ID, and limit. The response contains a list of deposit records. ```Shell curl --request GET \ --url https://brasilbitcoin.com.br/api/v2/getUserFiatDeposits \ --header 'Authentication: YOUR_TOKEN' ``` -------------------------------- ### Get User Crypto Deposits with cURL Source: https://brasilbitcoin.com.br/api/docs/index Fetches the user's cryptocurrency deposit history. This endpoint supports filtering by date range, specific coin, address, transaction ID, or hash. An 'Authentication' header is required. The 'limit' parameter can control the number of results. ```shell curl --request GET \ --url https://brasilbitcoin.com.br/api/v2/getUserCryptoDeposits \ --header 'Authentication: YOUR_TOKEN' ``` -------------------------------- ### Get Server Time - cURL Source: https://brasilbitcoin.com.br/api/docs/index Retrieves the current server time as a Unix timestamp (in milliseconds). This is a public endpoint and requires authentication. The response contains the server time if successful. ```shell curl --request GET \ --url https://brasilbitcoin.com.br/api/v2/serverTime \ --header 'Authentication: YOUR_TOKEN' ``` -------------------------------- ### GET /getUserFiatWithdraws Source: https://brasilbitcoin.com.br/api/docs/index Retrieves the user's fiat (BRL) withdrawal history. Supports filtering by date range, transaction ID, and setting a limit for the number of results. ```APIDOC ## GET /getUserFiatWithdraws ### Description Returns the user's fiat (BRL) withdrawal history. Allows filtering by start date, end date, transaction ID, and setting a limit for the number of results. ### Method GET ### Endpoint /getUserFiatWithdraws ### Query Parameters - **startDate** (integer) - Optional - Initial date for the search in Unix timestamp format. Example: `1640995200` - **endDate** (integer) - Optional - End date for the search in Unix timestamp format. Example: `1672531199` - **id** (integer) - Optional - Filter by specific transaction ID. Example: `12345` - **limit** (integer) - Optional - Maximum of 1000 results, defaults to 100. Example: `50` ### Headers - **Authentication** (string) - Required - API Key obtained from Brasil Bitcoin account settings. ### Request Example ```json { "Authentication": "YOUR_TOKEN" } ``` ### Response #### Success Response (200) - **success** (boolean) - Indicates if the request was successful. - **data** (array) - An array of withdrawal objects, each containing: - **id** (integer) - Transaction ID. - **value** (string) - Withdrawal amount. - **coin** (string) - Currency type (e.g., "BRL"). - **bank** (string) - Bank name. - **pixKey** (string) - Pix key used for withdrawal. - **pixKeyType** (string) - Type of Pix key. - **withdrawFee** (string) - Fee for the withdrawal. - **status** (string) - Status of the withdrawal (e.g., "sent"). - **timestamp** (integer) - Timestamp of the withdrawal. #### Response Example ```json { "success": true, "data": [ { "id": 12345, "value": "50.00", "coin": "BRL", "bank": "Banco do Brasil", "pixKey": "guilhermeselis23@gmail.com", "pixKeyType": "0001", "withdrawFee": "2.50", "status": "sent", "timestamp": 1640995200 } ] } ``` ``` -------------------------------- ### Get User Crypto Withdrawals History Source: https://brasilbitcoin.com.br/api/docs/index Retrieves the user's cryptocurrency withdrawal history. Supports filtering by date range, cryptocurrency, address, transaction ID, or hash. Requires an API key for authentication. ```Shell curl --request GET \ --url https://brasilbitcoin.com.br/api/v2/getUserCryptoWithdraws \ --header 'Authentication: YOUR_TOKEN' ``` -------------------------------- ### Get User Fiat Withdrawals History (Shell cURL) Source: https://brasilbitcoin.com.br/api/docs/index Retrieves the user's fiat (BRL) withdrawal history. Supports filtering by date range, transaction ID, and limit. Requires an 'Authentication' header with your API key. Returns a JSON object with withdrawal details or error information. ```Shell curl --request GET \ --url https://brasilbitcoin.com.br/api/v2/getUserFiatWithdraws \ --header 'Authentication: YOUR_TOKEN' ``` -------------------------------- ### API Authentication using API Key (Legacy) Source: https://brasilbitcoin.com.br/api/docs/index Demonstrates how to authenticate API requests using a legacy API Key. This method requires adding an 'Authentication' header with the API key. Ensure the API key is active and has the necessary permissions. Whitelisting IPs is also required for this method. ```javascript const headers = { 'Authentication': 'sua_api_key_aqui', 'Content-Type': 'application/json' }; fetch('https://brasilbitcoin.com.br/api/v2/getUserBalances', { method: 'GET', headers: headers }) .then(response => response.json()) .then(data => console.log(data)); ``` -------------------------------- ### API Key Authentication (Legacy) Source: https://brasilbitcoin.com.br/api/docs/index This method uses an API Key passed in the 'Authentication' header for requests. It requires pre-registration of allowed IP addresses. ```APIDOC ## API Key Authentication (Legacy) ### Description Authenticates requests using an API Key provided in the 'Authentication' header. Requires IP whitelisting. ### Method GET, POST, PUT, DELETE (applies to all authenticated requests) ### Endpoint All API endpoints ### Parameters #### Request Headers - **Authentication** (string) - Required - Your API Key. - **Content-Type** (string) - Required - `application/json`. ### Request Example ```javascript const headers = { 'Authentication': 'sua_api_key_aqui', 'Content-Type': 'application/json' }; fetch('https://brasilbitcoin.com.br/api/v2/getUserBalances', { method: 'GET', headers: headers }) .then(response => response.json()) .then(data => console.log(data)); ``` ``` -------------------------------- ### API Authentication using Signature Source: https://brasilbitcoin.com.br/api/docs/index Explains how to authenticate API requests using a generated signature, which avoids the need to whitelist IPs. This method involves creating a signature using HMAC SHA256 with your api-secret and the request data (queryParams + body). It requires 'X-API-KEY' and 'SIGNATURE' headers. ```javascript const headers = { 'X-API-KEY': 'sua_api_key_aqui', 'SIGNATURE': 'sua_assinatura_aqui', 'Content-Type': 'application/json' }; fetch('https://brasilbitcoin.com.br/api/v2/getUserBalances', { method: 'GET', headers: headers }) .then(response => response.json()) .then(data => console.log(data)); ``` -------------------------------- ### Create Fiat Withdrawal via PIX - cURL Source: https://brasilbitcoin.com.br/api/docs/index Creates a new fiat (BRL) withdrawal via PIX. Requires an API key for authentication. The request body includes the withdrawal amount and the PIX key. The response indicates success or provides error details. ```shell curl --request POST \ --url https://brasilbitcoin.com.br/api/v2/newFiatWithdraw \ --header 'Authentication: YOUR_TOKEN' \ --header 'Content-Type: application/json' \ --data '{ \ "value": 500, \ "pixKey": "usuario@email.com" \ }' ``` -------------------------------- ### API Weight and Rate Limiting Source: https://brasilbitcoin.com.br/api/docs/index Understanding API Weight and rate limiting helps ensure your application functions correctly by staying within the defined request limits. ```APIDOC ## API Weight and Rate Limiting The Brasil Bitcoin API uses the concept of 'API Weight' to limit the number of requests that can be made within a given time period, ensuring API stability and performance. - **Public Routes Limit**: 2000 weight - **Authenticated Routes Limit**: 1500 weight - **Weight Reset Time**: 60 seconds Example Headers: ```json { "x-ratelimit-limit": "1500", "x-ratelimit-remaining": "1450", "x-ratelimit-used": "50", "x-ratelimit-request-weight": "10" } ``` It is crucial to monitor API weight usage to avoid hitting limits and ensure your applications continue to operate smoothly. ``` -------------------------------- ### POST /newFiatWithdraw Source: https://brasilbitcoin.com.br/api/docs/index Creates a new fiat withdrawal (BRL) via PIX. This endpoint allows users to initiate withdrawals to a specified PIX key. ```APIDOC ## POST /newFiatWithdraw ### Description Creates a new fiat withdrawal (BRL) via PIX. This endpoint allows users to initiate withdrawals to a specified PIX key. ### Method POST ### Endpoint https://brasilbitcoin.com.br/api/v2/newFiatWithdraw ### Parameters #### Query Parameters - **isSandbox** (boolean) - Optional - If true, the request will be tested without consuming real account data. #### Headers - **Authentication** (string) - Required - API key obtained from Brasil Bitcoin account settings. #### Request Body - **value** (number) - Required - The withdrawal amount in BRL. Example: `500` - **pixKey** (string) - Required - The PIX key for the withdrawal. Example: `usuario@email.com` ### Request Example ```json { "value": 500, "pixKey": "usuario@email.com" } ``` ### Response #### Success Response (200) - **success** (boolean) - Indicates if the operation was successful. - **id** (number) - The ID of the withdrawal transaction. - **value** (string) - The withdrawal amount. - **coin** (string) - The currency of the withdrawal (e.g., "BRL"). - **bank** (string) - The payment method (e.g., "PIX"). - **pixKey** (string) - The PIX key used for the withdrawal. - **pixKeyType** (string) - The type of the PIX key. - **withdrawFee** (string) - The fee for the withdrawal. - **status** (string) - The status of the withdrawal (e.g., "sent"). - **timestamp** (number) - The Unix timestamp of the transaction. - **userDocument** (string) - The user's document number. #### Response Example ```json { "success": true, "id": 12345, "value": "500.00", "coin": "BRL", "bank": "PIX", "pixKey": "guilhermeselis23@gmail.com", "pixKeyType": "0001", "withdrawFee": "2.50", "status": "sent", "timestamp": 1640995200, "userDocument": "526.619.078-74" } ``` ``` -------------------------------- ### POST /sendCrypto Source: https://brasilbitcoin.com.br/api/docs/index Sends cryptocurrencies to an external address. Supports test mode via a sandbox parameter. ```APIDOC ## POST /sendCrypto ### Description Sends cryptocurrencies to an external address. Supports test mode via a sandbox parameter. ### Method POST ### Endpoint /sendCrypto ### Query Parameters - **isSandbox** (boolean) - Optional - Execute in sandbox (test) mode. ### Headers - **Authentication** (string) - Required - API Key collected from Brasil Bitcoin account settings. ### Request Body - **coin** (string) - Required - Cryptocurrency to be sent. - **amount** (number) - Required - Amount to be sent. - **address** (string) - Required - Destination address. - **network** (string) - Required - Network of the cryptocurrency. ### Request Example ```bash curl --request POST \ --url https://brasilbitcoin.com.br/api/v2/sendCrypto \ --header 'Authentication: YOUR_TOKEN' \ --header 'Content-Type: application/json' \ --data '{ "coin": "USDT", "amount": 0.01, "address": "1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa", "network": "eth" }' ``` ### Response #### Success Response (200) - **success** (boolean) - Indicates if the request was successful. - **data** (object) - Contains details of the created transaction. - **id** (integer) - Transaction ID. - **coin** (string) - Cryptocurrency symbol. - **network** (string) - Blockchain network. - **amount** (string) - Sent amount. - **fee** (string) - Transaction fee. - **address** (string) - Destination address. - **status** (string) - Transaction status. - **timestamp** (integer) - Unix timestamp of the transaction. #### Response Example ```json { "success": true, "data": { "id": 12345, "coin": "USDT", "network": "eth", "amount": "10.000000", "fee": "0.5000000", "address": "0x742d35Cc6634C0532925a3b8D6c4D1c", "status": "processing", "timestamp": 1640995200 } } ``` ``` -------------------------------- ### Check Fiat Deposit Limit (Shell cURL) Source: https://brasilbitcoin.com.br/api/docs/index Checks the user's monthly fiat deposit limit. Requires an 'Authentication' header with your API key. Returns a JSON object indicating total, used, and available limits, along with the reset time. ```Shell curl --request GET \ --url https://brasilbitcoin.com.br/api/v2/checkFiatDepositLimit \ --header 'Authentication: YOUR_TOKEN' ``` -------------------------------- ### Signature-Based Authentication Source: https://brasilbitcoin.com.br/api/docs/index This method provides an alternative to IP whitelisting. Each request must be signed using HMAC SHA256 with your api-secret. ```APIDOC ## Signature-Based Authentication ### Description Authenticates requests by signing them with your api-secret using HMAC SHA256. This method does not require IP whitelisting. ### Method GET, POST, PUT, DELETE (applies to all authenticated requests) ### Endpoint All API endpoints ### Parameters #### Request Headers - **X-API-KEY** (string) - Required - Your API Key. - **SIGNATURE** (string) - Required - The generated signature for the request. - **Content-Type** (string) - Required - `application/json`. ### Request Example ```javascript const headers = { 'X-API-KEY': 'sua_api_key_aqui', 'SIGNATURE': 'sua_assinatura_aqui', 'Content-Type': 'application/json' }; fetch('https://brasilbitcoin.com.br/api/v2/getUserBalances', { method: 'GET', headers: headers }) .then(response => response.json()) .then(data => console.log(data)); ``` ### Signature Generation #### JavaScript Example ```javascript const crypto = require('crypto'); function generateSignature(secret, queryParams, body) { const message = queryParams + (body ? JSON.stringify(body) : ''); return crypto.createHmac('sha256', secret).update(message).digest('hex'); } const apiSecret = 'sua_api_secret_aqui'; const queryParams = 'coin=btc&amount=3×tamp=1633036800'; // Example const body = { parambody: '12345' }; // Example const signature = generateSignature(apiSecret, queryParams, body); console.log('Generated Signature:', signature); ``` #### Python Example ```python import hmac import hashlib def generate_signature(secret, query_params, body): message = query_params + (str(body) if body else '') return hmac.new(secret.encode(), message.encode(), hashlib.sha256).hexdigest() api_secret = 'sua_api_secret_aqui' query_params = 'coin=btc&amount=3×tamp=1633036800' # Example body = {'parambody': '12345'} # Example signature = generate_signature(api_secret, query_params, body) print('Generated Signature:', signature) ``` #### PHP Example ```php '12345']; // Example $signature = generateSignature($apiSecret, $queryParams, $body); echo 'Generated Signature: ' . $signature; ?> ``` ``` -------------------------------- ### Market Data Endpoints Source: https://brasilbitcoin.com.br/api/docs/index Endpoints that provide market data, including information about cryptocurrencies, rates, and quotes. ```APIDOC ## Market Data Endpoints ### Description Endpoints that provide market data, including information about cryptocurrencies, rates, and quotes. ### Endpoints * GET /exchangeInfo * GET /coinInformation * GET /ticker24h * GET /ticker30d * GET /bookTicker * GET /getTrades ``` -------------------------------- ### Generate Signature (Python) Source: https://brasilbitcoin.com.br/api/docs/index Offers a Python implementation for generating the HMAC SHA256 signature. The function takes the api-secret, query parameters, and request body as input to produce the signature. Ensure the timestamp is correctly included in the message. ```python import hmac import hashlib def generate_signature(secret, query_params, body): message = query_params + (str(body) if body else '') return hmac.new(secret.encode(), message.encode(), hashlib.sha256).hexdigest() api_secret = 'sua_api_secret_aqui' query_params = 'coin=btc&amount=3×tamp=1633036800' # Exemplo de queryParams body = {'parambody': '12345'} # Exemplo de body signature = generate_signature(api_secret, query_params, body) print('Generated Signature:', signature) ``` -------------------------------- ### Generate Signature (PHP) Source: https://brasilbitcoin.com.br/api/docs/index Presents a PHP function to generate the required HMAC SHA256 signature for API authentication. It concatenates query parameters and the request body to form the message, then signs it with the api-secret. The timestamp should be part of the message. ```php '12345']; // Exemplo de body $signature = generateSignature($apiSecret, $queryParams, $body); echo 'Generated Signature: ' . $signature; ?> ``` -------------------------------- ### Check Fiat Withdrawals Limit (Shell cURL) Source: https://brasilbitcoin.com.br/api/docs/index Checks the user's monthly fiat withdrawal limit. Requires an 'Authentication' header with your API key. Returns a JSON object indicating total, used, and available limits, along with the reset time. ```Shell curl --request GET \ --url https://brasilbitcoin.com.br/api/v2/checkFiatWithdrawsLimit \ --header 'Authentication: YOUR_TOKEN' ``` -------------------------------- ### Send Cryptocurrency Source: https://brasilbitcoin.com.br/api/docs/index Sends cryptocurrency to an external address. Requires the coin type, amount, destination address, network, and an API key for authentication. Supports a sandbox mode for testing. ```Shell curl --request POST \ --url https://brasilbitcoin.com.br/api/v2/sendCrypto \ --header 'Authentication: YOUR_TOKEN' \ --header 'Content-Type: application/json' \ --data '{ "coin": "USDT", "amount": 0.01, "address": "1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa", "network": "eth" }' ``` -------------------------------- ### Generate Signature (JavaScript) Source: https://brasilbitcoin.com.br/api/docs/index Provides a JavaScript function to generate the HMAC SHA256 signature required for authentication. The signature is created using the api-secret, query parameters, and request body. The timestamp should be included in either queryParams or body. ```javascript const crypto = require('crypto'); function generateSignature(secret, queryParams, body) { const message = queryParams + (body ? JSON.stringify(body) : ''); return crypto.createHmac('sha256', secret).update(message).digest('hex'); } const apiSecret = 'sua_api_secret_aqui'; const queryParams = 'coin=btc&amount=3×tamp=1633036800'; // Exemplo de queryParams const body = { parambody: '12345' }; // Exemplo de body const signature = generateSignature(apiSecret, queryParams, body); console.log('Generated Signature:', signature); ``` -------------------------------- ### Trading Endpoints Source: https://brasilbitcoin.com.br/api/docs/index Endpoints related to trading operations, including OTC quotes, order management, and market data. ```APIDOC ## Trading Endpoints ### Description Endpoints related to trading operations, including OTC quotes, order management, and market data. ### Endpoints - POST /getQuoteOTC - POST /executeQuoteOTC - GET /getUserTrades - POST /createOrder - GET /removeOrder - GET /getOrderbook - GET /getUserOrders ``` -------------------------------- ### Check Crypto Send Status with cURL Source: https://brasilbitcoin.com.br/api/docs/index This snippet demonstrates how to check the status of a cryptocurrency send transaction using cURL. It requires the transaction ID as a query parameter and an 'Authentication' header with your API key. The response includes transaction details or relevant error information. ```Shell curl --request GET \ --url 'https://brasilbitcoin.com.br/api/v2/getSendCryptoStatus?id=12345' \ --header 'Authentication: YOUR_TOKEN' ``` -------------------------------- ### Allowed IPs Source: https://brasilbitcoin.com.br/api/docs/index For security reasons, Brasil Bitcoin API access is restricted to authorized IP addresses. You can manage your allowed IPs through the user dashboard. ```APIDOC ## Allowed IPs For security purposes, Brasil Bitcoin only allows access to the API from authorized IPs. To add an IP to the list of allowed IPs, follow these steps: 1. Access the Brasil Bitcoin user dashboard. 2. Navigate to the settings section, then 'Security & API'. 3. Find the 'Allowed IPs' option. 4. Add the new IP to the list and save the changes. ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.