# The Graph API

The Graph API provides detailed information about various financial activities. With the use of this API, you can retrieve data about open interests, deposits, withdraws, open positions, open orders, portfolios, closed positions, and trade activities.

### Base URL

The base URL for all the API endpoints is \*\*<https://api.vela.exchange/graph**.\\>
\
**Example Request Base:**

```
GET https://api.vela.exchange/graph/{ENDPOINT}/{chainId}/{address}
```

### API Endpoints

{% openapi src="/files/xiBDfcNbbZKYZX4flo71" path="/graph/open\_interests/{chainId}" method="get" %}
[openapi.json](https://1356357463-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrN46BgyysObtNusDYaGn%2Fuploads%2FHE2hZdtfivubljzv2V3E%2Fopenapi.json?alt=media\&token=5c3912ef-95b1-4fbf-8284-61dc4dfc3260)
{% endopenapi %}

{% openapi src="/files/xiBDfcNbbZKYZX4flo71" path="/graph/deposits/{chainId}/{address}" method="get" %}
[openapi.json](https://1356357463-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrN46BgyysObtNusDYaGn%2Fuploads%2FHE2hZdtfivubljzv2V3E%2Fopenapi.json?alt=media\&token=5c3912ef-95b1-4fbf-8284-61dc4dfc3260)
{% endopenapi %}

{% openapi src="/files/xiBDfcNbbZKYZX4flo71" path="/graph/withdraws/{chainId}/{address}" method="get" %}
[openapi.json](https://1356357463-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrN46BgyysObtNusDYaGn%2Fuploads%2FHE2hZdtfivubljzv2V3E%2Fopenapi.json?alt=media\&token=5c3912ef-95b1-4fbf-8284-61dc4dfc3260)
{% endopenapi %}

{% openapi src="/files/xiBDfcNbbZKYZX4flo71" path="/graph/open\_positions/{chainId}/{address}" method="get" %}
[openapi.json](https://1356357463-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrN46BgyysObtNusDYaGn%2Fuploads%2FHE2hZdtfivubljzv2V3E%2Fopenapi.json?alt=media\&token=5c3912ef-95b1-4fbf-8284-61dc4dfc3260)
{% endopenapi %}

{% openapi src="/files/xiBDfcNbbZKYZX4flo71" path="/graph/open\_orders/{chainId}/{address}" method="get" %}
[openapi.json](https://1356357463-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrN46BgyysObtNusDYaGn%2Fuploads%2FHE2hZdtfivubljzv2V3E%2Fopenapi.json?alt=media\&token=5c3912ef-95b1-4fbf-8284-61dc4dfc3260)
{% endopenapi %}

{% openapi src="/files/xiBDfcNbbZKYZX4flo71" path="/graph/portfolios/{chainId}/{address}" method="get" %}
[openapi.json](https://1356357463-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrN46BgyysObtNusDYaGn%2Fuploads%2FHE2hZdtfivubljzv2V3E%2Fopenapi.json?alt=media\&token=5c3912ef-95b1-4fbf-8284-61dc4dfc3260)
{% endopenapi %}

{% openapi src="/files/xiBDfcNbbZKYZX4flo71" path="/graph/closed\_positions/{chainId}/{address}" method="get" %}
[openapi.json](https://1356357463-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrN46BgyysObtNusDYaGn%2Fuploads%2FHE2hZdtfivubljzv2V3E%2Fopenapi.json?alt=media\&token=5c3912ef-95b1-4fbf-8284-61dc4dfc3260)
{% endopenapi %}

{% openapi src="/files/xiBDfcNbbZKYZX4flo71" path="/graph/trade\_activities/{chainId}/{address}" method="get" %}
[openapi.json](https://1356357463-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrN46BgyysObtNusDYaGn%2Fuploads%2FHE2hZdtfivubljzv2V3E%2Fopenapi.json?alt=media\&token=5c3912ef-95b1-4fbf-8284-61dc4dfc3260)
{% endopenapi %}

### An example of a request:

```javascript
const axios = require('axios');

let config = {
  method: 'get',
  maxBodyLength: Infinity,
  url: 'https://api.vela.exchange/graph/deposits/42161/0xYourEthereumAddress',  // Update with your chainId and address
  headers: { }
};

axios(config)
.then((response) => {
  console.log(JSON.stringify(response.data));
})
.catch((error) => {
  console.log(error);
});

```

### Errors

Our API uses conventional HTTP response codes to indicate success or failure of an API request. In general, 2xx indicates success, 4xx indicates an error from the client's side, and 5xx indicates an error from the server's side.<br>


---

# 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://docs.vela.exchange/vela-knowledge-base/developers/apis/the-graph-api.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.
