# DefiLlama Historical Token Prices

> DefiLlama 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-10-12).

Returns USD price(s) for one or many tokens at a specific historical unix timestamp, identified by chain:address or coingecko:id.

## Facts

- Endpoint: GET https://defillama.use.x402atlas.com/prices-historical?utm_source=zero.xyz
- Price: $0.005/call
- Payment: x402
- Status: unknown
- Last checked: 2026-10-12
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/defillama-historical-token-prices-7676a5a3
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_PE5RYpxjsuw_bFbP2LCgQ

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-historical-token-prices-7676a5a3
```

Example prompt: What was the price of ETH (ethereum:0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2) and LINK (coingecko:chainlink) at unix timestamp 1672531200? Use a 4h search window.

## When to prefer this

Use this endpoint when you need token prices at a specific point in the past, rather than current prices. Prefer it over current-price endpoints for historical PnL calculations, backtesting, or auditing DeFi positions at a given block time. Supports both on-chain contract addresses (chain:address format) and CoinGecko IDs.

## Known failure modes

- Invalid or unrecognized coin identifier returns empty or partial results
- Unix timestamp out of supported historical range returns no price data
- Malformed coins parameter (wrong format) results in an error response
- searchWidth too narrow with no price data in range returns empty result
- Payment not processed results in 402 response before data is returned

## How this service works

Historical token prices by DefiLlama — token price(s) at a given unix timestamp by chain:address or coingecko:id.

## Output

A JSON object mapping each requested coin identifier to its historical USD price, symbol, and decimals at or near the requested unix timestamp.

## 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": [
      "timestamp",
      "coins"
     ],
     "properties": {
      "coins": {
       "type": "string",
       "pattern": "^[A-Za-z0-9:,_.-]+$",
       "maxLength": 3000,
       "minLength": 1,
       "description": "Comma-separated coins as {chain}:{address} or coingecko:{id}"
      },
      "timestamp": {
       "type": "string",
       "pattern": "^[0-9]{1,20}$",
       "description": "Unix timestamp (seconds, digits only) to price the coins at"
      },
      "searchWidth": {
       "type": "string",
       "maxLength": 200,
       "description": "Optional time range to search for the 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": "Map keyed by the requested coin id (e.g. coingecko:ethereum)",
         "additionalProperties": {
          "type": "object",
          "properties": {
           "price": {
            "type": "number",
            "description": "USD price at the requested timestamp"
           },
           "symbol": {
            "type": "string"
           },
           "decimals": {
            "type": "integer"
           }
          }
         }
        }
       }
      },
      "queried_at": {
       "type": "string",
       "format": "date-time",
       "description": "Time the upstream was queried"
      }
     }
    }
   }
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "data": {
   "coins": {
    "coingecko:ethereum": {
     "price": 3500,
     "symbol": "ETH",
     "decimals": 18
    }
   }
  },
  "queried_at": "2026-07-01T12:00:00Z"
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/defillama-historical-token-prices-7676a5a3/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)
