# DefiLlama Batch Historical Token Prices

> DefiLlama Batch Historical Token Prices is a paid API for AI agents from defillama.use.x402atlas.com, paid per call via x402, $0.005/call, status unknown (last checked 2026-09-14).

Fetches historical USD prices for multiple tokens at multiple timestamps in a single batch call using DefiLlama data.

## Facts

- Endpoint: GET https://defillama.use.x402atlas.com/batch-historical
- Price: $0.005/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-14
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/defillama-batch-historical-token-prices-70512f92
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_tzXYTT3qDgKNwkERbNVOC

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability defillama-batch-historical-token-prices-70512f92
```

Example prompt: Can you pull the historical prices for ethereum:0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2 and coingecko:bitcoin at Unix timestamps 1700000000, 1710000000, and 1720000000, using a 4h search window?

## When to prefer this

Use this endpoint when you need historical prices for multiple tokens at multiple specific timestamps in a single efficient call. It is ideal for portfolio valuation at past dates, tax/accounting calculations, backtesting DeFi strategies, or any scenario requiring cross-token price history without making many individual requests. Prefer this over single-token historical endpoints when dealing with more than one coin or more than one timestamp.

## Known failure modes

- Invalid coins JSON format causes 400 error
- Unrecognized chain:address or coingecko:id returns missing or null price entries
- Timestamps too far in the past with no data available return empty results
- searchWidth too narrow causes no matching price to be found for a timestamp
- Payment failure (402) if x402 payment not provided or insufficient USDC balance
- Rate limiting or upstream DefiLlama data unavailability causes 5xx errors

## How this service works

Batch historical token prices by DefiLlama — prices for many coins at many timestamps in one call (coins is a JSON map).

## Output

A JSON object mapping each coin identifier to an array of price entries corresponding to the requested timestamps, including USD price and timestamp metadata for each data point.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "$schema": "https://json-schema.org/draft/2020-12/schema",
 "required": [
  "input"
 ],
 "properties": {
  "input": {
   "type": "object",
   "required": [
    "type",
    "method"
   ],
   "properties": {
    "type": {
     "type": "string",
     "const": "http"
    },
    "method": {
     "enum": [
      "GET"
     ],
     "type": "string"
    },
    "queryParams": {
     "type": "object",
     "required": [
      "coins"
     ],
     "properties": {
      "coins": {
       "type": "string",
       "maxLength": 8000,
       "minLength": 1,
       "description": "Required JSON object mapping each {chain}:{address} or coingecko:{id} coin to an array of unix timestamps"
      },
      "searchWidth": {
       "type": "string",
       "maxLength": 200,
       "description": "Optional time range to search for each price (e.g. 4h)"
      }
     }
    }
   },
   "additionalProperties": false
  },
  "output": {
   "type": "object",
   "required": [
    "type"
   ],
   "properties": {
    "type": {
     "type": "string"
    },
    "example": {
     "type": "object",
     "required": [
      "queried_at",
      "data"
     ],
     "properties": {
      "data": {
       "type": "object",
       "properties": {
        "coins": {
         "type": "object",
         "description": "Keyed by {chain}:{address} or coingecko:{id}",
         "additionalProperties": {
          "type": "object",
          "properties": {
           "prices": {
            "type": "array",
            "items": {
             "type": "object",
             "properties": {
              "price": {
               "type": "number",
               "description": "USD price"
              },
              "timestamp": {
               "type": "integer",
               "description": "Unix timestamp (seconds)"
              }
             }
            }
           },
           "symbol": {
            "type": "string"
           }
          }
         }
        }
       },
       "description": "Raw DefiLlama batchHistorical payload",
       "additionalProperties": true
      },
      "queried_at": {
       "type": "string",
       "format": "date-time",
       "description": "When this bridge fetched the upstream data"
      }
     }
    }
   }
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "data": {
   "coins": {
    "ethereum:0xdAC17F958D2ee523a2206206994597C13D831ec7": {
     "prices": [
      {
       "price": 1,
       "timestamp": 1650000000
      }
     ],
     "symbol": "USDT"
    }
   }
  },
  "queried_at": "2026-07-01T12:00:00Z"
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/defillama-batch-historical-token-prices-70512f92/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from defillama.use.x402atlas.com](https://www.zero.xyz/host/defillama.use.x402atlas.com/llms.txt)
