This endpoint is useful for checking the balance of a specific cryptocurrency in your Faucet Wallet. This allows you to validate a user's withdrawal amount before paying them using "Send Payment" endpoint.
GEThttps://zexpay.io/api/v1/get-balance/| Name | Required | Type | Info |
|---|---|---|---|
| crypto | Yes | String | The symbol of the cryptocurrency (e.g, BTC, ETH, USDT). |
Example<?php $api_key = 'YOUR_FAUCET_API_KEY'; $data = '?'.http_build_query(['crypto' => 'BTC']); $url = 'https://zexpay.io/api/v1/get-balance/'.$data; $ch = curl_init($url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET'); curl_setopt($ch, CURLOPT_HTTPHEADER, [ 'Content-Type: application/json', 'api-key: '.$api_key ]); curl_setopt($ch, CURLOPT_TIMEOUT, 10); $response = curl_exec($ch); $result = json_decode($response, true); var_dump($result); ?>
These example code snippets demonstrate how to request the "Get Faucet Balance" endpoint using PHP cURL. You can customize the data parameters according to your specific requirements. And below is the response you will receive:
Success Response{ "status" : 200, "error" : false, "message" : "ok", "data" : { "code" : "BTC", "name" : "Bitcoin", "balance" : 0.15000000, "sats" : 15000000 } }
Below is a list of status from this endpoint. This can be a validation material for your website:
| Status | Error | Data | Message |
|---|---|---|---|
| 200 | false | Object | The request was processed without errors. |
| 400 | true | null | Required fields is missing or Unacceptable parameter values. |
| 401 | true | null | Invalid or missing API Key. |
| 405 | true | null | Method not allowed, API Key profile restricts public access, or API Key profile has been banned. |
Error Response{ "status" : 400, "error" : true, "message" : "Unacceptable parameter values.", "data" : null }
