TABLE OF CONTENTS


The Transfers API allows for the automation of deposits and withdrawals to your account.


Endpoint


The Transfers API is a REST API. All its methods are accessible by the following endpoint:

https://api.xena.exchange/transfers/...


Authentication


Authentication for the Transfers API requires the same information as the Trading API. Instead of sending some initial message like Logon, each call to the REST Transfers API must contain 4 HTTP headers:

X-AUTH-API-KEY

X-AUTH-API-PAYLOAD

X-AUTH-API-SIGNATURE

X-AUTH-API-NONCE

Nonce (UNIX nanoseconds timestamp) must be unique for each request and no older than 60 seconds.

Learn how to get keys for API.


Requesting an account list


The method returns an array of accounts to which the API Key has access with the scope “transfers.”


GET /accounts
Generic



Response:

[10832434,10834231]
Generic



Retrieving deposit address


GET /accounts/{accountId}/deposit-address/{currency}

Generic



Response:


{
  "address":"mu5GceHFAG38mGRYCFqafe5ZiNKLX3rKk9",
  "uri":"bitcoin:mu5GceHFAG38mGRYCFqafe5ZiNKLX3rKk9?message=Xena Exchange",
  “allowsRenewal”: true
}
Generic



The method returns HTTP status code 404 (Not Found) if there is no active address for the requested account and currency.

“allowsRenewal” indicates whether the address may be renewed by the client or whether it is permanent.


Obtaining and renewing deposit addresses


POST /accounts/{accountId}/deposit-address/{currency}
Generic



Response:

{
  "address":"mu5GceHFAG38mGRYCFqafe5ZiNKLX3rKk9",
  "uri":"bitcoin:mu5GceHFAG38mGRYCFqafe5ZiNKLX3rKk9?message=Xena Exchange",
  “allowsRenewal”: true
}
Generic



Retrieving balance information


GET /accounts/{accountId}
Generic



Response:


{
  "balances": [
    {
      "available":"9.999",
      "onHold":"0",
      "currency":"BTC"
    },
    ...
  ]
}
Generic



Retrieving list of trusted addresses


It is possible to withdraw funds via the API only through trusted addresses. This method returns the list of trusted addresses for all currencies for the given account.


GET /accounts/{accountId}/trusted-addresses
Generic



Response:


{
  “trustedAddresses”: [
    {
      “address”: “mu5GceHFAG38mGRYCFqafe5ZiNKLX3rKk9”,
      “blockchain”: “ETH”,
      “currency”: “ETH”
    },
    ...
  ]
}
Generic


Creating withdrawal requests


It is possible to withdraw funds via the API only through trusted addresses. Two-factor authentication is skipped for requests created through the API.


POST /accounts/{accountId}/withdrawals
Generic



Body:

{
  “address”: “mu5GceHFAG38mGRYCFqafe5ZiNKLX3rKk9”,
  “amount”: “10.2”,
  “сurrency”: ”ETH”,
  “id”: ”.....”     // mandatory external ID (string), used by the client to identify his request
}
Generic



Response:

{
  “withdrawalRequestId”: 47383243,
  “status”: 1,
  “statusMessage”: “Pending confirmation”
}
Generic



In the event of a bad request, the response contains the HTTP status code 400 and error description in its body:


{
  “error”: “Description of the error”,
  “fields”: [“...”, “...”] - optional
}
Generic



The “fields” array contains the names of the fields that have not passed validation.


Retrieving a list of active withdrawal requests


This method returns a list of the active requests and requests completed within the last 24 hours.


GET /accounts/{accountId}/withdrawals
Generic



Response:


{
  “withdrawals”: [
    {
      “withdrawalRequestId”: 47383243,
      “externalId”: “...”,    // external ID submitted by the client when creating the request
      “status”: 1,
      “statusMessage”: ”Pending confirmation”,
      “amount”: “10.2”,
      “currency”: “BTC”,
      “lastUpdated”: <UNIX nanoseconds>,
      “blockchain”: “Bitcoin”,
      “address”: “mu5GceHFAG38mGRYCFqafe5ZiNKLX3rKk9”,
      “txId”: “0xfbb1b73c4f0bda4f67dca266ce6ef42f520fbb98”
    }
  ]
}
Generic



Withdrawal request statuses


Status

Status Message

1

New

2

Completed

3

Duplicate

4

Not enough money

5

Waiting for manual approval from XENA

100, 101, 102, 103

Request is being processed


Retrieving a list of active deposits


Returns a list of active deposits and deposits completed within the last 24 hours.


GET /accounts/{accountId}/deposits
Generic



Response:


{
  “deposits”: [
    {
      “currency”: “BTC”,
      “amount”: “1.2”,
      “status”: 1,
      “statusMessage”: “Processing”,
      “blockchain”: “Bitcoin”,
      “txId”: “0xfbb1b73c4f0bda4f67dca266ce6ef42f520fbb98”,
      “address”: “mu5GceHFAG38mGRYCFqafe5ZiNKLX3rKk9”,
      “lastUpdated”: <UNIX nanoseconds>
      “confirmations”: 2,
      “requiredConfirmations”: 6
    }
  ]
}
Generic



Deposit statuses


Status

Status Message

1

New

2

Completed

 

Retrieving balance history


Returns a list of balance operations. 


GET /transfers/accounts/{accountId}/balance-history?currency={currency}&from={time}&to={time}&kind={kind}&kind={kind}
Generic


Parameters: page, limit (up to 5000), from, to, symbol, trade_id, client_order_id


To filter by blockchain transaction:

GET /transfers/accounts/8263118/balance-history?txid=3e1db982c4eed2d6355e276c5bae01a52a27c9cef61574b0e8c67ee05fc26ccf
Generic



Request with pagination:

GET /transfers/accounts/{accountId}/balance-history?page={page}&limit={limit}
Generic



Response:

[
  {
    "accountId":8263118,
    "ts":1551974415000000000,
    "amount":"-1",
    "currency":"BTC",
    "kind":"internal withdrawal",
    "commission":"0",
    "id":96
  },
  {
    "accountId":8263118,
    "ts":1551964677000000000,
    "amount":"-1",
    "currency":"BTC",
    "kind":"internal deposit",
    "commission":"0",
    "id":95
  }
]
Generic



Response parameters


Field


Type / possible values

Status Message

accountId

M

number

Account number

ts

M

timestamp

Operation timestamp

amount

M

sring

Operation amount

kind

M

string

Operation type

Possible values:

- "deposit"

- "withdrawal"

- "internal deposit"

- "internal withdrawal"

- "rebate"

- "reward"

commission

M

string

Operation commission

id

M

number

Operation id