NAV
json python javascript go php

Before start

Welcome to the official WestWallet API documentation.

Change docs language: UA EN DE RU

Authorize to get an API-key in the profile settings.

Libraries for programming languages: Python JavaScript Golang PHP

Authorization

import json
import hashlib
import hmac
import time
import requests

# Get transaction info
api_key = "your_public_key"
secret_key = "your_private_key"
data = {"id": 435}
timestamp = int(time.time())
if data:
    dumped = json.dumps(data, ensure_ascii=False)
else:
    dumped = ""
sign = hmac.new(secret_key.encode('utf-8'),
                "{}{}".format(timestamp, dumped)
                .encode('utf-8'), hashlib.sha256).hexdigest()
headers = {
    "Content-Type": "application/json",
    "X-API-KEY": api_key,
    "X-ACCESS-SIGN": sign,
    "X-ACCESS-TIMESTAMP": str(timestamp)
}
resp = requests.post("https://api.westwallet.io/wallet/transaction", 
                     data=json.dumps(data),
                     headers=headers)
print(resp.json())                     

WestWallet API expects to receive X-API-KEY, X-ACCESS-SIGN and X-ACCESS-TIMESTAMP in the header of each of your request.

X-API-KEY - your public key;

X-ACCESS-TIMESTAMP - timestamp (use unix timestamp);

X-ACCESS-SIGN - HMAC-sha256 request body signature (composed of lines, comprising the timestamp and JSON-representation of the request body data) signed by your private key. For GET requests it should be made with JSON-dump of query parameters.

See an example how to form a string for generating signature at Python examples

Wallet

Info about currencies

GET https://api.westwallet.io/wallet/currencies_data

Request to get list of available currencies and their limits.

HTTP request

GET /wallet/currencies_data

[
  {
    "name": "Bitcoin", 
    "address_regex": "^([13][a-km-zA-HJ-NP-Z1-9]{25,34})|^(bc1([qpzry9x8gf2tvdw0s3jn54khce6mua7l]{39}|[qpzry9x8gf2tvdw0s3jn54khce6mua7l]{59}))$", 
    "require_dest_tag": false, 
    "tickers": [
      "BTC",
    ], 
    "min_receive": 0.0005, 
    "min_withdraw": 0.0001, 
    "max_withdraw_per_transaction": 5, 
    "max_withdraw_transactions_per_day": 1000000,
    "active": true,
    "send_active": true,
    "receive_active": true
  }, 
  {
    "name": "USDT TRC-20", 
    "address_regex": "^[T][a-km-zA-HJ-NP-Z1-9]{25,34}$", 
    "require_dest_tag": false, 
    "tickers": [
      "USDTTRC",
    ], 
    "min_receive": 10, 
    "min_withdraw": 1, 
    "max_withdraw_per_transaction": 100000, 
    "max_withdraw_transactions_per_day": 1000000,
    "active": true,
    "send_active": true,
    "receive_active": true
  }
]

Withdrawals

POST https://api.westwallet.io/wallet/create_withdrawal

{
  "id": 123123,
  "amount": 0.1,
  "address": "35NjwZg8T4F12ESdEo3rQeYQ8ZiTyDYoTJ",
  "dest_tag": "",
  "currency": "BTC",
  "status": "pending",
  "blockchain_hash": "72648cefcc47b4371f28dc3328bc863918913eebf81b40d4a97d577b96c1ce53",
  "fee": "0.0001",
  "error": "ok"
}
# Send 0.1 ETH to 0x57689002367b407f031f1BB5Ef2923F103015A32
from westwallet_api import WestWalletAPI
from westwallet_api.exceptions import InsufficientFundsException, BadAddressException

client = WestWalletAPI("your_public_key", "your_private_key")
try:
    sent_transaction = client.create_withdrawal(
        "ETH", "0.1", "0x57689002367b407f031f1BB5Ef2923F103015A32"
    )
except InsufficientFundsException:
    # handle this case
    pass
except BadAddressException:
    # handle also this case
    pass
else:
    print(sent_transaction.__dict__)
const westwallet = require('westwallet-api');
const westwalletErrors = require('westwallet-api/lib/errors');

const publicKey = "yourPublicKey";
const privateKey = "yourPrivateKey";

let client = new westwallet.WestWalletAPI(
    publicKey, 
    privateKey
);

client.createWithdrawal("ETH", "0.1", "0x57689002367b407f031f1BB5Ef2923F103015A32")
.then((data) => {
    console.log(data);
}).catch((error) => {
    if (error instanceof westwalletErrors.InsufficientFundsError) {
        console.log("Insufficient funds");
    } else if (error instanceof westwalletErrors.BadAddressError) {
        console.log("Bad address regex");
    } else {
        console.log(error);
    }
});
package main

import (
    "fmt"
    westwallet "github.com/westwallet/westwallet-golang-api"
)

// Sending 0.1 ETH to 0x57689002367b407f031f1BB5Ef2923F103015A32
client := westwallet.APIClient{
    Key:      "your_public_key",
    Secret:   "your_private_key",
}

transaction, err := client.CreateWithdrawal(
    "ETH", "0.1", "0x57689002367b407f031f1BB5Ef2923F103015A32", "", ""
)

fmt.Println(err)
if err != nil {
    panic(err)
}
fmt.Println(transaction)
<?php
require_once 'vendor/autoload.php';

use WestWallet\WestWallet\Client;
use WestWallet\WestWallet\InsufficientFundsException;

$client = new Client("your_public_key", "your_private_key");

// Send 0.1 ETH to 0x57689002367b407f031f1BB5Ef2923F103015A32
try {
    $tx = $client->createWithdrawal("ETH", "0.1", "0x57689002367b407f031f1BB5Ef2923F103015A32");
    print(implode("|", $tx)."\n");
} catch(InsufficientFundsException $e) {
    print("You don't have enough funds to make this withdrawal"."\n");
}

Withdraw funds from desired wallet.

HTTP request

POST /wallet/create_withdrawal

Post params

Argument Example Required Description
currency BTC yes Currency to be sent
amount 0.1 yes Amount to be sent
address 35NjwZg8T4F12ESdEo3rQeYQ8ZiTyDYoTJ да Receive address
dest_tag 1390985919 no Destination tag (required for some currencies)
description no Label for further identification in dashboard
priority medium no Transaction priority - low (24-48 hour withdraw interval, available for many currencies, reduced fees that can be discussed when contacting support), medium or high. Default value is medium.
ipn_url https://yourwebsite.com/payment_secret_token?tx_id=123321 no Instant Payment Notification URL. At this URL you will be notified as soon as transaction will be actually sent.

Sending multiple transactions

POST https://api.westwallet.io/wallet/create_withdrawal/many

# Request
{
   "currency": "BTC",
   "priority": "high",
   "transactions": [
      {
         "address": "39iUBiSKuqUtMSSEgimuEkXyrmPP2YnuB5",
         "amount": "5",
         "description": "40124"
      },
      {
         "address": "3KJFvx88XUtqUgannLDZFm7XzHXACGLuJL",
         "amount": "0.015",
         "description": "40125"
      },
      {
         "address": "35NjwZg8T4F12ESdEo3rQeYQ8ZiTyDYoTJ",
         "amount": "0.010",
         "description": "40126"
      }
   ]
}

# Response
{
   "error": "ok",
   "results": [
      {
         "address": "39iUBiSKuqUtMSSEgimuEkXyrmPP2YnuB5",
         "amount": "5.00000000",
         "description": "40124",
         "error": "insufficient_funds"
      },
      {
         "address": "3KJFvx88XUtqUgannLDZFm7XzHXACGLuJL",
         "amount": "0.01500000",
         "blockchain_hash": "72648cefcc47b4371f28dc3328bc863918913eebf81b40d4a97d577b96c1ce53",
         "currency": "BTC",
         "error": "ok",
         "fee": "0.00027500",
         "id": 611438237,
         "status": "pending",
         "description": "40125"
      },
      {
         "address": "35NjwZg8T4F12ESdEo3rQeYQ8ZiTyDYoTJ",
         "amount": "0.01000000",
         "blockchain_hash": "72648cefcc47b4371f28dc3328bc863918913eebf81b40d4a97d577b96c1ce53",
         "currency": "BTC",
         "error": "ok",
         "fee": "0",
         "id": 611438238,
         "status": "pending",
         "description": "40126"
      }
   ]
}

Send several transactions from the certain wallet. In this case, fees discounts are applied.

Second and subsequent transactions are subject to a 50% discount for the fixed fee type.

The first transaction is the transaction with the largest amount.

The method works only for currencies with the ability of bulk send: BTC, BCH, BTG, BSV, ADA, DASH, DOGE, LTC, XMR, ZEC.

HTTP request

POST /wallet/create_withdrawal/many

Post params

Argument Example Required Description
currency BTC yes Currency to be sent
priority medium no Transaction priority - low (24-48 hour withdraw interval, available for many currencies, reduced fees that can be discussed when contacting support), medium or high. Default value is medium.
transactions yes An array (list) of transaction data. The structure of the fields is given below

Post parameters of the transactions structure

Argument Example Required Description
amount 0.1 yes Amount to be sent
address 35NjwZg8T4F12ESdEo3rQeYQ8ZiTyDYoTJ да Receive address
description no Label for further identification in dashboard
ipn_url https://yourwebsite.com/payment_secret_token?tx_id=123321 no Instant Payment Notification URL. At this URL you will be notified as soon as transaction will be actually sent.

Transaction status

Possible statuses:

POST https://api.westwallet.io/wallet/transaction

{
  "id": 123123,
  "type": "send",
  "amount": 0.1,
  "address": "rw2ciyaNshpHe7bCHo4bRWq6pqqynnWKQg",
  "dest_tag": "755785168",
  "label": "your_label",
  "currency": "XRP",
  "status": "completed",
  "blockchain_confirmations": 1,
  "blockchain_hash": "BC07C0937F2B12D8DF8F90B5A421957DC690DC8512F97925217726E6A28F0A93",
  "fee": "0.0001",
  "error": "ok"
}
from westwallet_api import WestWalletAPI

client = WestWalletAPI("your_public_key", "your_private_key")
transaction = client.transaction_info(19)
print(transaction.__dict__)
const westwallet = require('westwallet-api');
const westwalletErrors = require('westwallet-api/lib/errors');

const publicKey = "yourPublicKey";
const privateKey = "yourPrivateKey";

let client = new westwallet.WestWalletAPI(
    publicKey, 
    privateKey
);

client.transactionInfo(1284).then((data) => {
    console.log(data);
}).catch((error) => {
    if (error instanceof westwalletErrors.TransactionNotFoundError) {
        console.log("Transaction not found");
    }
});
package main

import (
    "fmt"
    westwallet "github.com/westwallet/westwallet-golang-api"
)

client := westwallet.APIClient{
    Key:      "your_public_key",
    Secret:   "your_private_key",
}

transaction, err := client.TransactionInfo(145);
fmt.Println(err)
if err != nil {
    panic(err)
}
fmt.Println(transaction)
<?php
require_once 'vendor/autoload.php';

use WestWallet\WestWallet\Client;
use WestWallet\WestWallet\TransactionNotFoundException;

$client = new Client("your_public_key", "your_private_key");

try {
    $tx = $client->transactionInfo(134);
    print(implode("|", $tx)."\n");
} catch(TransactionNotFoundException $e) {
    print("Transaction not found"."\n");
}

Find out the status of the transaction.

HTTP request

POST /wallet/transaction

Post params

Arguments Examples Required Description
id 123123 id or label Transaction ID within WestWallet service
label 321321 id or label Label of address of receive transaction within WestWallet service

Transactions history

POST https://api.westwallet.io/wallet/transactions

{
  "error": "ok",
  "result": [{
    "id": 123123,
    "created_at": "2019-12-29 15:07:13",
    "updated_at": "2019-12-29 15:12:43",
    "type": "send",
    "amount": 0.1,
    "address": "rw2ciyaNshpHe7bCHo4bRWq6pqqynnWKQg",
    "dest_tag": "755785168",
    "label": "your_label",
    "currency": "XRP",
    "status": "completed",
    "description": "your custom description",
    "blockchain_confirmations": 1,
    "blockchain_hash": "BC07C0937F2B12D8DF8F90B5A421957DC690DC8512F97925217726E6A28F0A93",
    "fee": "0.0001"
  }]
}

Check transactions' history.

HTTP request

POST /wallet/transactions

Post params

Argument Example Required Description
currency BTC no Currency code. If not specified - you'll get transactions for all currencies based on other request params.
limit 10 no Limit of transactions in response (max 100).
offset 20 no Offset.
type send no Transaction type - send or receive. If it's not specify - you'll get both of them.
order desc no Date-time order - descending (desc) or ascending (asc).
status pending no Status of transactions to filter (pending or completed)

Wallet balance

GET https://api.westwallet.io/wallet/balance?currency=BTC

{
  "balance": 0.55,
  "currency": "BTC"
}
from westwallet_api import WestWalletAPI

client = WestWalletAPI("your_public_key", "your_private_key")
balance = client.wallet_balance("BTC")
print(balance.balance)
const westwallet = require('westwallet-api');
const westwalletErrors = require('westwallet-api/lib/errors');

const publicKey = "yourPublicKey";
const privateKey = "yourPrivateKey";

let client = new westwallet.WestWalletAPI(
    publicKey, 
    privateKey
);

client.walletBalance("BTC").then((data) => {
    console.log(data);
}).catch((error) => {
    if (error instanceof westwalletErrors.CurrencyNotFoundError) {
        console.log("No such currency");
    }
});
package main

import (
    "fmt"
    westwallet "github.com/westwallet/westwallet-golang-api"
)

client := westwallet.APIClient{
    Key:      "your_public_key",
    Secret:   "your_private_key",
}

balance, err := client.WalletBalance("BTC");
fmt.Println(err)
if err != nil {
    panic(err)
}
fmt.Println(balance)
<?php
require_once 'vendor/autoload.php';

use WestWallet\WestWallet\Client;
use WestWallet\WestWallet\CurrencyNotFoundException;

$client = new Client("your_public_key", "your_private_key");

try {
    $balance = $client->walletBalance("BTC");
    print(implode("|", $balance)."\n");
} catch(CurrencyNotFoundException $e) {
    print("No such currency"."\n");
}

Check wallet balance

HTTP request

GET /wallet/balance?currency=BTC

Query params

Argument Example Required Description
currency BTC yes Wallet currency

All wallet's balances

GET https://api.westwallet.io/wallet/balances

{
  "ETH": 3.22,
  "ETC": 34,
  "LTC": 40,
  "BTC": 1.11,
  "XLM": 319.11,
  "XMR": 15.12
}
from westwallet_api import WestWalletAPI

client = WestWalletAPI("your_public_key", "your_private_key")
balances = client.wallet_balances()
print(balances.__dict__)
const westwallet = require('westwallet-api');
const westwalletErrors = require('westwallet-api/lib/errors');

const publicKey = "yourPublicKey";
const privateKey = "yourPrivateKey";

let client = new westwallet.WestWalletAPI(
    publicKey, 
    privateKey
);

client.walletBalances().then((data) => {
    console.log(data);
}).catch((error) => {
    console.log(error);
});
package main

import (
    "fmt"
    westwallet "github.com/westwallet/westwallet-golang-api"
)

client := westwallet.APIClient{
    Key:      "your_public_key",
    Secret:   "your_private_key",
}

balances, err := client.WalletBalances();
fmt.Println(err)
if err != nil {
    panic(err)
}
fmt.Println(balance)
<?php
require_once 'vendor/autoload.php';

use WestWallet\WestWallet\Client;
use WestWallet\WestWallet\CurrencyNotFoundException;

$client = new Client("your_public_key", "your_private_key");

$balances = $client->walletBalances();
print(implode("|", $balances)."\n");

All wallet's balances

HTTP request

GET /wallet/balances

Addresses

Generate address

POST https://api.westwallet.io/address/generate

{
  "address": "rw2ciyaNshpHe7bCHo4bRWq6pqqynnWKQg",
  "dest_tag": "755785168",
  "currency": "XRP",
  "label": "your_label",
  "error": "ok"
}
from westwallet_api import WestWalletAPI

client = WestWalletAPI("your_public_key", "your_private_key")
address = client.generate_address("XRP", "https://yourwebsite.com/ipn_url", "your_address_label")
print(address.address, address.dest_tag)
const westwallet = require('westwallet-api');
const westwalletErrors = require('westwallet-api/lib/errors');

const publicKey = "yourPublicKey";
const privateKey = "yourPrivateKey";

let client = new westwallet.WestWalletAPI(
    publicKey, 
    privateKey
);

client.generateAddress("BTC", "https://yourwebsite.com/ipn_url", "your_address_label")
.then((data) => {
    console.log(data);
}).catch((error) => {
    if (error instanceof westwalletErrors.CurrencyNotFoundError) {
        console.log("No such currency");
    }
});

package main

import (
    "fmt"
    westwallet "github.com/westwallet/westwallet-golang-api"
)

client := westwallet.APIClient{
    Key:      "your_public_key",
    Secret:   "your_private_key",
}

address, err := client.GenerateAddress("BTC", "https://yourwebsite.com/ipn_url", "your_address_label")
if err != nil {
    panic(err)
}
fmt.Println(address.Address)
<?php
require_once 'vendor/autoload.php';

use WestWallet\WestWallet\Client;
use WestWallet\WestWallet\CurrencyNotFoundException;

$client = new Client("your_public_key", "your_private_key");

try {
    $address = $client->generateAddress("BTC");
    print(implode("|", $address)."\n");
} catch(CurrencyNotFoundException $e) {
    print("No such currency"."\n");
}

HTTP request

POST /address/generate

Post params

Arguments Example Required Description
currency BTC yes currency of address that will be generate
ipn_url https://yourwebsite.com/payment_secret_token?tx_id=123321 yes Instant Payment Notification URL. At this address you will be notified as soon as someone will send funds for this address.
label tx54543 no Select a label for the addresses for further identification (maximum 30 characters)

Payment page (invoice)

POST https://api.westwallet.io/address/create_invoice

{
  "allowed_currencies_data": [{"address": "35NjwZg8T4F12ESdEo3rQeYQ8ZiTyDYoTJ",
                               "amount": 0.00211364,
                               "currency_code": "BTC",
                               "dest_tag": ""},
                              {"address": "rn97Zbg9V6hiqJoK6EQ8RtuaLUTYHSFXyw",
                               "amount": 0.02658667,
                               "currency_code": "XRP",
                               "dest_tag": "10000324245"}],
  "expire_at": "2022-01-31 19:36:14",
  "token": "0b4ab755b42b6ff7fcb01100e42ec3",
  "url": "https://westwallet.io/payment/0b4ab755b42b6ff7fcb01100e42ec3",
  "error": "ok"
}
<?php
require_once 'vendor/autoload.php';

use WestWallet\WestWallet\Client;
use WestWallet\WestWallet\InsufficientFundsException;

$client = new Client("your_public_key", "your_private_key");
$response = $client->createInvoice(array("BTC", "USDTTRC"), "100", "https://yourwebsite.com/payment_secret_token?tx_id=123321", true, "https://yourwebsite.com/thank_you", "Payment 1234", "1234", 15);
print(implode("|", $response)."\n");

HTTP request

POST /address/create_invoice

Post params

Arguments Example Required Description
currencies ["BTC", "XRP"] yes List of allowed cryptocurrencies for payment.
amount 100 yes Requested amount of payment. If invoice has more than one currency in the currencies field, then the amount must be in USD.
amount_in_usd true no Use this field if you need to specify an amount in USD when only one currency is specified in the currencies field. This field will automatically be true if more than one currency is specified in the currencies field.
ipn_url https://yourwebsite.com/payment_secret_token?tx_id=123321 yes Instant Payment Notification URL. At this address you will be notified as soon as someone will send funds for this address.
success_url https://yourwebsite.com/thank_you no URL to redirect after successful payment
description Payment 1234 no Payment description. This is the text information that will be displayed on the payment page.
label 1234 no Select a label for the addresses for further identification (maximum 30 characters)
ttl 15 no Invoice lifetime in minutes. Maximum 15 minutes. After the expiration of this time, the payment interface (addresses, QR, etc.) will no longer be displayed on the invoice's page.

List of transactions of the payment page (invoice)

View list of incoming transactions that were received to the addresses generated for the specified payment page.

GET https://api.westwallet.io/address/invoice_transactions

{
  "count": 1,
  "error": "ok",
  "result": [{"address": "5mpjDRgoRYRmSnAXZTfB2bBkbpwvRjobXUjb4WYjF225",
             "amount": "120",
             "blockchain_confirmations": 0,
             "blockchain_hash": "5RYQvquKnuEZyH3bumRqmnvwHsjTVgqFoBWc6jxyirDzsSjtgELRccnzoQJv3zdoPmR7xS657unUQhManbrttcQd",
             "created_at": "2023-07-31 13:04:12",
             "currency": "SOL",
             "description": null,
             "dest_tag": "",
             "fee": "0",
             "id": 763,
             "label": "434532",
             "status": "pending",
             "type": "receive",
             "updated_at": null}]
}

HTTP request

GET /address/invoice_transactions?token=80f1321011b280877959f241a0e60b

Query params

Argument Example Required Description
token 80f1321011b280877959f241a0e60b yes Payment page (invoice) token

Notifications about payments

Examples of the payment notification

{
  "id": 123123,
  "amount": 0.1,
  "address": "35NjwZg8T4F12ESdEo3rQeYQ8ZiTyDYoTJ",
  "dest_tag": "",
  "label": "312321",
  "currency": "BTC",
  "status": "completed",
  "blockchain_confirmations": 1,
  "fee": "0.0001",
  "blockchain_hash": "72648cefcc47b4371f28dc3328bc863918913eebf81b40d4a97d577b96c1ce53"
}

Once you have generated the address with ipn_url and got payment at this address, you will get a POST-request on this url with such a data structure Possible statuses in response body: pending, completed.

We are making request with header Content-Type: application/x-www-form-urlencoded .

Possible errors

Every response got field "error". If it's "ok" - just pass. Else, check your error:

Errors

WestWallet API uses the error codes for all requests:

Error Code Meaning
400 Bad Request - Incorrect request fields provided, explaination in the error field.
401 Unauthorized - API key is incorrect or not specified at all.
404 Not Found - Resource is not found. Check the documentation.
405 Method Not Allowed - You are trying to make a request using prohibited HTTP method.
429 Too Many Requests - You're making too much requests
500 Internal Server Error - The problem on the side of our server. Please notify our support.

If request was successful you will receive a status 200.