/marketsFetch all asset, market, and source definitions
Request Example
cURL
curl --request GET \
--url '/markets'The base URL for endpoints described in this page of live trading API is https://api.cube.exchange/ir/v0.
OpenAPI document for Market & User API
Definitions are available as JSON and provide all of the information needed to convert between on-chain amounts and the values used on the exchange. For further details, see the Trade Api.
Some trading pairs appear in multiple markets, but only a single market will be in use for a given trading pair at any given time.
Definitions appear for markets that are no longer in use; these can be used to interpret historical orders.
status of 1 or 2.status of 3.The REST API uses the following HTTP headers for authentication:
x-api-key:x-api-signature:cube.xyz and the current Unix epoch timestamp in seconds, converted into an 8-byte little-endian array. The signature is the HMAC-SHA256 digest of the payload, using the secret key associated with the specified API key.ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/.x-api-timestamp:API Reference
Version 0.1.0
ApiKey
apiKeyThe API Key ID as specified in the API settings page.
Each API key has a corresponding access level that is set when the key is created.
- Read access only allows access to read HTTP methods (GET, HEAD, etc.).
- Write access allows access to all HTTP methods.
ApiSignature
apiKeyThe API signature string authenticating this request.
The payload to be signed is the concatenation of the byte string cube.xyz and the current unix epoch timestamp in seconds converted into an 8-byte little-endian array. The signature is the HMAC-SHA256 digest of the payload using the secret key associated with the specified API key.
Implementation notes:
- The signature is base-64 encoded with the 'standard' alphabet and
padding.
```
ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/
```
- The timestamp should be encoded as 8-byte little-endian (array of bytes)
- The secret key should be decoded from a hex string into a 32-byte array of
bytes
ApiTimestamp
apiKeyThe timestamp used for signature generation.
/marketsRequest Example
cURL
curl --request GET \
--url '/markets'/history/klinesStatistics about the price of an asset during a specific time interval. Returned as an array of unnamed values to reduce size. Fields are: [ time (in seconds since epoch), open price, high price, low price, close price, volume (in RawUnits) ] Cached frequently to improve response time; provide \'Cache-Control: no-cache\' header on request to pass through.
marketId
queryRequiredintegerinterval
queryOptionalstringstartTime
queryOptionalintegerendTime
queryOptionalintegerlimit
queryOptionalintegerRequest Example
cURL
curl --request GET \
--url '/history/klines?marketId=%3CmarketId%3E'Endpoints in this section require REST Authentication headers.
/users/checkRequest Example
cURL
curl --request GET \
--url '/users/check' \
--header 'X-API-Key: <value>' \
--header 'ApiSignature: <value>' \
--header 'ApiTimestamp: <value>'/users/apikeysaccessLevel
stringRequireditems
integerint64Request Example
application/jsoncURL
curl --request POST \
--url '/users/apikeys' \
--header 'X-API-Key: <value>' \
--header 'ApiSignature: <value>' \
--header 'ApiTimestamp: <value>' \
--header 'Content-Type: application/json' \
--data '{
"accessLevel": "read",
"subaccountId": [
1,
2
]
}'/users/apikeys/{api_key}Request Example
cURL
curl --request DELETE \
--url '/users/apikeys/<api_key>' \
--header 'X-API-Key: <value>' \
--header 'ApiSignature: <value>' \
--header 'ApiTimestamp: <value>'/users/subaccountsRequest Example
cURL
curl --request GET \
--url '/users/subaccounts' \
--header 'X-API-Key: <value>' \
--header 'ApiSignature: <value>' \
--header 'ApiTimestamp: <value>'/users/subaccountsname
stringRequiredaccountType
stringRequiredRequest Example
application/jsoncURL
curl --request POST \
--url '/users/subaccounts' \
--header 'X-API-Key: <value>' \
--header 'ApiSignature: <value>' \
--header 'ApiTimestamp: <value>' \
--header 'Content-Type: application/json' \
--data '{
"accountType": "spot",
"name": "example subaccount"
}'/users/subaccount/{subaccount_id}subaccount_id
pathRequiredintegerRequest Example
cURL
curl --request GET \
--url '/users/subaccount/<subaccount_id>' \
--header 'X-API-Key: <value>' \
--header 'ApiSignature: <value>' \
--header 'ApiTimestamp: <value>'/users/subaccount/{subaccount_id}name
stringRequiredcontractId
integerRequiredint32leverage
integerRequireduint16Request Example
application/jsoncURL
curl --request PATCH \
--url '/users/subaccount/<subaccount_id>' \
--header 'X-API-Key: <value>' \
--header 'ApiSignature: <value>' \
--header 'ApiTimestamp: <value>' \
--header 'Content-Type: application/json' \
--data '{
"name": "subaccount new name"
}'/users/subaccount/{subaccount_id}/positionssubaccount_id
pathRequiredintegerRequest Example
cURL
curl --request GET \
--url '/users/subaccount/<subaccount_id>/positions' \
--header 'X-API-Key: <value>' \
--header 'ApiSignature: <value>' \
--header 'ApiTimestamp: <value>'/users/subaccount/{subaccount_id}/transactionssubaccount_id
pathRequiredintegerRequest Example
cURL
curl --request GET \
--url '/users/subaccount/<subaccount_id>/transactions' \
--header 'X-API-Key: <value>' \
--header 'ApiSignature: <value>' \
--header 'ApiTimestamp: <value>'/users/subaccount/{subaccount_id}/transferssubaccount_id
pathRequiredintegerRequest Example
cURL
curl --request GET \
--url '/users/subaccount/<subaccount_id>/transfers' \
--header 'X-API-Key: <value>' \
--header 'ApiSignature: <value>' \
--header 'ApiTimestamp: <value>'/users/subaccount/{subaccount_id}/depositssubaccount_id
pathRequiredintegerRequest Example
cURL
curl --request GET \
--url '/users/subaccount/<subaccount_id>/deposits' \
--header 'X-API-Key: <value>' \
--header 'ApiSignature: <value>' \
--header 'ApiTimestamp: <value>'/users/subaccount/{subaccount_id}/withdrawalssubaccount_id
pathRequiredintegerRequest Example
cURL
curl --request GET \
--url '/users/subaccount/<subaccount_id>/withdrawals' \
--header 'X-API-Key: <value>' \
--header 'ApiSignature: <value>' \
--header 'ApiTimestamp: <value>'/users/subaccount/{subaccount_id}/orderssubaccount_id
pathRequiredintegercreatedBefore
queryOptionalintegerReturns the most recent orders where `created_at < created_before`. If null, returns the most recent orders.
limit
queryOptionalintegerThe maximum number of orders to return. If null, defaults to 100. The maximum is 1000.
Request Example
cURL
curl --request GET \
--url '/users/subaccount/<subaccount_id>/orders' \
--header 'X-API-Key: <value>' \
--header 'ApiSignature: <value>' \
--header 'ApiTimestamp: <value>'/users/subaccount/{subaccount_id}/fillssubaccount_id
pathRequiredintegerstartTime
queryOptionalintegerendTime
queryOptionalintegermarketIds
queryOptionalstringorderIds
queryOptionalstringRequest Example
cURL
curl --request GET \
--url '/users/subaccount/<subaccount_id>/fills' \
--header 'X-API-Key: <value>' \
--header 'ApiSignature: <value>' \
--header 'ApiTimestamp: <value>'/users/fee-estimatesmarketId
integerRequiredint32subaccountId
integerRequiredint64side
stringRequiredpostOnly
stringRequiredquantity
integeruint64NullablequoteQuantity
integeruint64Nullableprice
integerRequireduint64Request Example
application/jsoncURL
curl --request POST \
--url '/users/fee-estimates' \
--header 'X-API-Key: <value>' \
--header 'ApiSignature: <value>' \
--header 'ApiTimestamp: <value>' \
--header 'Content-Type: application/json' \
--data '{
"marketId": 100086,
"postOnly": "Disabled",
"price": 14332,
"quantity": 10,
"side": "Bid",
"subaccountId": 42
}'/users/addresssourceIds
queryOptionalstringnames
queryOptionalstringRequest Example
cURL
curl --request GET \
--url '/users/address' \
--header 'X-API-Key: <value>' \
--header 'ApiSignature: <value>' \
--header 'ApiTimestamp: <value>'/users/address/settingsRequest Example
cURL
curl --request GET \
--url '/users/address/settings' \
--header 'X-API-Key: <value>' \
--header 'ApiSignature: <value>' \
--header 'ApiTimestamp: <value>'/users/withdrawsubaccountId
integerRequireduint64The subaccount to withdraw from.
assetId
integerRequireduint64The asset to withdraw. The network is determined by the asset ID.
amount
integerRequireduint128The amount to withdraw. This is denominated in the smallest unit of the asset (e.g. satoshis for BTC, wei for ETH, lamports for SOL). The amount must be greater than the dust limit for the asset.
destination
stringRequiredThe destination address for the withdrawal.
timestamp
integeruint64verificationKey
stringBase-64 encoded `cube_ov_utils::ov_schema::PublicKey`
signature
stringBase-64 encoded signature of this withdrawal request
Request Example
application/jsoncURL
curl --request POST \
--url '/users/withdraw' \
--header 'X-API-Key: <value>' \
--header 'ApiSignature: <value>' \
--header 'ApiTimestamp: <value>' \
--header 'Content-Type: application/json' \
--data '{
"amount": "220000000000000",
"assetId": 2,
"destination": "0x403244EcfafF17c31e39fc67848d61d9b6637Ee2",
"subaccountId": 8
}'/users/transferfromSubaccountId
integerRequireduint64The subaccount to transfer from.
toSubaccountId
integerRequireduint64The subaccount to transfer to.
assetId
integerRequireduint64The asset to transfer. The network is determined by the asset ID.
amount
integerRequireduint128The amount to transfer. This is denominated in the smallest unit of the asset (e.g. satoshis for BTC, wei for ETH, lamports for SOL). The amount must be greater than the dust limit for the asset.
timestamp
integeruint64verificationKey
stringBase-64 encoded `cube_ov_utils::ov_schema::PublicKey`
signature
stringBase-64 encoded signature of this withdrawal request
Request Example
application/jsoncURL
curl --request POST \
--url '/users/transfer' \
--header 'X-API-Key: <value>' \
--header 'ApiSignature: <value>' \
--header 'ApiTimestamp: <value>' \
--header 'Content-Type: application/json' \
--data '{
"fromSubaccountId": 1,
"toSubaccountId": 1,
"assetId": 1,
"amount": 1
}'