Transfers

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

Endpoint

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

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

Authentication

Authentication necessitates a nonce string signed by your API key. 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

The nonce (UNIX nanosecond timestamp) must be unique for each request and not older than 60 seconds.

Requesting account lists

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

GET /accounts

Response

[10832434,10834231]

Retrieving deposit address

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

Response

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

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 renewal of deposit address

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

Response

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

Retrieving balance information

GET /accounts/{accountId}

Response

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

Retrieving list of trusted addresses

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

GET /accounts/{accountId}/trusted-addresses

Response

{
    "trustedAddresses": [
        {
            "address": "mu5GceHFAG38mGRYCFqafe5ZiNKLX3rKk9",
            "blockchain": "ETH",
            "currency": "ETH"
        },
        ...
    ]
}

Creating withdrawal requests

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

POST /accounts/{accountId}/withdrawals

Body

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

Response

{
    "withdrawalRequestId": 47383243,
    "status": 1,
    "statusMessage": "Pending confirmation"
}

In case of a bad request the response has the HTTP status code 400 and error description in its body:

{
    "error": "Description of the error",
    "fields": ["...", "..."] // optional
}

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

Trusted addresses

There is no way to programmatically pass the 2FA code when creating a withdrawal request, which is required if two-factor authentication is enabled for your account (and we recommend that you enable it!). This is done intentionally for security reasons.

Therefore, withdrawals via the API for an account with 2FA enabled can be sent only to trusted addresses that you must configure in advance. Adding new addresses to this list requires the 2FA code, so even if your API keys have been compromised, it will not be possible to withdraw your from money anywhere except your own wallets.

Retrieving a list of active withdrawal requests

This method returns all active requests and requests completed within the last 24 hours.

GET /accounts/{accountId}/withdrawals

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"
        }
    ]
}

Withdrawal request statuses

StatusStatus Message
1New
2Completed
3Duplicate
4Not enough money
5Waiting for manual approval by XENA
100, 101, 102, 103Request is being processed

Retrieving list of active deposits

Returns active deposits and deposits completed within last 24 hours.

GET /accounts/{accountId}/deposits

Response

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

Deposit statuses

StatusStatus Message
1New
2Completed