Changelogs
| version | time | content |
|---|---|---|
| V1.0.1 | 2025-04-16 |
modify the name of the interface to Balance+ API, and update the interface description such as deposit, withdraw, etc. |
| V1.0.0 | 2022-05-27 |
initial version |
Introduction
Communication Protocol
HTTPS Protocol.
Encoding
The request and response data code for all interfaces is formatted according to UTF-8. Content for responses in all interfaces is formatted according to JSON.
API Request Structure
| Name | Description | Notes |
|---|---|---|
| API Address | Address for API interface | Eg. https://mapi.matrixport.com/cefi/api/v1/deposit-redeem/homepage |
| Public Parameters | Universal parameters for all interfaces | |
| Private Parameter | Special parameters for each interface | See each API interface description for details |
API hosts (production)
- REST API:
https://mapi.matrixport.com
Public Parameters
Public parameters are used for interface authentication. Unless otherwise necessary, these parameters will be omitted for each interface. Each request must contain these parameters unless stated otherwise.
| Parameter Name | Type | Mandatory | Limit | Description |
|---|---|---|---|---|
| x-request-id | string | N | - | Globally unique trace id, used for tracing requests, Strongly recommended to pass in the request header. |
Response Format Strings
All interface response values are formatted according to JSON. Unless otherwise stated, all request return values contain the following text strings:
| Parameter Name | Type | Description |
|---|---|---|
| code | int | Interface call status, (ie. error code): 0: Normal, Others: Call error. |
| message | string | Error message is description of API errors |
| data | object | Results will return as defined by each interface |
Authentication
Balance+ API
Currency list
- Interface description
- The interface returns a list of all available currency information. The currency information includes asset currency, current balance, deposit apy, user balance and income, etc.
GET
/flexible/api/v2/app/homepageRequest parameter location: query_string
| Parameter Name | Type | Required | Maximum Length | Description |
|---|---|---|---|---|
| product_type | string | Y | 64 | product type, such as flexi_saving, staking, etc. |
| subject_type | string | Y | 64 | must be flexi_saving |
- Response result
- The response fields are as follows, and the response common fields have been omitted.
- Data data structure and description
curl "https://mapi.matrixport.com/flexible/api/v2/app/homepage?product_type=flexi_saving×tamp=1627021721000&signature=d58a54d7921187bf81a0e9d028cf460f70c3c83faba7f0e9abee054e7f7bfcd1"
{
"code": 0,
"message": "",
"data": {
"total_balance_amount": "0", //string, user's total balance amount
"total_interest": "0", //string, user's total revenue amount
"currencies": [
//array, list of investable currencies
{
"currency": "ETH", //string, currency name
"product_type": "flexi_saving",
"subject_type": "flexi_saving",
"balance": "0", //string, user balance in this currency
"deposit_apy": "0.08", //string, deposit apy
"interest": "0" //string, user's income amount in this currency
}
]
}
}
| Parameter Name | Type | Description |
|---|---|---|
| total_balance_amount | string | user's total balance amount |
| total_interest | string | user's total revenue amount |
| currencies | array | list of investable currencies |
| currencies.currency | string | currency name |
| currencies.balance | string | user balance in this currency |
| currencies.deposit_apy | string | deposit apy |
| currencies.interest | string | user's income amount in this currency |
Currency details
- Interface description
- The interface passes in the name of the currency, and returns the information of the currency, including current balance, deposit apy, capital utilization, policy details, user balance and income, etc.
GET
/flexible/api/v2/deposit-redeem/currency/detailRequest parameter location: query_string
| Parameter Name | Type | Required | Maximum Length | Description |
|---|---|---|---|---|
| currency | string | Y | 64 | Currency name, such as BTC, ETH, etc. |
| product_type | string | Y | 64 | must be flexi_saving |
| subject_type | string | Y | 64 | must be flexi_saving |
- Response result
- The response fields are as follows, and the response common fields have been omitted.
- Data structure and description
curl "https://mapi.matrixport.com/flexible/api/v2/deposit-redeem/currency/detail?currency=BTC&product_type=flexi_saving&subject_type=flexi_saving×tamp=1627021721000&signature=d58a54d7921187bf81a0e9d028cf460f70c3c83faba7f0e9abee054e7f7bfcd1"
{
"code": 0,
"message": "",
"data": {
"agreement": "cefi_0001_agreement_test", //string, agreement name
"apy_subscribe_setting": {
"currency": "BTC", //string, currency name
"product_type": "flexi_saving",
"subject_type": "flexi_saving",
"deposit_apy": 0,
"enable": true,
"notify_interval": 0
},
"auto_deposit": false, //bool, Whether automatically deposit
"auto_deposit_proportion": "1", //string, automatically saves the proportion
"detail_url": "string",
"inflection_apy": 0,
"policy": {
//object, policy details
"allowance_threshold": 0,
"deposit_allowance": 0,
"exponent_base": 100000,
"id": "string",
"inflection_point": "0.75", //string, utilization inflection point
"min_loan_rate": 0,
"name": "string",
"profit_factor": 0,
"slope_after_point": 0,
"slope_before_point": 0
},
"redeem_all": true,
"currency": "BTC", //string, currency name
"product_type": "flexi_saving",
"subject_type": "flexi_saving",
"balance": "0", //string, user balance
"interest": "0", //string, interest
"yesterday_interest": "0", //string, yesterday's earnings
"current_apy": "0.341090391338626559", //string, annualized deposit
"loan_apy": "0.35433837792241125", //string, loan apy
"pool_deposit": "0", //string, currency deposit
"pool_supply": "294.703307677966421877", //string, current balance of the currency
"product_status": 2, //string, product status 1 pending release 2 released 3 off the shelf
"current": "0.962612047101808502", //string, capital utilization
"product_i18ns": [
{
"currency": "BTC", //string, currency name
"product_type": "flexi_saving",
"subject_type": "flexi_saving",
"created_at": 0,
"data": "string",
"id": 0,
"language": "string",
"tag": "string"
}
]
}
}
| Parameter Name | Type | Description |
|---|---|---|
| agreement | string | agreement name |
| apy_subscribe_setting.currency | string | currency name |
| auto_deposit | bool | Whether automatically deposit |
| auto_deposit_proportion | string | automatically saves the proportion |
| policy | object | policy details |
| policy.inflection_point | string | utilization inflection point |
| currency | string | currency name |
| balance | string | user balance |
| interest | string | interest |
| yesterday_interest | string | yesterday's earnings |
| current_apy | string | annualized deposit |
| loan_apy | string | loan apy |
| pool_deposit | string | currency deposit |
| pool_supply | string | current balance of the currency |
| product_status | string | product status 1 pending release 2 released 3 off the shelf |
| current | string | capital utilization |
| product_i18ns.currency | string | currency name |
User available balance
- Interface description
- The interface passes in currency and returns the user's available balance of the currency.
GET
/flexible/api/v2/deposit-redeem/user/available-balanceRequest parameter location: query_string
| Parameter Name | Type | Required | Maximum Length | Description |
|---|---|---|---|---|
| currency | string | Y | 64 | Currency name, such as BTC, ETH, etc. |
| product_type | string | Y | 64 | must be flexi_saving |
| subject_type | string | Y | 64 | must be flexi_saving |
- Response result The response fields are as follows, and the response common fields have been omitted.
- Data structure and description
curl "https://mapi.matrixport.com/flexible/api/v2/deposit-redeem/user/available-balance?currency=BTC&product_type=flexi_saving&subject_type=flexi_saving×tamp=1627021721000&signature=d58a54d7921187bf81a0e9d028cf460f70c3c83faba7f0e9abee054e7f7bfcd1"
{
"code": 0,
"message": "",
"data": {
"supply_min_amount": "0.1", //string, Minimum deposit amount for a single time
"supply_max_amount": "100", //string, Maximum deposit amount at one time
"user_supply_max_amount": "0", //string, user's maximum investment amount
"user_available_balance": "1.1035", //string, user available balance
"agreement": "20210325_CFI", //string, agreement name
"reference_apy": "0.03", //string, reference apy
"accrual_type": 2, //string, interest calculation mode, 1: simple interest, 2: compound interest
"interest_period": 1, //string, interest period
"questionnaire": true //string, whether to answer the questionnaire
}
}
| Parameter Name | Type | Description |
|---|---|---|
| supply_min_amount | string | Minimum deposit amount for a single time |
| supply_max_amount | string | Maximum deposit amount at one time |
| user_supply_max_amount | string | user's maximum investment amount |
| user_available_balance | string | user available balance |
| agreement | string | agreement name |
| reference_apy | string | reference apy |
| accrual_type | string | interest calculation mode, 1: simple interest, 2: compound interest |
| interest_period | string | interest period |
| questionnaire | string | whether to answer the questionnaire |
Deposit
- Interface description
- This interface allows users to deposit different cryptocurrencies into their Balance+ account. Note that this interface is asynchronous, and the result will not be obtained immediately after the call. You need to query the result through a GET request with the another PATH.
- POST
/flexible/api/v2/deposit - Request parameter location: body/json
| Parameter Name | Type | Required | Maximum Length | Description |
|---|---|---|---|---|
| amount | string | Y | - | amount |
| currency | string | Y | 64 | Currency name, such as BTC, ETH, etc. |
| product_type | string | Y | 64 | must be flexi_saving |
| subject_type | string | Y | 64 | must be flexi_saving |
| order_source | string | Y | 64 | deposit order source 1 User places an order |
- Response result
The response fields are as follows, and the response common fields have been omitted.
- Data structure and description
curl -H "Content-Type:application/json" -X POST --data '{"currency":BTC,"subject_type":flexi_saving,"product_type":flexi_saving,"amount":1000000,"timestamp":1628909085000,"signature":9117bd1e5587e8318456e52e091136f1eb84ffebc1f2b9656573344962acc81a}'
https://mapi.matrixport.com/flexible/api/v2/deposit
{
"code": 0,
"message": "",
"data": {
"income_distribution_time": 0, //
"serial_number": "string", //string, serial number
"type": 1 //int, order type, 1 (deposit type), 2 (withdraw)
}
}
| Parameter Name | Type | Description |
|---|---|---|
| serial_number | string | serial number |
| type | int | order type, 1 (deposit type), 2 (withdraw) |
Withdraw
- Interface description
- This interface allows users to withdraw funds from their Balance+ account. It supports both partial and full withdrawals to the user's balance account. Note that this interface is asynchronous, and the result will not be obtained immediately after the call. You need to query the result through a GET request with the another PATH.
- POST
/flexible/api/v2/redeem - Request parameter location: body/json
| Parameter Name | Type | Required | Maximum Length | Description |
|---|---|---|---|---|
| amount | string | Y | - | amount |
| currency | string | Y | 64 | Currency name, such as BTC, ETH, etc. |
| product_type | string | Y | 64 | must be flexi_saving |
| subject_type | string | Y | 64 | must be flexi_saving |
| order_source | string | Y | 64 | deposit order source 1 User places an order |
| redeem_all | boolean | N | - | whether to redeem all |
- Response result
The response fields are as follows, and the response common fields have been omitted.
- Data structure and description
curl -H "Content-Type:application/json" -X POST --data '{"currency":BTC,"subject_type":flexi_saving,"product_type":flexi_saving,"amount":1000000,"timestamp":1628909085000,"signature":9117bd1e5587e8318456e52e091136f1eb84ffebc1f2b9656573344962acc81a}'
https://mapi.matrixport.com/flexible/api/v2/redeem
{
"code": 0,
"message": "",
"data": {
"serial_number": "string", //string, serial number
"type": 1 //int, order type, 1 (deposit type), 2 (withdraw)
}
}
| Parameter Name | Type | Description |
|---|---|---|
| serial_number | string | serial number |
| type | int | order type, 1 (deposit type), 2 (withdraw) |
Deposit/Withdraw result
- Interface description
- Since the user initiates [deposit and withdraw interface] is asynchronous, in order to get the result, you need to query the result through serial_number
GET
/flexible/api/v2/deposit-redeemRequest parameter location: query_string
| Parameter Name | Type | Required | Maximum Length | Description |
|---|---|---|---|---|
| serial_number | string | Y | 128 | serial_number returned by post method Order serial number |
- Response result
curl "https://mapi.matrixport.com/flexible/api/v2/deposit-redeem?serial_number=xxxx×tamp=1627021721000&signature=d58a54d7921187bf81a0e9d028cf460f70c3c83faba7f0e9abee054e7f7bfcd1"
{
"code": 0, //int, see in error code
"message": "xxx"
}
| Parameter Name | Type | Description |
|---|---|---|
| code | int | see in error code |
Query orders
- Interface description
- Get a list of user deposit/withdraw orders.
GET
/flexible/api/v2/deposit-redeem/ordersRequest parameter location: query_string
| Parameter Name | Type | Required | Maximum Length | Description |
|---|---|---|---|---|
| currency | string | Y | - | currency |
| product_type | string | Y | 64 | product type, such as flexi_saving, etc. |
| subject_type | string | Y | 64 | subject type, such as flexi_saving, etc. |
| offset | integer | Y | - | offset |
| limit | integer | Y | - | Quantity per page |
| type | integer | Y | - | order type, 1 (deposit type), 2 (withdraw) |
| order_source | integer | Y | - | Deposit order source 1 User places an order, 2 System places an order 3 Automatic deposit |
| order_status | integer | Y | - | Order status 0 means all 1 (queuing), 2 (processing), 3 (cancelled), 4 (completed) |
- Response result
- The response fields are as follows, and the response common fields have been omitted.
- Data structure and description
curl "https://mapi.matrixport.com/flexible/api/v2/deposit-redeem/orders?currency=BTC&product_type=flexi_saving&subject_type=flexi_saving×tamp=1627021721000&signature=d58a54d7921187bf81a0e9d028cf460f70c3c83faba7f0e9abee054e7f7bfcd1"
{
"code": 0,
"message": "",
"data": {
"count": 0, //int, count
"orders": {
//object,
"amount": "", //string, investment amount
"created_at": "", //integer, creation time
"currency": "", //string, investment currency
"product_type": "flexi_saving",
"subject_type": "flexi_saving",
"order_id": "", //string, order ID
"order_source": "", //integer, order source 1, the user places an order 2, the system places an order, 3 is automatically deposited
"order_status": "", //integer, order status 1 (queuing), 2 (processing), 3 (cancelled), 4 (completed)
"policy_id": "", //string, policy ID
"redeem_all": "", //boolean, whether to redeem all
"redeem_principal": "", //string, withdraw principal
"redeem_profit": "", //string, withdraw profit
"refund_transfer_sn": "", //string, refund serial number
"transfer_sn": "", //string, platform transaction serial number
"type": "", //integer, order type, 1(deposit), 2(withdraw)
"updated_at": "", //integer, update time
"user_id": "", //string, user ID
"agreement_status": 0,
"biz_serial_number": "string",
"confirmed_time": 0,
"failed_code": 0 //integer,Error code, record the reason for order failure, refer to Error Codes
}
}
}
| Parameter Name | Type | Description |
|---|---|---|
| count | int | count |
| orders.amount | string | investment amount |
| orders.created_at | integer | creation time |
| orders.currency | string | investment currency |
| orders.order_id | string | order ID |
| orders.order_source | integer | order source 1, the user places an order 2, the system places an order, 3 is automatically deposited |
| orders.order_status | integer | order status 1 (queuing), 2 (processing), 3 (cancelled), 4 (completed) |
| orders.policy_id | string | policy ID |
| orders.redeem_all | boolean | whether to redeem all |
| orders.redeem_principal | string | withdraw principal |
| orders.redeem_profit | string | withdraw profit |
| orders.refund_transfer_sn | string | refund serial number |
| orders.transfer_sn | string | platform transaction serial number |
| orders.type | integer | order type, 1(deposit), 2(withdraw) |
| orders.updated_at | integer | update time |
| orders.user_id | string | user ID |
| orders.failed_code | integer | Error code, record the reason for order failure, refer to Error Codes |
Revenue details
Interface description
Get the revenue details owned by the user and in the specified currency.
Notice
In order to optimize the performance of querying the database, the traditional limit and offset are not used for page-turning query data, but timestamp is used for conditional filtering.
When querying the data on the first page, next_timestamp is set to 0. When querying the data on the next page, next_timestamp will pass the next_timestamp of the results on the previous page.
It is possible that the data on the previous page and the current page will be duplicated. Use timestamp+currency as the unique key for deduplication processing.
GET
/flexible/api/v2/deposit-redeem/interest/detailRequest parameter location: query_string
| Parameter Name | Type | Required | Maximum Length | Description |
|---|---|---|---|---|
| currency | string | N | - | Currency name, such as BTC, ETH, etc. |
| product_type | string | Y | - | must be flexi_saving |
| subject_type | string | Y | - | must be flexi_saving |
| limit | integer | Y | - | Total amount of data displayed per page |
| next_timestamp | integer | N | - | When next_timestamp is 0, aggregate data including total assets, accumulated income, and yesterday's income will be displayed |
| period | integer | N | - | Period, the unit is days, if not passed, the default is cumulative income |
- Response result
- The response fields are as follows, and the response common fields have been omitted.
- Data structure and description
curl "https://mapi.matrixport.com/flexible/api/v2/deposit-redeem/interest/detail?currency=BTC&product_type=flexi_saving&subject_type=flexi_saving×tamp=1627021721000&signature=d58a54d7921187bf81a0e9d028cf460f70c3c83faba7f0e9abee054e7f7bfcd1"
{
"code": 0,
"message": "",
"data": {
"accumulated_interest": "40.196999948", //string, total income during the period
"currency": "USD", //string, income currency type
"product_type": "flexi_saving",
"subject_type": "flexi_saving",
"next_timestamp": 1621576800000, //integer, start time of next page data
"total_asset": "50.196999948", //string, total asset valuation
"yesterday_interest": "0", //string, yesterday's earnings
"interests": [
// array, interests
{
"currency": "BTC", //string, investment currency
"interest": "0.000002188177296747", //string, interest
"rate": "0.025", //string, age
"timestamp": 1621576800000, //integer, interest calculation time in milliseconds
"asset_interest": 0,
"asset_principal": 0,
"created_at": 0,
"duration": 0,
"latest": 0,
"product_type": "flexi_saving",
"reported": true,
"subject_type": "flexi_saving",
"user_id": "123456"
}
]
}
}
| Parameter Name | Type | Description |
|---|---|---|
| accumulated_interest | string | total income during the period |
| currency | string | income currency type |
| next_timestamp | integer | start time of next page data |
| total_asset | string | total asset valuation |
| yesterday_interest | string | yesterday's earnings |
| interests | array | interests |
| interests.currency | string | investment currency |
| interests.interest | string | interest |
| interests.rate | string | rate |
Withdrawable balance
- Interface description
- User withdrawable balance interface.
GET
/flexible/api/v2/deposit-redeem/user/redeem-balanceRequest parameter location: query_string
| Parameter Name | Type | Required | Maximum Length | Description |
|---|---|---|---|---|
| currency | string | Y | - | currency |
| product_type | string | Y | - | must be flexi_saving |
| subject_type | string | Y | - | must be flexi_saving |
- Response result
- The response fields are as follows, and the response common fields have been omitted.
- Data structure and description
curl "https://mapi.matrixport.com/flexible/api/v2/deposit-redeem/user/redeem-balance?currency=BTC&product_type=flexi_saving&subject_type=flexi_saving×tamp=1627021721000&signature=d58a54d7921187bf81a0e9d028cf460f70c3c83faba7f0e9abee054e7f7bfcd1"
{
"code": 0,
"message": "",
"data": {
"redeem_min_amount": "0.05", //string, minimum redeem amount
"redeem_max_amount": "0.5", //string, maximum withdraw amount
"reference_apy": "0.03", //string, reference apy
"principal": "0", //string, currently confirmed investment principal
"interest": "0", //string, current remaining interest
"supply_balance": "0", //string, pool liquidity balance
"redeem_delay_time": 0 //string, withdraw delay time
}
}
| Parameter Name | Type | Description |
|---|---|---|
| redeem_min_amount | string | minimum redeem amount |
| redeem_max_amount | string | maximum withdraw amount |
| reference_apy | string | reference apy |
| principal | string | currently confirmed investment principal |
| interest | string | current remaining interest |
| supply_balance | string | pool liquidity balance |
| redeem_delay_time | string | withdraw delay time |
Total position
GET
/flexible/api/v2/user/asset/summaryResponse result
- The response fields are as follows, and the response common fields have been omitted.
Data structure and description
curl "https://mapi.matrixport.com/flexible/api/v2/user/asset/summary?timestamp=1627021721000&signature=d58a54d7921187bf81a0e9d028cf460f70c3c83faba7f0e9abee054e7f7bfcd1"
{
"code": 0,
"message": "",
"data": {
"total_asset": "0", //string, total position unit is USD
"total_profit": "0" //string, total profit unit is USD
}
}
| Parameter Name | Type | Description |
|---|---|---|
| total_asset | string | total position unit is USD |
| total_profit | string | total profit unit is USD |
Error Codes
Response return calls indicate the call and execution result summary for current API services. Return code messages provide additional information for the user to determine API execution.
All interface call return values contain an error code (value) and message (error description). See below:
| Return Codes | Details |
|---|---|
| 0 | The interface call is successful |
| 17002001 | Verify signature parameter error |
| 17002012 | No Interface Access |
| 17002011 | IP Restricted |
| 17002010 | Signature error |
| 17002013 | akid illegal |
| 12010001 | Can't cancel |
| 12010002 | Insufficient deposit balance |
| 12010003 | Insufficient Withdraw amount |
| 12010004 | Parameter error |
| 12010005 | Product Restricted |
| 12010006 | The deposit has not been processed, indicating failure |
| 12010007 | Rejected, indicating failure |
| 12010008 | Refused to deposit due to full Withdraw |
| 12010009 | Withdraw failed due to insufficient supply |
| 12010010 | Processing failed |
| 12010011 | Interest calculation error |
| 12010012 | The deposit Withdraw process is in progress, indicating that there is no result, you need to continue to inquire |
| 12010013 | No repayment required |
| 12010014 | Duplicate order |
| 12010015 | internal error pls contact support |