General Last update: 07.02.2026

All standard API requests are sent to: https://bitloga.com/api/v1/

The method for all private requests must be POST

Authorization and signature verification are sent via headers. See the Authorization section for details.

Parameters in requests and responses are passed in json format json

Authorisation

Keys

To start working with the API, you need to generate keys. This can be done in the user panel, in the "API keys" section.

You will receive an API key and a secret key. The first one you can always see in the list of your keys, while the secret key will be shown only at the moment of its generation.

Headers

The key and signature are transmitted via headers.

X-APIKEY - API key parameter

X-SIGNATURE - signature parameter

Headers example:

'Content-type': 'application/json'
'X-APIKEY': 'api_key'
'X-SIGNATURE': 'signature'

Signature

The signature for sending a request and for authenticating a callback is generated in the same way:

hex(HMAC_SHA512(jsondata), key=api_secret)

jsondata - all passed parameters in json format

api_secret - secret key

Balance

The balance request allows you to retrieve balances for all of your balances or for a specified currency.

Request

Request parameters:

Parameter Type Mandatory Description
action String Yes The value 'balances' must be passed
currency String No Balance currency code, e.g. 'USD'. If the parameter is not passed - all balances are output.

Request parameters example in json:

{
	"action":"balances",
	"currency":"USD"
}

Response

Response parameters:

Parameter Type Description
USDT Numeric Your balance in USDT
RUB Numeric Your balance in RUB
LTC Numeric Your balance in LTC
BTC Numeric Your balance in BTC
KZT Numeric Your balance in KZT
success Boolean true - request is successful, false - not successful

Response example in json:

{
	"USD":10.45,
	"success":true
}

Creating of invoice

The invoice request allows you to create an invoice and get a link to pay it. For some payment systems, the response also includes payment details for direct payment (requisites).

Request

Request parameters:

Parameter Type Mandatory Description
action String Yes The value 'invoice' must be passed in
uniqueid String Yes A unique identifier in your system. Must not be repeated.
paysys String Yes The code of the payment system to which payment will be made after payment of the invoice. Codes of available systems can be viewed in the "Payment system codes" section.
amount Numeric Yes, if pay_amount is not passed Invoice amount (amount to receive in paysys currency)
pay_amount Numeric No The amount whose equivalent you want to receive (in the payment system currency from paylist). If passed, amount (in paysys currency) is calculated automatically. The actual amount to pay will differ and is usually higher for comis='payer' due to direction fees.
purse String Yes The account to which the funds will be sent. Depending on the payment system, it can be login, account, wallet, address or card number. Not required for the internal balance of the system.
paylist String No List of payment systems from which the invoice payment is available. The separator is a comma. If not specified - no restrictions. If pay_amount is passed, paylist must contain exactly one code.
comis String No Who pays the fee. 'payer' - payer, 'payee' - you. Default is 'payer'.
dtag String No Destination Tag or Memo, if one is required.
email String No User's email
name String No Username. Mandatory for transfers to cards.
surname String No Last name of the user. Mandatory for transfers to cards.
desc String No Invoice descriptions. Will be shown to the payer.
callbackurl String No The URL to which the invoice payment notification will be sent. Please refer to the Callback section for more details.
successurl String No The URL that returns the user to after paying the invoice.
failurl String No The URL to which it returns the user if the invoice payment fails.

Request parameters example in json:

{
	"action":"invoice",
	"uniqueid":"125",
	"paysys":"WMZ",
	"amount":1.00,
	"purse":"Z123456789012",
	"paylist":"WMZ,WMR,WME",
	"comis":"payer",
	"desc":"Description"
}

Request example with pay_amount (when you need to fix the receive amount expressed in the payment currency):

{
	"action":"invoice",
	"uniqueid":"126",
	"paysys":"USDTTRC20",
	"pay_amount":1500.00,
	"purse":"TQWv7b8JmYV8m7...",
	"paylist":"SBP_RUB",
	"comis":"payer",
	"desc":"Description"
}

Response

Response parameters:

Parameter Type Description
invoice String URL for invoice payment
requisites Array Payment details. May be missing if payment is only possible via URL.
requisites.amount Numeric Payment amount
requisites.currency String Payment currency
requisites.type String Payment type. Possible values: card - payment to card, phone - payment by phone number (SBP), account - bank account number, qr - QR for payment, crypto - crypto address
requisites.wallet String Card number, phone number, account number, QR or address for payment
requisites.payment_url String Payment page/QR URL (relevant for qr-type methods, e.g. nspk). May be missing.
requisites.info String Additional information: bank, card owner, etc.
requisites.country String Country (if provided by payment system)
success Boolean true - request is successful, false - not successful

Response example in json:

{
	"invoice":"https://bitloga.com/exchange/id-487142ef9e5e2f2cbc9c1dca214f44/step-4",
	"requisites":{
		"amount":2438,
		"currency":"RUB",
		"type":"phone",
		"wallet":"790888899999",
		"info":"Bank: any bank. Recipient: Guora G.",
		"country":"Tajikistan"
	},
	"success":true
}

Callback

Once the invoice is paid, if the 'callbackurl' parameter was specified when the invoice was created, a notification request will be sent to that url.

If the request does not receive a success code (200) in response, it will be repeated, with increasing pauses, up to 10 times.

The request sends all invoice data in json format using POST method.

The request signature is encrypted and sent in the same way as for incoming requests - in the 'X-SIGNATURE' headers parameter.

Callback parameters:

Parameter Type Description
to String The payment system to which the funds were transferred.
amount Numeric Invoice Amount.
purse String The account to which the funds are sent.
type String Transaction Type. Invoice - billed invoice.
status String Transaction Status. Payed - the invoice has been paid.
dtag String Destination Tag or Memo. Passed only if specified when creating the invoice.
name String User name. Passed only if it was specified when creating the invoice.
surname String Last name of the user. Passed only if it was specified when creating the invoice.
invoiceid Numeric Numeric identifier of the invoice. Corresponds to the identifiers in the list of invoices in the user panel.
uniqueid String A unique identifier in your system.

Example of callback parameters:

{
	"to":"WMZ",
	"amount":1.00,
	"purse":"Z123456789012",
	"type":"Invoice",
	"status":"Payed",
	"invoiceid":5,
	"uniqueid":"125"
}

Withdraw

A payout request allows you to create a transaction to withdraw funds from the balance to the specified details.

The specified payment amount will be sent to the specified details. The amount of debit from the balance may vary, depending on the exchange rate and commission of the direction.

Request

Request parameters:

Parameter Type Mandatory Description
action String Yes The value 'withdraw' must be passed
uniqueid String Yes A unique identifier in your system. Must not be repeated.
currency String Yes The currency code of the balance currency from which the payment is made. For example, 'USD'.
paysys String Yes The code of the payment system to which the payment will be made. Codes of available systems can be viewed in the section "Codes of payment systems".
amount Numeric Yes Amount of payment in the currency of the payment system transferred to 'paysys'
purse String Yes The account to which the funds will be sent. Depending on the payment system, this can be a login, account, wallet, address or card number.
dtag String No Destination Tag or Memo if one is required.
name String No First name of the user. Mandatory for transfers to cards.
surname String No Last name of the user. Mandatory for transfers to cards.

Request parameters example in json:

{
	"action":"withdraw",
	"uniqueid":"135",
	"currency":"USD",
	"paysys":"WMZ",
	"amount":10.00,
	"purse":"Z123456789012"
}

Response

Response parameters:

Parameter Type Description
from String The currency from which the payment was made.
to String The payment system to which the payment was made.
amount_from Numeric The amount of payment in the balance currency, excluding the service commission.
amount_from_comis Numeric The amount of payment in the balance currency, taking into account the service commission. This amount was debited from the balance.
amount_to Numeric The amount of the payout sent to the specified account.
purse String The account to which the funds are sent.
status String Payment status. 'Complete' - completed.
dtag String Destination Tag or Memo.
name String User's first name.
surname String User's last name.
orderid String Internal transaction identifier. Corresponds to the identifiers in the list of transactions in the user panel.
transid String The unique identifier of the transaction in our system.
uniqueid String A unique identifier in your system.
success Boolean true - request is successful, false - not successful

Response example in json:

{
	"from":"USD",
	"to":"WMZ",
	"amount_from":10.10,
	"amount_from_comis":10.10,
	"amount_to":10.00,
	"purse":"Z123456789012",
	"status":"Complete",
	"orderid":29,
	"transid":"436fd74c6ec5d1bde1b7969190f81e50",
	"uniqueid":"135",
	"success":true
}

Transaction details

A transaction detail request allows you to retrieve all information about a withdraw or invoice by unique identifier.

Request

Request parameters:

Parameter Type Mandatory Description
action String Yes The value 'details' must be passed.
uniqueid String Yes A unique identifier in your system.

Request parameters example in json:

{
	"action":"details",
	"uniqueid":"135"
}

Response

Response parameters:

Parameter Type Description
from String Currency from which the payment was made. Only for type='Withdraw'.
to String The payment system to which the funds were transferred.
amount Numeric Invoice Amount. Only for type='Invoice'.
amount_from Numeric The amount of payment in the currency of the balance, without taking into account the service commission. Only for type='Withdraw'.
amount_from_comis Numeric The amount of payment in the balance currency, taking into account the service commission. This amount was debited from the balance. Only for type='Withdraw'.
amount_to Numeric The amount of payment sent to the specified account. Only for type='Withdraw'.
purse String The account to which the funds are sent.
type String Transaction Type. Withdraw or Invoice.
status String Transaction Status. Payed, Created, Pending, Complete, Canceled, Error.
dtag String Destination Tag or Memo.
name String User's first name.
surname String User's last name.
invoiceid String Internal identifier of the invoice. Corresponds to the identifiers in the invoice list in the user panel. Only for type='Invoice'.
orderid String Internal transaction identifier. Corresponds to the identifiers in the list of transactions in the user panel. Only for type='Withdraw'.
transid String Unique transaction identifier in our system. Only for type='Withdraw'.
uniqueid String A unique identifier in your system.
success Boolean true - request is successful, false - not successful

Response example in json:

{
	"from":"USD",
	"to":"WMZ",
	"amount_from":10.10,
	"amount_from_comis":10.10,
	"amount_to":10.00,
	"purse":"Z123456789012",
	"type":"Withdraw",
	"status":"Complete",
	"orderid":29,
	"transid":"436fd74c6ec5d1bde1b7969190f81e50",
	"uniqueid":"135",
	"success":true
}
{
	"to":"WMZ",
	"amount":1.00,
	"purse":"Z123456789012",
	"type":"Invoice",
	"status":"Payed",
	"invoiceid":5,
	"uniqueid":"125",
	"success":true
}

Codes

Code operations: creating, activating and getting a list of your codes.

Requests to the API for code handling are sent to: https://bitloga.com/api/v1/code/

Creation

Request to create a code for a specified amount in a specified currency. Password and description are optional. Funds from your balance in the corresponding currency are used to create the code.

Request

Request parameters:

Parameter Type Mandatory Description
action String Yes The value 'create' must be passed.
amount Numeric Yes Code amount.
currency String Yes Code currency, e.g. 'USD'.
pass String No Code Password. If specified - required to activate the code.
desc String No Code Description

Request parameters example in json:

{
	"action":"create",
	"amount":1.00,
	"currency":"USD",
	"pass":"mypassword",
	"desc":"Code description"
}

Response

Response parameters:

Parameter Type Description
code String Created code
success Boolean true - request is successful, false - not successful

Response example in json:

{
	"code":"wf9g-amrf-2o9t-831u",
	"success":true
}

Activation

Request for code activation. If a password was specified during creation - it is mandatory for successful activation. Funds from the code will be credited to your balance in the appropriate currency.

Request

Request parameters:

Parameter Type Mandatory Description
action String Yes The value 'apply' must be passed.
code String Yes Code value
pass String No Code Password. Required if it was specified at creation.

Request parameters example in json:

{
	"action":"apply",
	"code":"wf9g-amrf-2o9t-831u",
	"pass":"mypassword"
}

Response

Response parameters:

Parameter Type Description
amount Numeric Code amount
currency String Code currency
success Boolean true - request is successful, false - not successful

Response example in json:

{
	"amount":1.00,
	"currency":"USD",
	"success":true
}

Get list

Request to receive a list of your codes. Maximum number of codes received in one request: 100. Sorting of codes - date of creation in descending order (from new to old).

Request

Request parameters:

Parameter Type Mandatory Description
action String Yes The value 'get' must be passed.
code String No Code. Use to get details on a specific code.
amount Numeric No Code Amount. Use to retrieve all codes for the specified amount.
currency String No Code Currency. Use to retrieve all codes in the specified currency.
status String No Code Status. Possible values: 'Active', 'Redeemed', 'Disabled'.
offset Numeric No Number of skipped codes from the beginning of the list.
limit Numeric No Limit on the number of codes that can be issued. Maximum 100.

Request parameters example in json:

{
	"action":"get",
	"status":"Active",
	"limit":10
}

Response

Response parameters:

Parameter Type Description
data Array Array of codes
code String Code
amount Numeric Code amount
currency String Code currency
pass String If a password is required for activation - set to 'Required'.
desc String Code Description
status String Code Status. Possible values: 'Active', 'Redeemed', 'Disabled'.
createtime String Date and time of code creation.
applytime String Date and time of code activation, if activated.
success Boolean true - request is successful, false - not successful

Response example in json:

{
	"data":[{
		"code":"wf9g-amrf-2o9t-831u",
		"amount":1.00,
		"currency":"USD",
		"pass":"Required",
		"desc":"Code description",
		"status":"Active",
		"createtime":"2022-07-11 15:27"
	}],
	"success":true
}

Ticker

The request for exchange rates is public and does not require authorization.

Not all destinations in the course list may be available for use through the API.

The full list is available at: https://bitloga.com/api/v1/ticker

Payment system codes

Some requests use the 'paysys' parameter, which should contain a short code for the payment system.

List of payment system codes and available operations for them:

Code Payment system Available operations
BTC Bitcoin BTC invoice
LTC Litecoin LTC invoice
USDTTRC20 TRC20 USDT invoice
USDTERC20 ERC20 USDT invoice
RUBBALANCE Wallet RUB invoice
USDTBALANCE Wallet USDT invoice, withdraw

Errors

When errors occur in requests to the API, the response may differ from the standard response.

All errors have the same format, json code with two parameters:

{
    "message": "Error",
    "success": false
}

message - error message

success: false - indicates an unsuccessful request

List of errors

Error text Description
Service unavailable The service is closed for maintenance
API is disabled API is disabled
Codes API is disabled Codes API is disabled
Bad data Passed data is incorrect
API key not found API key not passed
API key is not active The passed API key is not active
API access denied You do not have access to the API
Signature not found Request signature not passed
Signature is not correct An invalid request signature was passed
Undefined action Not passed or passed incorrect 'action' parameter
User balances not found User balances not found (action: balances)
Currency is not defined The 'currency' parameter is not passed
Currency not found The passed currency of balances was not found (action: balances)
Invoice API is disabled Invoice API is disabled
Paysystem is not defined The parameter 'paysys' was not passed
Paysystem is not supported The payment system passed in the 'paysys' parameter is not supported by the API
Amount is not defined The 'amount' parameter is not passed
Pay amount is not defined The 'pay_amount' parameter is missing or invalid
Paylist is not defined The 'paylist' parameter is missing when using 'pay_amount'
For pay_amount, paylist must contain exactly one paysystem When using 'pay_amount', 'paylist' must contain exactly one payment system code
Unable to calculate invoice amount by pay_amount Failed to calculate invoice amount by 'pay_amount' for the selected direction
For this currency min amount is *n* Transaction amount is below the minimum allowable amount (*n* - current minimum amount)
For this currency max amount is *n* Transaction amount is higher than the maximum allowable amount (*n* - current maximum amount)
Unique ID is not defined Parameter 'uniqueid' not passed
Received Unique ID has already been used The passed unique identifier has already been used before
Purse is not defined The 'purse' parameter was not passed
Purse has wrong format The 'purse' parameter has the wrong format
Card is not verified The passed card number is not verified
Tag/Memo is not defined The 'dtag' parameter is not passed, but is mandatory for the specified currency
Name is not defined The 'name' parameter is not passed, but is mandatory for the specified currency
Surname is not defined The 'surname' parameter is not passed, but is mandatory for the specified currency
Balance is disabled User balance is disabled, work via API is impossible
Currency is not supported The passed balance currency is not supported (action: withdraw)
Dirrection disabled The selected operation direction is deactivated (action: withdraw)
Insufficient reserve The service does not have enough reserve for this operation (action: withdraw)
Insufficient balance You have insufficient balance for this operation (action: withdraw, code create)
Payment error: *error* Withdrawal error. *error* - error text (action: withdraw)
Transaction is not found Transaction not found (action: details)
Code is not defined The 'code' parameter is not passed (action: code apply)
Code is not exist The specified code does not exist (action: code apply)
Code is not active The specified code is not active (action: code apply)
Password is not defined The 'pass' parameter is not passed (action: code apply)
Wrong Password Incorrect code password is specified (action: code apply)
Codes not found Codes with the specified parameters were not found (action: code get)

Samples

Click on the language to open the example

class API {
	var $url = 'https://bitloga.com/api/v1/';
	var $apiKey;
	var $apiSecret;

	function __construct($apiKey, $apiSecret) {
		$this->apiKey = $apiKey;
		$this->apiSecret = $apiSecret;
	}

	function API($apiKey, $apiSecret) {
		$this->__construct($apiKey, $apiSecret);
	}

	function SendRequest($params, $addtourl = '') {
		$dataJson = json_encode($params, JSON_UNESCAPED_SLASHES);
		$signature = hash_hmac('sha512', $dataJson, $this->apiSecret);
		if($addtourl) $addtourl .= '/';
		$ch = curl_init($this->url.$addtourl);
		$headers = [
			'Content-type: application/json',
			'X-APIKEY:'.$this->apiKey,
			'X-SIGNATURE:'.$signature
		];
		curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
		curl_setopt($ch, CURLOPT_POST, true);
		if($dataJson) curl_setopt($ch, CURLOPT_POSTFIELDS, $dataJson);
		curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
		curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0);
		curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
		$res = curl_exec($ch);
		curl_close($ch);   
		return json_decode($res, true);
	}

	function balances($currency='') {
		$params = array();
		$params['action'] = 'balances';
		if($currency) $params['currency'] = $currency;
		return $this->SendRequest($params);
	}

	function invoice($uniqueid, $paysys, $amount, $purse='', $paylist='', $comis='', $dtag='', $name='', $surname='', $desc='', $callback='', $success='', $fail='') {
		$params = array();
		$params['action'] = 'invoice';
		$params['uniqueid'] = $uniqueid;
		$params['paysys'] = $paysys;
		$params['amount'] = $amount;
		if($purse) $params['purse'] = $purse;
		if($paylist) $params['paylist'] = $paylist;
		if($comis) $params['comis'] = $comis;
		if($dtag) $params['dtag'] = $dtag;
		if($name) $params['name'] = $name;
		if($surname) $params['surname'] = $surname;
		if($desc) $params['desc'] = $desc;
		if($callback) $params['callbackurl'] = $callback;
		if($success) $params['successurl'] = $success;
		if($fail) $params['failurl'] = $fail;
		return $this->SendRequest($params);
	}

	function withdraw($uniqueid, $currency, $paysys, $amount, $purse, $dtag='', $name='', $surname='') {
		$params = array();
		$params['action'] = 'withdraw';
		$params['uniqueid'] = $uniqueid;
		$params['currency'] = $currency;
		$params['paysys'] = $paysys;
		$params['amount'] = $amount;
		$params['purse'] = $purse;
		if($dtag) $params['dtag'] = $dtag;
		if($name) $params['name'] = $name;
		if($surname) $params['surname'] = $surname;
		return $this->SendRequest($params);
	}

	function details($uniqueid) {
		$params = array();
		$params['action'] = 'details';
		$params['uniqueid'] = $uniqueid;
		return $this->SendRequest($params);
	}
	
	function createCode($amount, $currency, $pass='', $desc='') {
		$params = array();
		$params['action'] = 'create';
		$params['amount'] = $amount;
		$params['currency'] = $currency;
		if($pass) $params['pass'] = $pass;
		if($desc) $params['desc'] = $desc;
		return $this->SendRequest($params, 'code');
	}
	
	function getCode($code='', $amount='', $currency='', $status='', $offset='', $limit='') {
		$params = array();
		$params['action'] = 'get';
		if($code) $params['code'] = $code;
		if($amount) $params['amount'] = $amount;
		if($currency) $params['currency'] = $currency;
		if($status) $params['status'] = $status;
		if($offset) $params['offset'] = $offset;
		if($limit) $params['limit'] = $limit;
		return $this->SendRequest($params, 'code');
	}
	
	function applyCode($code, $pass='') {
		$params = array();
		$params['action'] = 'apply';
		$params['code'] = $code;
		if($pass) $params['pass'] = $pass;
		return $this->SendRequest($params, 'code');
	}
	
}

$apiKey = 'your api key'; // Enter your API key
$apiSecret = 'your secret key'; // Enter your Secret Key

$api = new API($apiKey, $apiSecret);

// Receiving balances
$responce = $api->balances('USD');
var_dump($responce);

// Creating an invoice
$responce = $api->invoice('125', 'WMZ', 1.00, 'Z123456789012');
var_dump($responce);

// Withdraw
$responce = $api->withdraw('135', 'USD', 'WMZ', 10.00, 'Z123456789012');
var_dump($responce);

// Transaction details
$responce = $api->details('125');
var_dump($responce);

// Code creation
$responce = $api->create(1.00, 'USD', 'mypassword', 'Описание кода');
var_dump($responce);

// Receiving codes
$responce = $api->get();
var_dump($responce);

// Code activation
$responce = $api->apply('wf9g-amrf-2o9t-831u', 'mypassword');
var_dump($responce);
Raw

$apiKey = 'your api key'; // Enter your API key
$apiSecret = 'your secret key'; // Enter your Secret Key

// Parameters preparation
// In this example we get the balance of the USD account
$params = array();
$params['action'] = 'balances';
$params['currency'] = 'USD';

$dataJson = json_encode($params, JSON_UNESCAPED_SLASHES);
$signature = hash_hmac('sha512', $dataJson, $apiSecret);

// Headers preparation
$headers = [
	'Content-type: application/json',
	'X-APIKEY:'.$apiKey,
	'X-SIGNATURE:'.$signature
];

// Sending request
$ch = curl_init('https://bitloga.com/api/v1/');
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $dataJson);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
$res = curl_exec($ch);
curl_close($ch);   

// Response processing
$arrayRes = json_decode($res);
var_dump($arrayRes);
Raw

$apiSecret = 'your secret key'; // Enter your Secret Key

$rawjson = file_get_contents('php://input'); // Receive JSON data, it contains all information about the transaction
$headers = getallheaders(); // Receive headers, they contain a signature.

// Form a signature with your key and verify it
$sign = hash_hmac('sha512', $rawjson, $apiSecret);
if(!hash_equals($sign, $headers['X-SIGNATURE'])) exit('Signature Error');

// Transferring data to an array
$data = json_decode($rawjson, true);
var_dump($data);
Raw

let crypto = require('crypto');
let https = require('https');

let apiKey = ''; // Enter your API key
let apiSecret = ''; // Enter your Secret Key

// Parameters preparation
// In this example we get the balance of the USD account
let data = {
	action: "balances",
	currency: "USD"
}

let dataJsonStr = JSON.stringify(data);
let hash = crypto.createHmac('sha512', apiSecret);
let signature = hash.update(dataJsonStr).digest('hex');

let options = {
	hostname: 'https://bitloga.com',
	path: '/api/v1/',
	method: 'POST',
	headers: {
		'Content-Type': 'application/json',
		'X-APIKEY': apiKey,
		'X-SIGNATURE': signature
	}
}

const req = https.request(options, res => {
	res.setEncoding('utf8')

	console.log(`statusCode: ${res.statusCode}`)

	let responseBody = '';

	res.on('data', chunk => {
		responseBody += chunk;
	});

	res.on('end', () => {
		if (res.statusCode !== 200) {
			console.error("Api call failed with response code", res.statusCode);
		}

		console.log('Body:', responseBody);
	});
})

req.on('error', error => {
	console.error("Request error", error);
})

req.write(dataJsonStr);

req.end();
Raw

import json
import base64
import requests
import hmac
import hashlib

api_key = '' #Enter your API key
secret_key = '' #Enter your Secret Key

#Parameters preparation
#In this example we get the balance of the USD account
data = {
	'action': 'balances',
	'currency': USD
}

data_json = json.dumps(data, separators=(',', ':'))
signature = hmac.new(secret_key.encode('ascii'), data_json.encode('ascii'), hashlib.sha512).hexdigest()

#Headers preparation
headers = {
	'Content-type': 'application/json',
	'X-APIKEY': api_key,
	'X-SIGNATURE': signature,
}

#Sending request
resp = requests.post('https://bitloga.com/api/v1/', headers=headers, data=data_json)

#Response processing
print(json.dumps(resp.json(), sort_keys=True, indent=4))
Raw

import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
import java.util.Base64;
import java.util.Formatter;

public class TradeAccountBalanceJava {
	private static final String API_KEY = ""; // Enter your API key
	private static final String API_SECRET = ""; // Enter your Secret Key

	public static void main(String[] args) throws Exception {

		// Parameters preparation
		// In this example we get the balance of the USD account
		String dataJson = String.format("{\"action\":\"%1$s\",\"currency\":\"%2$s\"}",
			"balances",
			"USD"

		String signature = calcSignature(dataJson.getBytes());

		HttpClient client = HttpClient.newHttpClient();
		HttpRequest request = HttpRequest.newBuilder()
			.uri(URI.create("https://bitloga.com/api/v1/"))
			.header("Content-type", "application/json")
			.header("X-APIKEY", API_KEY)
			.header("X-SIGNATURE", signature)
			.POST(HttpRequest.BodyPublishers.ofString(dataJson))
			.build();

		HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString());
		System.out.println(response.body());
	}

	private static String calcSignature(String data)
	throws NoSuchAlgorithmException, InvalidKeyException {

		final String HMAC_SHA512 = "HmacSHA512";
		SecretKeySpec secretKeySpec = new SecretKeySpec(API_SECRET.getBytes(), HMAC_SHA512);
		Mac mac = Mac.getInstance(HMAC_SHA512);
		mac.init(secretKeySpec);

		byte[] bytes = mac.doFinal(data.getBytes());
		Formatter formatter = new Formatter();
		for (byte b : bytes) {
			formatter.format("%02x", b);
		}

		return formatter.toString();
	}
}
Raw

using Newtonsoft.Json;
using System;
using System.Net.Http;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;

namespace TradeAccountBalance
{
	internal class Payload
	{
		[JsonProperty("action")]
		public string Action { get; set; }

		[JsonProperty("currency")]
		public string Currency { get; set; }
	}

	internal static class Program
	{
		private static readonly HttpClient _httpClient = new HttpClient();

		private static async Task Main()
		{
			var apiKey = ""; // Enter your API key
			var apiSecret = ""; // Enter your Secret Key

			// Parameters preparation
			// In this example we get the balance of the USD account
			var data = new Payload
			{
				Action = "balances",
				Currency = "USD"
			};

			var dataJsonStr = JsonConvert.SerializeObject(data);
			var signature = CalcSignature(dataJsonStr, apiSecret);

			var content = new StringContent(dataJsonStr, Encoding.UTF8, "application/json");
			var requestMessage = new HttpRequestMessage(HttpMethod.Post, $"https://bitloga.com/api/v1/")
			{
				Content = content
			};
			requestMessage.Headers.Add("X-TXC-APIKEY", apiKey);
			requestMessage.Headers.Add("X-TXC-SIGNATURE", signature);

			var response = await _httpClient.SendAsync(requestMessage);
			var responseBody = await response.Content.ReadAsStringAsync();

			Console.WriteLine(responseBody);
		}

		public static string CalcSignature(string text, string apiSecret)
		{
			using (var hmac = new HMACSHA512(Encoding.UTF8.GetBytes(apiSecret)))
			{
				var hash = hmac.ComputeHash(Encoding.UTF8.GetBytes(text));
				return BitConverter.ToString(hash).Replace("-", string.Empty).ToLower();
			}
		}
	}
}
Raw

package main

import (
	"bytes"
	"crypto/hmac"
	"crypto/sha512"
	"encoding/json"
	"fmt"
	"io/ioutil"
	"log"
	"net/http"
	"strconv"
)

type apiHelper struct {
	PublicKey string
	SecretKey string
}

func (api *apiHelper) SendRequest(data map[string]string) (responseBody []byte, err error) {

	requestBody, err := json.Marshal(data)
	if err != nil {
		return
	}

	h := hmac.New(sha512.New, []byte(api.SecretKey))
	h.Write([]byte(requestBody))
	signature := fmt.Sprintf("%x", h.Sum(nil))

	client := http.Client{}

	request, err := http.NewRequest("POST", "https://bitloga.com/api/v1/", bytes.NewBuffer(requestBody))
	if err != nil {
		log.Fatal(err)
	}

	// Headers preparation
	request.Header.Set("Content-type", "application/json")
	request.Header.Set("X-APIKEY", api.PublicKey)
	request.Header.Set("X-SIGNATURE", signature)

	// Sending request
	response, err := client.Do(request)
	if err != nil {
		return
	}
	defer response.Body.Close()

	// Response processing
	responseBody, err = ioutil.ReadAll(response.Body)

	return
}

func main() {
	provider := apiHelper{
		PublicKey: "", // Enter your API key
		SecretKey: "", // Enter your Secret Key
	}

	// Parameters preparation
	// In this example we get the balance of the USD account
	data := map[string]string{
		"action": "balances",
		"currency": "USD",
	}

	resultData, err := provider.SendRequest(data)
	if err != nil {
		log.Fatal(err)
	}

	var result interface{}
	if err := json.Unmarshal(resultData, &result); err != nil {
		log.Fatal(err)
	}

	log.Println(result)
}
Raw

require 'json'
require 'openssl'
require 'net/http'

api_key = '' #Enter your API key
api_secret = '' #Enter your Secret Key

#Parameters preparation
#In this example we get the balance of the USD account
data = {
	'action': 'balances',
	'currency': 'USD'
}

data_json_str = data.to_json
signature = OpenSSL::HMAC.hexdigest('SHA512', api_secret, data_json_str)

#Headers preparation
header = {
	'Content-Type': 'application/json',
	'X-APIKEY': api_key,
	'X-SIGNATURE': signature
}

#Sending request
uri = URI.parse('https://bitloga.com/api/v1/')
request_data = Net::HTTP::Post.new(uri.request_uri, header)
request_data.body = data_json_str
response = Net::HTTP.start(uri.host, uri.port, use_ssl: true) { |http| http.request(request_data) }

#Response processing
puts response.code
puts response.message
puts response.body
Raw

Updates

07.02.2026

The 'invoice' method response can include the 'requisites' object (payment details for direct payment). The requisites.type field can be: card, phone, account, qr, crypto. For qr methods, requisites.payment_url can also be returned.

15.08.2022

The 'paylist' parameter has been added to the 'invoice' method, allowing you to specify the payment systems available for invoice payment.

Added methods for working with codes: code creation (create), code activation (apply) and code details (get).