# Exchange Info

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](https://github.com/cubexch/gitbook/blob/main/generated/core/ir_api_30.json)

### Market Definitions

Definitions are [available as JSON](https://api.cube.exchange/ir/v0/markets) 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](/cube-api/order-entry/trade-api.md).

#### Market Status Field

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.

* Markets that are currently active for trading will have a `status` of `1` or `2`.
* Markets that are no longer in use will have a `status` of `3`.

### Authentication Headers

The REST API uses the following HTTP headers for authentication:

* `x-api-key`:\
  The API Key ID, as specified on the [API settings page](https://cube.exchange/settings/api).
  * Each API key has an associated access level, which is determined at the time of key creation.
    * Read access allows only read HTTP methods (GET, HEAD, etc.).
    * Write access permits all HTTP methods.
* `x-api-signature`:\
  The API signature string authenticating this request.
  * The payload to be signed is a 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 an 8-byte little-endian array of bytes.
    * The secret key should be decoded from a hex string into a 32-byte array of bytes.
* `x-api-timestamp`:\
  The timestamp used for signature generation.

### Endpoints, public

{% openapi src="/files/wDap6cXYrhx1z9bI1HKk" path="/markets" method="get" %}
[ir\_api\_30.json](https://398371474-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FlfNM0vNrk7VPr5UKauIS%2Fuploads%2Fgit-blob-c3a6a8ce8a2f5ed579bbdc74b18e6c6626f7c58e%2Fir_api_30.json?alt=media)
{% endopenapi %}

{% openapi src="/files/wDap6cXYrhx1z9bI1HKk" path="/history/klines" method="get" %}
[ir\_api\_30.json](https://398371474-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FlfNM0vNrk7VPr5UKauIS%2Fuploads%2Fgit-blob-c3a6a8ce8a2f5ed579bbdc74b18e6c6626f7c58e%2Fir_api_30.json?alt=media)
{% endopenapi %}

### Endpoints, authentication required

Endpoints in this section require [REST Authentication headers](#authentication-headers).

{% openapi src="/files/wDap6cXYrhx1z9bI1HKk" path="/users/check" method="get" %}
[ir\_api\_30.json](https://398371474-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FlfNM0vNrk7VPr5UKauIS%2Fuploads%2Fgit-blob-c3a6a8ce8a2f5ed579bbdc74b18e6c6626f7c58e%2Fir_api_30.json?alt=media)
{% endopenapi %}

{% openapi src="/files/wDap6cXYrhx1z9bI1HKk" path="/users/apikeys" method="post" %}
[ir\_api\_30.json](https://398371474-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FlfNM0vNrk7VPr5UKauIS%2Fuploads%2Fgit-blob-c3a6a8ce8a2f5ed579bbdc74b18e6c6626f7c58e%2Fir_api_30.json?alt=media)
{% endopenapi %}

{% openapi src="/files/wDap6cXYrhx1z9bI1HKk" path="/users/apikeys/{api\_key}" method="delete" %}
[ir\_api\_30.json](https://398371474-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FlfNM0vNrk7VPr5UKauIS%2Fuploads%2Fgit-blob-c3a6a8ce8a2f5ed579bbdc74b18e6c6626f7c58e%2Fir_api_30.json?alt=media)
{% endopenapi %}

{% openapi src="/files/wDap6cXYrhx1z9bI1HKk" path="/users/subaccounts" method="get" %}
[ir\_api\_30.json](https://398371474-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FlfNM0vNrk7VPr5UKauIS%2Fuploads%2Fgit-blob-c3a6a8ce8a2f5ed579bbdc74b18e6c6626f7c58e%2Fir_api_30.json?alt=media)
{% endopenapi %}

{% openapi src="/files/wDap6cXYrhx1z9bI1HKk" path="/users/subaccounts" method="post" %}
[ir\_api\_30.json](https://398371474-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FlfNM0vNrk7VPr5UKauIS%2Fuploads%2Fgit-blob-c3a6a8ce8a2f5ed579bbdc74b18e6c6626f7c58e%2Fir_api_30.json?alt=media)
{% endopenapi %}

{% openapi src="/files/wDap6cXYrhx1z9bI1HKk" path="/users/subaccount/{subaccount\_id}" method="get" %}
[ir\_api\_30.json](https://398371474-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FlfNM0vNrk7VPr5UKauIS%2Fuploads%2Fgit-blob-c3a6a8ce8a2f5ed579bbdc74b18e6c6626f7c58e%2Fir_api_30.json?alt=media)
{% endopenapi %}

{% openapi src="/files/wDap6cXYrhx1z9bI1HKk" path="/users/subaccount/{subaccount\_id}" method="patch" %}
[ir\_api\_30.json](https://398371474-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FlfNM0vNrk7VPr5UKauIS%2Fuploads%2Fgit-blob-c3a6a8ce8a2f5ed579bbdc74b18e6c6626f7c58e%2Fir_api_30.json?alt=media)
{% endopenapi %}

{% openapi src="/files/wDap6cXYrhx1z9bI1HKk" path="/users/subaccount/{subaccount\_id}/positions" method="get" %}
[ir\_api\_30.json](https://398371474-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FlfNM0vNrk7VPr5UKauIS%2Fuploads%2Fgit-blob-c3a6a8ce8a2f5ed579bbdc74b18e6c6626f7c58e%2Fir_api_30.json?alt=media)
{% endopenapi %}

{% openapi src="/files/wDap6cXYrhx1z9bI1HKk" path="/users/subaccount/{subaccount\_id}/transactions" method="get" %}
[ir\_api\_30.json](https://398371474-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FlfNM0vNrk7VPr5UKauIS%2Fuploads%2Fgit-blob-c3a6a8ce8a2f5ed579bbdc74b18e6c6626f7c58e%2Fir_api_30.json?alt=media)
{% endopenapi %}

{% openapi src="/files/wDap6cXYrhx1z9bI1HKk" path="/users/subaccount/{subaccount\_id}/transfers" method="get" %}
[ir\_api\_30.json](https://398371474-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FlfNM0vNrk7VPr5UKauIS%2Fuploads%2Fgit-blob-c3a6a8ce8a2f5ed579bbdc74b18e6c6626f7c58e%2Fir_api_30.json?alt=media)
{% endopenapi %}

{% openapi src="/files/wDap6cXYrhx1z9bI1HKk" path="/users/subaccount/{subaccount\_id}/deposits" method="get" %}
[ir\_api\_30.json](https://398371474-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FlfNM0vNrk7VPr5UKauIS%2Fuploads%2Fgit-blob-c3a6a8ce8a2f5ed579bbdc74b18e6c6626f7c58e%2Fir_api_30.json?alt=media)
{% endopenapi %}

{% openapi src="/files/wDap6cXYrhx1z9bI1HKk" path="/users/subaccount/{subaccount\_id}/withdrawals" method="get" %}
[ir\_api\_30.json](https://398371474-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FlfNM0vNrk7VPr5UKauIS%2Fuploads%2Fgit-blob-c3a6a8ce8a2f5ed579bbdc74b18e6c6626f7c58e%2Fir_api_30.json?alt=media)
{% endopenapi %}

{% openapi src="/files/wDap6cXYrhx1z9bI1HKk" path="/users/subaccount/{subaccount\_id}/orders" method="get" %}
[ir\_api\_30.json](https://398371474-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FlfNM0vNrk7VPr5UKauIS%2Fuploads%2Fgit-blob-c3a6a8ce8a2f5ed579bbdc74b18e6c6626f7c58e%2Fir_api_30.json?alt=media)
{% endopenapi %}

{% openapi src="/files/wDap6cXYrhx1z9bI1HKk" path="/users/subaccount/{subaccount\_id}/fills" method="get" %}
[ir\_api\_30.json](https://398371474-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FlfNM0vNrk7VPr5UKauIS%2Fuploads%2Fgit-blob-c3a6a8ce8a2f5ed579bbdc74b18e6c6626f7c58e%2Fir_api_30.json?alt=media)
{% endopenapi %}

{% openapi src="/files/wDap6cXYrhx1z9bI1HKk" path="/users/fee-estimates" method="post" %}
[ir\_api\_30.json](https://398371474-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FlfNM0vNrk7VPr5UKauIS%2Fuploads%2Fgit-blob-c3a6a8ce8a2f5ed579bbdc74b18e6c6626f7c58e%2Fir_api_30.json?alt=media)
{% endopenapi %}

{% openapi src="/files/wDap6cXYrhx1z9bI1HKk" path="/users/address" method="get" %}
[ir\_api\_30.json](https://398371474-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FlfNM0vNrk7VPr5UKauIS%2Fuploads%2Fgit-blob-c3a6a8ce8a2f5ed579bbdc74b18e6c6626f7c58e%2Fir_api_30.json?alt=media)
{% endopenapi %}

{% openapi src="/files/wDap6cXYrhx1z9bI1HKk" path="/users/address/settings" method="get" %}
[ir\_api\_30.json](https://398371474-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FlfNM0vNrk7VPr5UKauIS%2Fuploads%2Fgit-blob-c3a6a8ce8a2f5ed579bbdc74b18e6c6626f7c58e%2Fir_api_30.json?alt=media)
{% endopenapi %}

{% openapi src="/files/wDap6cXYrhx1z9bI1HKk" path="/users/withdraw" method="post" %}
[ir\_api\_30.json](https://398371474-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FlfNM0vNrk7VPr5UKauIS%2Fuploads%2Fgit-blob-c3a6a8ce8a2f5ed579bbdc74b18e6c6626f7c58e%2Fir_api_30.json?alt=media)
{% endopenapi %}

{% openapi src="/files/wDap6cXYrhx1z9bI1HKk" path="/users/transfer" method="post" %}
[ir\_api\_30.json](https://398371474-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FlfNM0vNrk7VPr5UKauIS%2Fuploads%2Fgit-blob-c3a6a8ce8a2f5ed579bbdc74b18e6c6626f7c58e%2Fir_api_30.json?alt=media)
{% endopenapi %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://cubexch.gitbook.io/cube-api/exchange-info.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
