> ## Documentation Index
> Fetch the complete documentation index at: https://docs.codex.io/llms.txt
> Use this file to discover all available pages before exploring further.

# getTokenPrices

> Returns real-time or historical prices for a list of tokens, fetched in batches.

<div data-generated>
  ## GraphQL

  ```
  type Query {
    getTokenPrices(
      inputs: [GetPriceInput]
    ): [Price]
  }

  type Price {
    address: String!
    timestamp: Int
    networkId: Int!
    priceUsd: Float!
    blockNumber: Int
    liquidityUsd: String
    priceChange24: Float
  }

  input GetPriceInput {
    address: String!
    networkId: Int!
    timestamp: Int
    poolAddress: String
    blockNumber: Int
  }
  ```
</div>

### Example

<a href="/explore" target="_blank" rel="noopener noreferrer">Test this query in the Explorer →</a>

```graphql theme={null}
{
  getTokenPrices(
    inputs: {address: "So11111111111111111111111111111111111111112", networkId: 1399811149}
  ) {
    address
    networkId
    priceUsd
    timestamp
  }
}
```

### Usage Guidelines

* Prices returns are aggregate values weighted across all valid pools. Provide a pool address if you want prices only from a specific pool.
* We recommend `getDetailedPairStats` for the most accurate historical price and volume data

### Troubleshooting Tips

<AccordionGroup>
  <Accordion title="My query is not returning a pool address, is this expected?">
    Yes. We added a deprecated value to that field (along with deprecating `confidence`). It returns `null` if no pool is specified in the input as the expected behavior is an aggregated price across all pools, not one specific pool. The previous default would be to use the top-pair if no pool was specified.
  </Accordion>

  <Accordion title="I'm not able to get all the information I need from this endpoint, can we add additional fields in the results?">
    Unfortunately not. `getTokenPrices` was built to be as fast as possible, so we don't want to slow it down by adding additional data points to it. Our team is happy to discuss options of how to obtain all the data you need in as few queries as possible.
  </Accordion>
</AccordionGroup>

### Related Recipes

* [Discover Tokens](/recipes/discover-tokens): Build token discovery pages with trending data, filters, and search
