# Get Trending Tokens

Identify the hottest Solana tokens over a recent timeframe. Use the **Trend** endpoint to retrieve a ranked list of tokens sorted by activity, volume, or momentum.

**Endpoint**

```
GET https://api.coinvera.io/api/v1/trend
```

**Authentication**\
Include your API key in the request header:

```
x-api-key: <YOUR_API_KEY>
```

**Query Parameters**

| Parameter | Type   | Required | Description                                           |
| --------- | ------ | -------- | ----------------------------------------------------- |
| `hour`    | number | ✅        | Lookback window in hours (e.g. `1`, `6`, `24`).       |
| `limit`   | number | ✅        | Maximum number of tokens to return (e.g. `10`, `50`). |

**Direct URL Example**

```
https://api.coinvera.io/api/v1/trend?hour=6&limit=20
```

*…plus your `x-api-key` header.*

***

**Code Examples**

{% tabs %}
{% tab title="Nodejs" %}

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

const x_api_key = "";

// Configuration
const hour = 24;  // Change this to 1, 6, 12, or 24 hours
const limit = 10; // Number of results to return

async function getTrend(hour, limit) {
    try {
        const url = `https://api.coinvera.io/api/v1/trend?x-api-key=${x_api_key}&hour=${hour}&limit=${limit}`;
        const response = await axios.get(url);
        return { hour, limit, ...response.data };
    } catch (err) {
        return { hour, limit, error: err.message };
    }
}

async function fetchTrend() {
    const result = await getTrend(hour, limit);
    
    if (result.error) {
        console.log(`Error for ${result.hour}h trend (limit: ${result.limit}): ${result.error}`);
    } else {
        console.log(`Trend data for ${result.hour}h (limit: ${result.limit}):`);
        console.log(JSON.stringify(result, null, 2));
    }
}

fetchTrend();
```

{% endtab %}

{% tab title="Python" %}

```python
import requests
import json

x_api_key = ""

# Configuration
hour = 24  # Change this to 1, 6, 12, or 24 hours
limit = 10  # Number of results to return

def get_trend(hour, limit):
    try:
        url = f"https://api.coinvera.io/api/v1/trend?x-api-key={x_api_key}&hour={hour}&limit={limit}"
        response = requests.get(url)
        response.raise_for_status()  # Raises an HTTPError for bad responses
        
        data = response.json()
        return {"hour": hour, "limit": limit, **data}
    except Exception as err:
        return {"hour": hour, "limit": limit, "error": str(err)}

def fetch_trend():
    result = get_trend(hour, limit)
    
    if "error" in result:
        print(f"Error for {result['hour']}h trend (limit: {result['limit']}): {result['error']}")
    else:
        print(f"Trend data for {result['hour']}h (limit: {result['limit']}):")
        print(json.dumps(result, indent=2))

# Run the function
fetch_trend()
```

{% endtab %}

{% tab title="Go" %}

```go
package main

import (
	"encoding/json"
	"fmt"
	"io"
	"net/http"
	"strconv"
)

const xAPIKey = ""

// Configuration
const hour = 24 // Change this to 1, 6, 12, or 24 hours
const limit = 10 // Number of results to return

type TrendResult struct {
	Hour  int         `json:"hour"`
	Limit int         `json:"limit"`
	Data  interface{} `json:"data,omitempty"`
	Error string      `json:"error,omitempty"`
}

func getTrend(hour, limit int) TrendResult {
	url := fmt.Sprintf("https://api.coinvera.io/api/v1/trend?x-api-key=%s&hour=%d&limit=%d", 
		xAPIKey, hour, limit)

	resp, err := http.Get(url)
	if err != nil {
		return TrendResult{
			Hour:  hour,
			Limit: limit,
			Error: err.Error(),
		}
	}
	defer resp.Body.Close()

	body, err := io.ReadAll(resp.Body)
	if err != nil {
		return TrendResult{
			Hour:  hour,
			Limit: limit,
			Error: err.Error(),
		}
	}

	// Check for HTTP errors
	if resp.StatusCode != http.StatusOK {
		return TrendResult{
			Hour:  hour,
			Limit: limit,
			Error: fmt.Sprintf("HTTP %d: %s", resp.StatusCode, string(body)),
		}
	}

	var data interface{}
	if err := json.Unmarshal(body, &data); err != nil {
		return TrendResult{
			Hour:  hour,
			Limit: limit,
			Error: err.Error(),
		}
	}

	return TrendResult{
		Hour:  hour,
		Limit: limit,
		Data:  data,
	}
}

func fetchTrend() {
	result := getTrend(hour, limit)

	if result.Error != "" {
		fmt.Printf("Error for %dh trend (limit: %d): %s\n", result.Hour, result.Limit, result.Error)
	} else {
		fmt.Printf("Trend data for %dh (limit: %d):\n", result.Hour, result.Limit)
		jsonData, _ := json.MarshalIndent(result.Data, "", "  ")
		fmt.Println(string(jsonData))
	}
}

func main() {
	fetchTrend()
}
```

{% endtab %}
{% endtabs %}

**Example Response**

```json
{
  "0": {
    "buy_volume_usd": 264171537.95575368,
    "latest_price": 0.0030217195692742236,
    "net_inflow_usd": 255050220.33141094,
    "sell_volume_usd": 9121317.624342749,
    "token_address": "8jVcgXXUReoiFCDzDMEhftCvA7HWqLX6rNmZ6AxLpump",
    "token_symbol": "stockcoin"
  },
  "1": {
    "buy_volume_usd": 182223999.0542052,
    "latest_price": 0.000013589051139642012,
    "net_inflow_usd": 180950650.5435902,
    "sell_volume_usd": 1273348.510615017,
    "token_address": "Hz7NdWK3aX5asNLywHDkQxgpXC38nTVDLPpaTGd7pump",
    "token_symbol": "$1 stock"
  },
  "2": {
    "buy_volume_usd": 123156467.66647036,
    "latest_price": 0.006432619799014278,
    "net_inflow_usd": 111710199.7289238,
    "sell_volume_usd": 11446267.937546562,
    "token_address": "55KrNjWHrkgxCzTLvcgaKYDxaopuxZK8vETi1CJNpump",
    "token_symbol": "invest"
  },
  "3": {
    "buy_volume_usd": 102657933.11458473,
    "latest_price": 0.00004347762674059343,
    "net_inflow_usd": 95527427.26541495,
    "sell_volume_usd": 7130505.849169775,
    "token_address": "9mfqn25C1nMVwn7YjxdJFvvTqichHFf8aR6vzNzPSodh",
    "token_symbol": "commodity"
  },
  "4": {
    "buy_volume_usd": 89250429.5964523,
    "latest_price": 0.00005535670512988365,
    "net_inflow_usd": 84827414.22617784,
    "sell_volume_usd": 4423015.370274453,
    "token_address": "HYJ9CKdVBwqYnZTEkEgWoyZJikWJ6icQKtaiNRgXpump",
    "token_symbol": "GAYMAN"
  },
  "5": {
    "buy_volume_usd": 63629733.73753922,
    "latest_price": 0.00013600745164074442,
    "net_inflow_usd": 61013882.9096696,
    "sell_volume_usd": 2615850.8278696146,
    "token_address": "8wvLsACsR3owhGzmLLHTgh2waW2vKNtVYWDs9cCopump",
    "token_symbol": "memestock"
  },
  "6": {
    "buy_volume_usd": 52124966.063705124,
    "latest_price": 0.00031610543953291745,
    "net_inflow_usd": 48378200.87247831,
    "sell_volume_usd": 3746765.1912268195,
    "token_address": "7CLBRXBp534WyZfgMDnR3E4VyedeHVPFQe3P1EHDpump",
    "token_symbol": "STONKS"
  },
  "7": {
    "buy_volume_usd": 43201371.32219729,
    "latest_price": 0.0021707478800632187,
    "net_inflow_usd": 37071648.85030203,
    "sell_volume_usd": 6129722.471895258,
    "token_address": "39zSVsSHFqNhARbVh6n8ZF78nCmhV3gSg8D39xhBNe73",
    "token_symbol": "AP"
  },
  "8": {
    "buy_volume_usd": 36782092.849714845,
    "latest_price": 0.000011710087778822374,
    "net_inflow_usd": 35871217.70677651,
    "sell_volume_usd": 910875.1429383396,
    "token_address": "4cjmXiM4Mg7F5Q5mXJF4Xn9y36wY9xLHK5nzcN4qpump",
    "token_symbol": "Microsoft"
  },
  "9": {
    "buy_volume_usd": 35514986.57322835,
    "latest_price": 0.000006468656907085074,
    "net_inflow_usd": 34865718.1163198,
    "sell_volume_usd": 649268.4569085517,
    "token_address": "5hYQrmP7yPZ6KMnmRbs2waU729abjx3yjuPH3npkpump",
    "token_symbol": "PEABODY"
  },
  "hour": 24,
  "limit": 10
}
```

***

> **Tip:** Try different `hour` windows to capture short-term spikes or longer-term trends, and adjust `limit` to tailor the size of your results list.


---

# 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.coinvera.io/integration/solana/get-trending-tokens.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.
