# Get CoinGecko Events

DTAO swap events within a block range.

_Source: https://beta.taostats.io/docs/new/coingecko/get-coingecko-events_

_Last reviewed: 2026-10-07_

```http
GET https://api.taostats.io/v1/coingecko/events
```

Requires an API key in the `Authorization` header.

DTAO swap events within a block range.

## Try it

Try this request in the browser on the HTML version of this page, or use the code samples below.

### Code samples

**cURL**

```bash
curl -H "Authorization: <YOUR_API_KEY>" \
  "https://api.taostats.io/v1/coingecko/events"
```

**JavaScript**

```js
const response = await fetch('https://api.taostats.io/v1/coingecko/events', {
  headers: {
    Authorization: '<YOUR_API_KEY>',
  },
});
const data = await response.json();
```

**Python**

```python
import requests

response = requests.get(
    "https://api.taostats.io/v1/coingecko/events",
    headers={"Authorization": "<YOUR_API_KEY>"},
)
data = response.json()
```

## Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `fromBlock` | query | `integer (int32)` | Yes | Start block (inclusive). |
| `toBlock` | query | `integer (int32)` | Yes | End block (inclusive, at most 20 blocks from `fromBlock`). |

## Responses

### `200` — Swap events within the block range

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `events` | `array` | Yes |  |
| `events[].asset0In` | `string, nullable` | Yes |  |
| `events[].asset0Out` | `string, nullable` | Yes |  |
| `events[].asset1In` | `string, nullable` | Yes |  |
| `events[].asset1Out` | `string, nullable` | Yes |  |
| `events[].block` | `object` | Yes | Block metadata for a CoinGecko event. |
| `events[].block.blockNumber` | `integer (int32)` | Yes |  |
| `events[].block.blockTimestamp` | `integer (int64)` | Yes |  |
| `events[].eventIndex` | `integer (int32)` | Yes |  |
| `events[].eventType` | `string` | Yes |  |
| `events[].maker` | `string` | Yes |  |
| `events[].pairId` | `string` | Yes |  |
| `events[].priceNative` | `string` | Yes |  |
| `events[].reserves` | `object` | Yes | Pool reserves at the event's block, in whole tokens (decimal strings). |
| `events[].reserves.asset0` | `string` | Yes |  |
| `events[].reserves.asset1` | `string` | Yes |  |
| `events[].txnId` | `string` | Yes |  |
| `events[].txnIndex` | `integer (int32)` | Yes |  |

### `400` — Invalid query parameter

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `message` | `string` | Yes | Plain-english message describing the failure from the caller's perspective. |
| `status_code` | `integer (int32)` | Yes | HTTP status code (mirrored in the response status line for convenience). |

### `500` — Internal server error

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `message` | `string` | Yes | Plain-english message describing the failure from the caller's perspective. |
| `status_code` | `integer (int32)` | Yes | HTTP status code (mirrored in the response status line for convenience). |

Every request needs an `Authorization` header holding your API key — see [Getting started with the Taostats API](https://beta.taostats.io/docs/start-here/getting-started-with-taostats-api).
