# Velar API

Velar provides public APIs for developers to access various data points across the protocol. These endpoints enable seamless integration of Velar data into third-party applications, providing real-time and historical information on tokens, prices, pools, and supply metrics.

### Base URL

`https://api.velar.co`

### Available Endpoints

#### Get All Tokens Data

Retrieve details of all available tokens on the DEX.

```
GET /tickers
```

#### Get Token Details

Retrieve details for a specific token or all tokens on the DEX.

```
GET /tokens
GET /tokens?symbol={symbol}
```

Parameters:

* `symbol` (optional): Token symbol (e.g., WELSH, ROO, VELAR). Use 'all' to get all tokens.

#### Get Circulating Supply

Retrieve circulating supply information for VELAR token.

```
GET /circulating-supply
```

#### Get Current Prices

Retrieve current price data for tokens.

```
GET /prices
```

#### Get Price by Contract Address

Retrieve price information for a specific token contract.

```
GET /prices/:contractAddress
```

Parameters:

* `contractAddress`: The contract address of the token

#### Get Historical Price Data

Retrieve historical price data for a specific token with customizable time intervals.

```
GET /prices/historical/:contractAddress?interval={interval}
```

Parameters:

* `contractAddress`: The contract address of the token
* `interval`: Time interval for the historical data. Available options:
  * `hour`: Hourly data points
  * `week`: Weekly data points
  * `month`: Monthly data points
  * `year`: Yearly data points

#### Get Pool Data

Retrieve information about liquidity pools on Velar.

```
GET /pools
```

#### Get Pool Data by LP Token Address

Retrieve specific pool information using LP token contract address.

```
GET /pools/:lpTokenContractAddress
```

Parameters:

* `lpTokenContractAddress`: The contract address of the LP token

#### Get Pool Data by Token Pair

Retrieve pool information using the addresses of tokens in the pair.

```
GET /pools/:poolToken0ContractAddress/:poolToken1ContractAddress
GET /pools/:poolToken1ContractAddress/:poolToken0ContractAddress
```

Parameters:

* `poolToken0ContractAddress`: The contract address of the first token in the pair
* `poolToken1ContractAddress`: The contract address of the second token in the pair

### Integration Example

```javascript
// Example: Fetching historical price data for a token
const contractAddress = "0x...";
const response = await fetch(`https://api.velar.co/prices/historical/${contractAddress}?interval=week`);
const data = await response.json();

// Example: Fetching sBTC pool data
const sbtcPoolResponse = await fetch(`https://api.velar.co/pools/SM3VDXK3WZZSA84XXFKAFAF15NNZX32CTSG82JFQ4.sbtc-token/SP1Y5YSTAHZ88XYK1VPDH24GY0HPX5J4JECTMY4A1.wstx`);
const sbtcPoolData = await sbtcPoolResponse.json();
```

### Building with Velar

By leveraging these developer resources, you can build powerful applications and integrations on top of the Velar protocol, enhancing the overall ecosystem and user experience. The API provides comprehensive data access for:

* Token information and metrics
* Real-time price feeds
* Historical price analysis
* Supply statistics
* Market data integration
* Pool and liquidity data

For support or questions about the API, please reach out to our developer community or consult our additional documentation resources.


---

# 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.velar.com/velar/developers/velar-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.
