---
description: Obtain price feed, market data, and historical data of crypto assets
---

# CoinGecko

Try it in the Widget Center

Click this [url](40-coingecko) to try this widget and copy the Pro Config template.

## Usage

### Get the Coin ID

<mark style="color:green;">`action`</mark> `coin_id`

**Input Parameters**

<table><thead><tr><th>Name</th><th>Type</th><th>Description</th><th>Default</th><th data-type="checkbox">Required</th></tr></thead><tbody><tr><td>action</td><td><code>string</code></td><td>The action you want to perform</td><td>coin_id</td><td>true</td></tr><tr><td>name</td><td><code>string</code></td><td>The name of the coin. Required if you search coin by name.</td><td></td><td>true</td></tr></tbody></table>

**Output Parameters**

<table><thead><tr><th width="146">Name</th><th>Type</th><th>Description</th><th>File Type</th></tr></thead><tbody><tr><td>data</td><td><code>object</code></td><td>The output of coingecko API.</td><td></td></tr></tbody></table>

#### Output Example

{% code overflow="wrap" %}
```json
{
  "status": "SUCCESS",
  "created_at": "2024-04-25T02:58:32.161881",
  "started_at": "2024-04-25T02:58:36.511598",
  "result": {
    "data": {
      "id": "bitcoin",
      "symbol": "btc",
      "name": "Bitcoin"
    }
  },
  "finished_at": "2024-04-25T02:58:38.489827"
}
```
{% endcode %}

### Get the Coin Data by ID

<mark style="color:green;">`action`</mark> `coin_data_by_id`

**Input Parameters**

<table><thead><tr><th>Name</th><th>Type</th><th>Description</th><th width="160">Default</th><th data-type="checkbox">Required</th></tr></thead><tbody><tr><td>action</td><td><code>string</code></td><td>The action you want to perform</td><td>coin_data_by_id</td><td>true</td></tr><tr><td>id</td><td><code>string</code></td><td>The id of the coin.</td><td></td><td>true</td></tr></tbody></table>

**Output Parameters**

<table><thead><tr><th width="146">Name</th><th>Type</th><th>Description</th><th>File Type</th></tr></thead><tbody><tr><td>data</td><td><code>object</code></td><td>The output of coingecko API.</td><td></td></tr></tbody></table>

#### Output Example

```json

{
    "status": "SUCCESS",
    "created_at": "2024-04-25T03:12:37.276366",
    "started_at": "2024-04-25T03:12:39.650554",
    "result": {
      "data": {
        "id": "bitcoin",
        "symbol": "btc",
        "name": "Bitcoin",
        "web_slug": "bitcoin",
        "asset_platform_id": null,
        "*****"
      }
    },
    "finished_at": "2024-04-25T03:12:41.767455"
}
```

### Get the Coin Ticker by ID

<mark style="color:green;">`action`</mark> `coin_ticker_by_id`

**Input Parameters**

<table><thead><tr><th>Name</th><th>Type</th><th>Description</th><th width="160">Default</th><th data-type="checkbox">Required</th></tr></thead><tbody><tr><td>action</td><td><code>string</code></td><td>The action you want to perform</td><td>coin_ticker_by_id</td><td>true</td></tr><tr><td>id</td><td><code>string</code></td><td>The id of the coin.</td><td></td><td>true</td></tr></tbody></table>

**Output Parameters**

<table><thead><tr><th width="146">Name</th><th>Type</th><th>Description</th><th>File Type</th></tr></thead><tbody><tr><td>data</td><td><code>object</code></td><td>The output of coingecko API.</td><td></td></tr></tbody></table>

#### Output Example

```json
{
    "status": "SUCCESS",
    "created_at": "2024-04-25T03:21:00.040066",
    "started_at": "2024-04-25T03:21:03.711204",
    "result": {
      "data": {
        "name": "Bitcoin",
        "tickers": ["***"]
      }
    },
    "finished_at": "2024-04-25T03:21:06.378630"
}
```

### Advanced

**Input Parameters**

<table><thead><tr><th>Name</th><th>Type</th><th>Description</th><th>Default</th><th data-type="checkbox">Required</th></tr></thead><tbody><tr><td>endpoint</td><td><code>string</code></td><td>The endpoint url of Coingecko, please add the path params in the endpoint</td><td>https://pro-api.coingecko.com/api/v3/coins/id</td><td>true</td></tr><tr><td>query_param</td><td><code>string</code></td><td>Dict type of query params</td><td></td><td>false</td></tr></tbody></table>

## Detailed Guidelines

> Note: You can test this feature in the widget center, but please be cautious not to output excessive information on the website. Some cryptocurrency data can be extensive and may cause your website to become unresponsive or crash.

* Main parameter of Coins:
  * `task_type` , you can use the `coin_id` to obtain the identifier of your chosen cryptocurrency. Then, utilize other functions named `xx_by_id` to fetch specific details about that cryptocurrency.
    * When using `coin_id`, you should provide the name of the coin as a parameter. For `xx_by_id` functions, you should supply the coin's ID as the parameter.
* Main parameter of Advanced
  * `endpoint`, refer to the [CoinGecko API documentation](https://docs.coingecko.com/reference/introduction) and use the API interface as the endpoint. Be sure to include the path parameters in the endpoint.&#x20;
  * For the query parameters, add them as a dictionary, following the format described in the [CoinGecko API documentation](https://docs.coingecko.com/reference/introduction)
* Some examples

<figure><img src="https://2005308380-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FSXDXcSB3MMwWmh9UaOI6%2Fuploads%2FBDa7sSLIHyrYFe9IWyvc%2Fimage.png?alt=media&#x26;token=f5b77156-bfe9-486a-a7e9-7bf1870a88db" alt=""><figcaption></figcaption></figure>

<figure><img src="https://2005308380-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FSXDXcSB3MMwWmh9UaOI6%2Fuploads%2F66ZCuvmZfgu8umDkEWQx%2Fimage.png?alt=media&#x26;token=f8ece7cd-a903-4add-bd5b-096c101fcfcd" alt=""><figcaption></figcaption></figure>

