> For the complete documentation index, see [llms.txt](https://docs.agentipy.fun/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.agentipy.fun/tools/get-token-data.md).

# Get Token Data

The `Get Token Data` tool, part of AgentiPy, allows users to retrieve information about SPL tokens on the Solana blockchain. It can fetch token details using either the token's mint address (from Jupiter's token list) or its ticker symbol (from DexScreener).

## Functionality

This tool is implemented in the `TokenDataManager` class.

### Key Methods:

* `get_token_data_by_address(mint: Pubkey) -> Optional[JupiterTokenData]`:
  * Takes a token `mint` address (`solders.pubkey.Pubkey` object).
  * Fetches a list of verified tokens from Jupiter's token API (`https://tokens.jup.ag/tokens?tags=verified`).
  * Searches for the token with the matching mint address in the list.
  * Returns a `JupiterTokenData` object (containing address, symbol, name) if found, otherwise `None`.
* `get_token_address_from_ticker(ticker: str) -> Optional[str]`:
  * Takes a token `ticker` symbol (e.g., "SOL", "USDC").
  * Queries the DexScreener API (`https://api.dexscreener.com/latest/dex/search`) for pairs matching the ticker.
  * Filters for Solana pairs and sorts them, prioritizing those with higher Fully Diluted Valuation (FDV).
  * Returns the base token's mint address (string) for the best matching Solana pair if found, otherwise `None`.
* `get_token_data_by_ticker(ticker: str) -> Optional[JupiterTokenData]`:
  * First calls `get_token_address_from_ticker` to resolve the ticker to a mint address.
  * If an address is found, it then calls `get_token_data_by_address` with that address.
  * Returns a `JupiterTokenData` object or `None`.

##

**Note:** This tool relies on external APIs (Jupiter and DexScreener). Their availability and rate limits apply.

## Source Code

You can find the source code for this tool on GitHub: <https://github.com/niceberginc/agentipy/blob/main/agentipy/tools/get_token_data.py>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.agentipy.fun/tools/get-token-data.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
