# Candle Chart Data

### Endpoint

GET /v1/tokens/candle-chart?tokenId=\<TOKEN\_ID>\&days=\<DAYS>\&interval=\<INTERVAL>

### Description

This endpoint returns data for a given token that can be used to create a candlestick chart.&#x20;

### Query String Parameters

* tokenId (required): A string in the format \<TOKEN\_CONTRACT\_ADDRESS>:\<NETWORK\_ID> that identifies the token to look up.
* days (required): An integer between 1 and 90, inclusive, that specifies the number of days of data to include in the response.
* interval (required): The interval at which you want the data points to be grouped in minutes. Accepted values are 5, 15, 30, and 60.

### Headers

* x-api-key (required): A valid API key.

### Example

```rust
curl -X GET 'https://api.lynxcrypto.app/v1/tokens/candle-chart?tokenId=0x52ec25e58a9e144ff002625bb2aa58cc6da24cb2:56&days=7&interval=15'
-H 'x-api-key: <YOUR_API_KEY>'
```

### Response

```json
[
    {
        "_id": {
            "token_id": "0x52ec25e58a9e144ff002625bb2aa58cc6da24cb2:56",
            "date": "2023-01-09T08:00:00.000Z"
        },
        "h": 0.0014347623738461851,
        "l": 0.0014293900383247492,
        "o": 0.0014347623738461851,
        "c": 0.0014293900383247492,
        "v": 97.61626900558088
    },
    {
        "_id": {
            "token_id": "0x52ec25e58a9e144ff002625bb2aa58cc6da24cb2:56",
            "date": "2023-01-09T09:00:00.000Z"
        },
        "h": 0.0014340568559150129,
        "l": 0.001426031539863773,
        "o": 0.001426031539863773,
        "c": 0.0014340568559150129,
        "v": 97.60990218928677
    },
    {
        "_id": {
            "token_id": "0x52ec25e58a9e144ff002625bb2aa58cc6da24cb2:56",
            "date": "2023-01-09T10:00:00.000Z"
        },
        "h": 0.0014404419700617668,
        "l": 0.0014267965584167693,
        "o": 0.0014267965584167693,
        "c": 0.0014404419700617668,
        "v": 114.30178608781273
    },

]
```

### Response Object

* `h`: The highest price over the interval.
* `l`: The lowest price over the interval.
* `o`: The opening price for the interval (first data point).
* `c`: The closing price for the interval (last data point).
* `v`: The volume of the token over the interval.

### Response Codes

* `200`: Success. Returns the USD price for the given token.
* `400`: Bad Request. The tokenId, interval, or days query string parameter is not provided or days is greater than 90 or less than 1.
* 403: Forbidden. The x-api-key header is not provided or is invalid.
* `404`: Not Found. No price updates found within the given time range
