Wallet

Wallet web API V1

Wallet web API V1

Introduction

Wallet web API V1

Error handling

Each API response contains a success (boolean) field. When success is false, the error (string) field with the error description is also included.

Example success response:

{
	"success": true
}
Example error response:
{
	"success": false,
	"error": "Missing data"
}

In addition, various HTTP errors may occur, e.g. 404 if the endpoint does not exist or 500 if API is unavailable due to some backend malfunction. If the status is not 200, the contents of response body is unpredictable and should be ignored.

Wallet web API V1

Endpoints list

 Assets list

POST /assets
Get list of assets supported by exchange This endpoints returns a maximum of 50 records. Use the offset field to get the next part of data.

Request parameters:

Parameter Type Description
symbols array<string> Optional. Provide asset symbols if you want to get informations only about these assets
search string Optional. Provide arbitrary string to search in assets list
offset int Optional. Number of rows to skip.

Response: assets - associative array of objects, indexed by asset symbols. The asset objects contains following fields:

Field Type Description
name string Asset full name
icon_url string Asset icon URL (svg or png file)

Request example:

curl -X POST https://api.infinex.cc/wallet/assets -H 'Content-Type: application/json' -d '{"offset": 0}'
Response example:
{
    "success": true,
    "assets": {
        "BCH": {
            "name": "Bitcoin Cash",
            "icon_url": "/ico/bch.svg"
        },
        "BPX": {
            "name": "BPX",
            "icon_url": "/ico/bpx.svg"
        },
        "BSV": {
            "name": "Bitcoin SV",
            "icon_url": "/ico/bsv.svg"
        },
        "BTC": {
            "name": "Bitcoin",
            "icon_url": "/ico/btc.svg"
        }
    ]
}

Networks list

POST /networks
Get list of networks related to given asset

Request parameters:

Parameter Type Description
asset string Required. Asset symbol

Response: networks - associative array of objects, indexed by network symbols. The network objects contains following fields:

Field Type Description
description string Network description
icon_url string Network icon URL (svg or png file)

Request example:

curl -X POST https://api.infinex.cc/wallet/networks -H 'Content-Type: application/json' -d '{"asset": "USDT"}'
Response example:
{
    "success": true,
    "networks": {
        "ETH": {
            "description": "Ethereum / ERC20",
            "icon_url": "/ico/eth.svg"
        },
        "TRX": {
	        "description": "Tron / TRC20",
	        "icon_url": "/ico/trx.svg"
        }
    }
}

Wallet balances

POST /balances
POST /balances_ex
Get user account balances. This endpoints returns a maximum of 50 records. Use the offset field to get the next part of data.

Request parameters:

Parameter Type Description
api_key string Required. Account API key.
symbols array<string> Optional. Provide asset symbols if you want to get informations only about these assets
search string Optional. Provide arbitrary string to search in assets list
offset int Optional. Number of rows to skip.

Response: balances - associative array of objects, indexed by asset symbols. The balance objects contains following fields:

Field Type Description
total string Total account balance
locked string Locked amount (e.g. open spot orders, pending withdrawals)
avbl string Balance available to spend (avbl = total - locked)

balances_ex endpoint includes additional data and it is a combination of /wallet/assets and /wallet/balances endpoints:

Field Type Description
name string Asset full name
icon_url string Asset icon URL (svg or png file)

Request example:

curl -X POST https://api.infinex.cc/wallet/balances -H 'Content-Type: application/json' -d '{"api_key": "00000000000000000000", "offset": 0}'
Response example:
{
    "success": true,
    "balances": {
        "BTC": {
            "total": "899999856.2147932498",
            "locked": "0",
            "avbl": "899999856.2147932498"
        },
        "TRX": {
            "total": "900101825.5753",
            "locked": "0",
            "avbl": "900101825.5753"
        },
        "ETC": {
            "total": "100000",
            "locked": "0",
            "avbl": "100000"
        },
        "XCH": {
            "total": "99914.283",
            "locked": "0",
            "avbl": "99914.283"
        }
    ]
}

Wallet transactions

POST /transactions
Query the wallet transactions history. This endpoints returns a maximum of 50 records. Use the offset field to get the next part of data.

Request parameters:

Parameter Type Description
api_key string Required. Account API key.
offset int Required. Number of rows to skip.
asset string Optional. Asset symbol to filter only this asset transactions.
type string Optional. Transaction type to filter transactions: DEPOSIT or WITHDRAWAL.
status string Optional. Transaction status to filter transactions: PENDING or DONE.

Response: transactions - array of transaction objects which contains following fields:

Field Type Description
xid int Transaction unique id.
type string DEPOSIT or WITHDRAWAL
asset string Asset symbol
network string Network symbol
amount string Transaction amount
status string PENDINGPROCESSINGPENDING_CANCELCANCELED or DONE
create_time string Unix timestamp of transaction
address string Deposit / withdrawal address
network_description string Description of transaction network
icon_url string Asset icon url
memo string Transaction memo / routing key. Optional: only for networks which requires memo (like Ripple)
exec_time string Unix timestamp. For deposit it's confirmation time. For withdrawal it's execute time. Optional: only if transaction is confirmed / executed
confirms int Current confirmations count. Optional: only if transaction type is deposit and transaction status is pending
confirms_target int Target confirmations count. Optional: only if transaction type is deposit and transaction status is pending
txid string Blockchain transaction id. Optional: absent if transaction type is withdrawal and transaction status is pending
height int Deposit transaction block height. Optional: absent if transaction type is not deposit
wd_fee_this string Withdrawal fee. Optional: absent if transaction type is not withdrawal or transaction status is pending
memo_name string If additional information is needed for the deposit / withdrawal in addition to the address, here is the name of this information (Memo / Routing Key), to be displayed to the user. Optional: absent if additional information is not needed

Request example:

curl -X POST https://api.infinex.cc/wallet/transactions -H 'Content-Type: application/json' -d '{"api_key": "00000000000000000000", "offset": 0}'
Response example:
{
    "success": true,
    "transactions": [
        {
            "xid": 12,
            "type": "WITHDRAWAL",
            "asset": "BPX",
            "network": "BPX",
            "amount": "2642.10169065",
            "status": "PENDING",
            "create_time": "1653485615.879955",
            "address": "bpx1000000000000000000000000000000000000000000",
            "network_description": "BPX",
            "fee": "0.0002",
            "icon_url": "/ico/bpx.svg"
        }
    ]
}

Get deposit address

POST /deposit
Get account deposit address for given asset and network.

Request parameters:

Parameter Type Description
api_key string Required. Account API key.
asset string Required. Asset symbol.
network string Required. Network symbol.

Response:

Field Type Description
operating bool true if there are no problems with connection to given network. false if the full node of the exchange does not respond to the ping or is out of sync.
confirms_target int Number of confirmations required to approve a deposit.
address string Deposit address
memo string Transaction memo / routing key. Optional: only for networks which requires memo (like Ripple)
memo_name string If additional information is needed for the deposit / withdrawal in addition to the address, here is the name of this information (Memo / Routing Key), to be displayed to the user. Optional: absent if additional information is not needed
qr_content string Full payment URL for QR code to be scanned by the wallet. Optional: If the given network does not support the payment URL, this field is missing. You can generate a QR code containing just the wallet address.

Request example:

curl -X POST https://api.infinex.cc/wallet/deposit -H 'Content-Type: application/json' -d '{"api_key": "00000000000000000000", "asset": "BPX", "network": "BPX"}'
Response example:
{
    "success": true,
    "operating": true,
    "confirms_target": 32,
    "address": "bpx1000000000000000000000000000000000000000000",
    "qr_content": "bpx_addr://bpx1000000000000000000000000000000000000000000"
}

Get withdrawal informations

POST /withdraw/info
Get the informations you need before withdrawal.

Request parameters:

Parameter Type Description
api_key string Required. Account API key.
asset string Required. Asset symbol.
network string Required. Network symbol.

Response:

Field Type Description
operating bool true if there are no problems with connection to given network. false if the full node of the exchange does not respond to the ping or is out of sync.
fee_min string Minimal withdrawal fee.
fee_max string Maximal withdrawal fee.
prec int Number of decimal places for withdrawal amount.
memo_name string If additional information is needed for the deposit / withdrawal in addition to the address, here is the name of this information (Memo / Routing Key), to be displayed to the user. Optional: absent if additional information is not needed

Request example:

curl -X POST https://api.infinex.cc/wallet/withdraw/info -H 'Content-Type: application/json' -d '{"api_key": "00000000000000000000", "asset": "BPX", "network": "BPX"}'
Response example:
{
    "success": true,
    "operating": true,
    "fee_min": "0",
    "fee_max": "0.0005",
    "prec": 12
}

Validate withdrawal address

POST /withdraw/validate
Validate withdrawal address (and Memo / Routing Key if needed).

Request parameters:

Parameter Type Description
api_key string Required. Account API key.
asset string Required. Asset symbol.
network string Required. Network symbol.
address string Optional. Address to validate.
memo string Optional. Memo / routing key to validate.

Response:

Field Type Description
valid_address bool Is address valid. Optional: absent if address not specified in request
valid_memo bool Is memo / routing key valid. Optional: absent if memo not specified in request

Request example:

curl -X POST https://api.infinex.cc/wallet/withdraw/validate -H 'Content-Type: application/json' -d '{"api_key": "00000000000000000000", "asset": "BPX", "network": "BPX", "address": "AAAAAAAAAAAAAA"}'
Response example:
{
	"success": true,
    "valid_address": false
}

Request withdrawal

POST /withdraw
Request funds withdrawal.

Request parameters:

Parameter Type Description
api_key string Required. Account API key.
asset string Required. Asset symbol.
network string Required. Network symbol.
address string Required. Withdrawal wallet address.
amount string Required. Withdrawal amount.
fee string Required. Withdrawal fee amount.
memo string Optional. Withdrawal wallet memo / routing key if needed.
adbk_name string Optional. If a name is entered here, the withdrawal address will be saved in the address book under that name.

Response:

xid - unique wallet transaction ID

Request example:

curl -X POST https://api.infinex.cc/wallet/withdraw -H 'Content-Type: application/json' -d '{"api_key": "00000000000000000000", "asset": "BPX", "network": "BPX", "address": "AAAAAAAAAAAAAA", "amount": "5.5", "fee": "0", "adbk_name": "my wallet"}'
Response example:
{
	"success": true,
    "xid": 2510
}

Cancel withdrawal

POST /withdraw/cancel
Request withdrawal cancelation. Only withdrawal with the status PENDING or PROCESSING can be canceled.

Request parameters:

Parameter Type Description
api_key string Required. Account API key.
xid int Required. Withdrawal transaction ID.

Response: Only success/error. This endpoint returns success if the status of withdrawal transaction was successfully changed from PENDING or PROCESSING to PENDING_CANCEL. If the transaction has already been sent to the blockchain in the meantime, it will not be canceled. You can be sure that the withdrawal is canceled only when the status changes to CANCELED.

Request example:

curl -X POST https://api.infinex.cc/wallet/withdraw/cancel -H 'Content-Type: application/json' -d '{"api_key": "00000000000000000000", "xid": 1234}'
Response example:
{
	"success": true
}

Query address book

POST /addressbook
Query users address book.

Request parameters:

Parameter Type Description
api_key string Required. Account API key.
asset string Optional. Asset symbol to filter only this asset addresses.
network string Optional. Network symbol to filter only this network addresses.

Response: addressbook - associative array of address book objects, indexed by unique adbkid. Address book object contains following fields:

Field Type Description
asset string Asset symbol
network string Network symbol
address string Saved address
name string Saved address name
icon_url string Asset icon url
network_description string User friendly name of network
memo string Saved memo / routing key. Optional: only for networks which requires memo (like Ripple)
memo_name string If memo / routing key is saved with the address, here is the name of this information (Memo / Routing Key), to be displayed to the user. Optional: absent if additional information is not needed

Request example:

curl -X POST https://api.infinex.cc/wallet/addressbook -H 'Content-Type: application/json' -d '{"api_key": "00000000000000000000"}'
Response example:
{
    "success": true,
    "addressbook": {
        "3": {
            "asset": "BPX",
            "network": "BPX",
            "address": "bpx1000000000000000000000000000000000000000000",
            "name": "my wallet",
            "icon_url": "/ico/bpx.svg",
            "network_description": "BPX"
        }
    }
}

Rename address book item

POST /addressbook/rename
Rename address book item.

Request parameters:

Parameter Type Description
api_key string Required. Account API key.
adbkid int Required. Unique address book item ID.
new_name string Required. New name.

Response: Only success/error.

Request example:

curl -X POST https://api.infinex.cc/wallet/addressbook/rename -H 'Content-Type: application/json' -d '{"api_key": "00000000000000000000", "adbkid": 55, "new_name": "mobile wallet"}'
Response example:
{
    "success": true
}

Delete address book item

POST /addressbook/delete
Delete address book item.

Request parameters:

Parameter Type Description
api_key string Required. Account API key.
adbkid int Required. Unique address book item ID.

Response: Only success/error.

Request example:

curl -X POST https://api.infinex.cc/wallet/addressbook/delete -H 'Content-Type: application/json' -d '{"api_key": "00000000000000000000", "adbkid": 55}'
Response example:
{
    "success": true
}

Wallet REST API V2

Wallet REST API V2

Introduction

Wallet REST API V2

Error handling

API V2 uses following HTTP status codes to indicate success or failures:

Status code Explanation
200 OK Success.
400 Bad Request Missing or invalid request parameters.
401 Unauthorized Authorization is required but no API key provided.
403 Forbidden Invalid API key, no permissions to given resource (e.g. it belongs to another user), resource disabled by administrator.
404 Not Found Resource does not exists.
405 Method Not Allowed Resource exists but given method cannot be used on it, e.g. POST to a read-only trading pairs list, using an endpoint that cancels a withdrawal on transaction that is a deposit or internal transfer.
406 Not Acceptable Request parameters are valid but cannot be accepted, e.g. trying to withdraw coin using valid network, but not associated with given coin, trying to withdraw greater amount than account balance.
409 Conflict There is a conflict of data that should be unique, e.g. trying to create API key with the same name as existing one.
500 Internal Server Error

Internal error on the Infinex backend. Please try the request again, preferably with some delay.

504 Gateway Timeout

One of the backend services received your request but did not respond in any way. The execution status is unknown and could have been a failure as good as a success. This should be verified preferably after some time has passed.

511 Network Authentication Required

2FA is required. You should repeat the request with identical parameters and 2FA code attached.

For any status except 200, the response body contains the error payload like this:

{
    "error": {
        "code": "INTERNAL_SERVER_ERROR",
        "msg": "Internal server error"
    }
}

The code field contains an unique, constant error code which can be used to catch the specific error.

The msg field contains a human-readable error message, which may be updated by Infinex developers without any notice, so it should not be parsed or used for any purposes other than displaying it to the user in unmodified form.

Wallet REST API V2

Authorization

Some endpoints require user authorization by providing an API key that can be generated on the Infinex website.

Never share your API key to ANYONE !

The client must send this key in the Authorization HTTP header of any requests to protected resources:

Authorization: Bearer <api key here>

If you try to use a protected resource without authorization header you will receive a 401 Unauthorized response. If the provided API key is invalid, you will receive a 403 Forbidden response.

2FA

Some endpoints require two factor authentication. In this case, you will receive status 511 Network Authentication Required with error code REQUIRE_2FA. If your account is using one-time e-mail codes as the 2FA provider, the e-mail code will be sent at this point. Error response msg field will contain human-readable information about where to find the code:

{
    "error": {
        "code": "REQUIRE_2FA",
        "msg": "example@example.com"
    }
}

or:

{
    "error": {
        "code": "REQUIRE_2FA",
        "msg": "Google Authenticator"
    }
}

To complete the request, you should repeat it without any modification, only adding the code2FA field containing the correct 2FA code to the request body. A significantly modified request cannot be confirmed with the previous 2FA code, the new code will be sent instead. Invalid 2FA code returns status 403 Forbidden with error code INVALID_2FA.

Wallet REST API V2

Pagination

API V2 uses two methods of data pagination. Individual documentation of each endpoint specifies what type of pagination is used by given endpoint.

Offset pagination

To fetch the first page of entries in a collection, the API needs to be called either without the offset parameter, or with the offset set to 0. Optional limit field specifies how many records each page should contain.

Each response contains an array of records and boolean more field that informs whether next page is available or not.

{
    "assets": [
        ...
    ],
    "more": true
}

To fetch the next page of entries the API needs to be called with an offset parameter that equals the sum of the previous offset value and count of items in previous page response.

Cursor pagination

To fetch the first page of entries, the API needs to be called without the cursor parameter. Optional limit field specifies how many records each page should contain.

Each response contains an array of records and the cursor field, which can be null if there is no next page, or integer value if next page is available.

{
    "popups": [
        ...
    ],
    "cursor": 5
}

To fetch the next page of entries the API needs to be called with a cursor query parameter equal to cursor value from previous page response.

Wallet REST API V2

Searching

Some endpoints allow you to free text search in resulting data. The documentation of given endpoint specifies whether searching is available or not and what response fields are searched.

The search phrase should be included in the query parameter named q:

Wallet REST API V2

Sorting

Default sorting

Manual sorting

Some endpoints allow to change the default sorting field and direction.

Add query parameter orderBy to specify which field the data should be sorted by.

Add the query parameter orderDir to specify whether the data should be sorted ascending (ASC) or descending (DESC).

Wallet REST API V2

Endpoints list

Go to Swagger - interactive API documentation explorer that lets you try out the API calls directly in the browser.

 

swagger.png