# Examples

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

<pre class="language-javascript"><code class="lang-javascript"><strong>// Define constants
</strong>const API_URL = 'https://pro.circular.bot/market/tokens';
const API_KEY = 'your-api-key'; // Replace by your API Key

const requestOptions = {
    headers: {
        'Content-Type': 'application/json',
        'x-api-key': API_KEY,
    },
    params: {
        maxTokensList: 10,
        maxTimeRange: 900,
        excludeTokens: [
            "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v", // USDC
            "Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB"  // USDT
        ].join(','),
        provider: "JITO", // Optional
        token: "So11111111111111111111111111111111111111112",
    },
};

const getTokensMintList = async () => {
    try {
        const response = await axios.get(API_URL, requestOptions);

        console.log('Mints: ', response?.data);
    } catch (error) {
        console.log('Error: ', error?.response?.data);
    }
};

getTokensMintList();
</code></pre>

{% endtab %}

{% tab title="Typescript" %}

```typescript
// Define constants
const API_URL: string = 'https://pro.circular.bot/market/tokens';
const API_KEY: string = 'your-api-key'; // Replace with your API Key

// Define interfaces for request options
interface RequestOptions {
    headers: {
        'Content-Type': string;
        'x-api-key': string;
    };
    params: {
        maxTokensList: number;
        maxTimeRange: number;
        excludeTokens: string; // Comma-separated string of tokens
        token: string;
        provider?: string;
    };
}

// Define the response structure (adjust as needed)
interface TokenMintListResponse {
    mints: string[]; // Assuming the response contains an array of mints
}

// Request options
const requestOptions: RequestOptions = {
    headers: {
        'Content-Type': 'application/json',
        'x-api-key': API_KEY,
    },
    params: {
        maxTokensList: 10,
        maxTimeRange: 900,
        excludeTokens: [
            "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v", // USDC
            "Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB", // USDT
        ].join(','), // Convert array to comma-separated string
        provider: "JITO", // Optional
        token: "So11111111111111111111111111111111111111112",
    },
};

// Function to fetch tokens mint list
const getTokensMintList = async (): Promise<void> => {
    try {
        const response: AxiosResponse<TokenMintListResponse> = await axios.get(
            API_URL,
            requestOptions as AxiosRequestConfig
        );

        console.log('Mints:', response.data);
    } catch (error: any) {
        console.error('Error:', error?.response?.data || error.message);
    }
};

// Execute the function
getTokensMintList();
```

{% endtab %}

{% tab title="Python" %}

```python
# Define constants
API_URL = "https://pro.circular.bot/market/tokens"
API_KEY = "your-api-key"  # Replace with your API Key

# Request headers and parameters
headers = {
    "Content-Type": "application/json",
    "x-api-key": API_KEY,
}

params = {
    "maxTokensList": 10,
    "maxTimeRange": 900,
    "excludeTokens": ",".join([
        "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",  # USDC
        "Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB",  # USDT
    ]),
    "provider": "JITO",
    "token": "So11111111111111111111111111111111111111112",
}

# Function to fetch tokens mint list
def get_tokens_mint_list():
    try:
        response = requests.get(API_URL, headers=headers, params=params)
        response.raise_for_status()  # Raise an exception for HTTP errors

        print("Mints:", response.json())
    except requests.exceptions.RequestException as error:
        print("Error:", error.response.json() if error.response else str(error))

# Execute the function
get_tokens_mint_list()
```

{% endtab %}

{% tab title="Rust" %}

```rust
// Define constants
const API_URL: &str = "https://pro.circular.bot/market/tokens";
const API_KEY: &str = "your-api-key"; // Replace with your API key

// Define the response structure
#[derive(Deserialize, Debug)]
struct TokenMintListResponse {
    mints: Vec<String>, // Assuming the response contains an array of mints
}

// Function to fetch tokens mint list
async fn get_tokens_mint_list() -> Result<(), Box<dyn std::error::Error>> {
    // Create a client
    let client = reqwest::Client::new();

    // Set up headers
    let mut headers = HeaderMap::new();
    headers.insert(CONTENT_TYPE, HeaderValue::from_static("application/json"));
    headers.insert("x-api-key", HeaderValue::from_static(API_KEY));

    // Define parameters
    let exclude_tokens = vec![
        "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v", // USDC
        "Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB", // USDT
    ]
    .join(","); // Convert array to comma-separated string

    let query_params = [
        ("maxTokensList", "10"),
        ("maxTimeRange", "900"),
        ("excludeTokens", &exclude_tokens),
        ("provider", "JITO"),
        ("token", "So11111111111111111111111111111111111111112"),
    ];

    // Send the GET request
    let response = client
        .get(API_URL)
        .headers(headers)
        .query(&query_params)
        .send()
        .await?;

    if response.status().is_success() {
        let mints: TokenMintListResponse = response.json().await?;
        println!("Mints: {:#?}", mints);
    } else {
        eprintln!(
            "Error: {}",
            response.text().await.unwrap_or_else(|_| "Unknown error".to_string())
        );
    }

    Ok(())
}

// Main function
#[tokio::main]
async fn main() {
    if let Err(err) = get_tokens_mint_list().await {
        eprintln!("An error occurred: {}", err);
    }
}
```

{% endtab %}
{% endtabs %}


---

# 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.circular.bot/circular-docs/api/tokens/examples.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.
