Etherscan Data API: Extract Structured JSON in 2026
Tutorials

Etherscan Data API: Extract Structured JSON in 2026

Learn how to extract structured JSON data from Etherscan using AlterLab's Extract API for finance data pipelines. Get typed output for ticker, price, volume and more.

4 min read
0 views

AlterLab handles this automaticallyscrape any URL with one API call. No infrastructure required.

Try it free

This guide covers extracting publicly accessible data. Always review a site's robots.txt and Terms of Service before scraping.

TL;DR

To get structured Etherscan data via API, define a JSON schema for the finance fields you need (ticker, price, change_percent, volume, market_cap), then call AlterLab's Extract API with the target Etherscan URL and your schema. The API returns validated, typed JSON—no HTML parsing required—enabling reliable data pipelines for analytics and AI applications.

Why use Etherscan data?

Etherscan hosts critical blockchain finance data that powers trading algorithms, portfolio trackers, and market analysis tools. Engineers use this data to:

  • Train AI models for cryptocurrency price prediction using historical volume and price trends
  • Build real-time dashboards showing token performance across multiple chains
  • Conduct competitive intelligence by monitoring new token listings and liquidity shifts Unlike raw blockchain data, Etherscan presents aggregated market metrics in human-readable formats ideal for direct consumption in financial applications.

What data can you extract?

Etherscan's token pages display standardized finance fields suitable for structured extraction. Key publicly available data points include:

  • ticker: Token symbol (e.g., "USDC", "ETH")
  • price: Current USD price as a string (to preserve precision)
  • change_percent: 24-hour price change percentage
  • volume: 24-hour trading volume in USD
  • market_cap: Total market capitalization in USD These fields appear consistently across token pages, making them reliable targets for schema-based extraction. AlterLab's Extract API returns these as typed JSON values matching your defined schema, ensuring data integrity for downstream processing.

The extraction approach

Direct HTTP requests to Etherscan followed by HTML parsing create fragile pipelines prone to breaking when:

  • Page structure updates (common with financial sites)
  • JavaScript-rendered content requires headless browsers
  • Anti-bot measures challenge automated access AlterLab's data API approach solves these by:
  • Handling JavaScript rendering and anti-bot challenges automatically
  • Returning structured JSON based on your schema—no parsing needed
  • Providing built-in rate limiting and retry logic
  • Delivering consistent output format regardless of frontend changes This shifts maintenance burden from parsing logic to schema definition, significantly improving pipeline reliability for production data workflows.

Quick start with AlterLab Extract API

Begin by installing the AlterLab Python client (getting started guide). Define your target Etherscan URL and schema, then call the extract endpoint.

Python
import alterlab

client = alterlab.Client("YOUR_API_KEY")

schema = {
  "type": "object",
  "properties": {
    "ticker": {
      "type": "string",
      "description": "The token ticker symbol"
    },
    "price": {
      "type": "string",
      "description": "Current price in USD"
    },
    "change_percent": {
      "type": "string",
      "description": "24-hour price change percentage"
    },
    "volume": {
      "type": "string",
      "description": "24-hour trading volume in USD"
    },
    "market_cap": {
      "type": "string",
      "description": "Total market capitalization in USD"
    }
  }
}

result = client.extract(
    url="https://etherscan.io/token/0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",  # USDC
    schema=schema,
)
print(result.data)

For direct API access, use cURL:

Bash
curl -X POST https://api.alterlab.io/v1/extract \
  -H "X-API-Key: YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://etherscan.io/token/0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
    "schema": {
      "properties": {
        "ticker": {"type": "string"},
        "price": {"type": "string"},
        "change_percent": {"type": "string"},
        "volume": {"type": "string"},
        "market_cap": {"type": "string"}
      }
    }
  }'

Both examples return structured JSON like:

JSON
{
  "ticker": "USDC",
  "price": "1.00",
  "change_percent": "0.01",
  "volume": "2500000000",
  "market_cap": "32000000000"
}

Define your schema

The schema parameter drives AlterLab's extraction accuracy. Specify each field with:

  • type: "string" for finance data (preserves leading zeros and decimal precision)
  • description: Human-readable context for the LLM extractor
  • constraints (optional): minLength, pattern for validation AlterLab validates output against your schema before returning data. If a field cannot be extracted confidently, it returns null for that field—never malformed data. This typed output eliminates post-processing steps and ensures your pipeline receives predictable data structures.
99.2%Extraction Accuracy
1.4sAvg Response Time
100%Typed JSON Output

Handle pagination and scale

For high-volume extraction (e.g., tracking 1000+ tokens):

  • Batching: Process URLs in chunks of 10-50 to manage rate limits
  • Async jobs: Use AlterLab's async endpoint for non-blocking extraction
  • Rate limiting: AlterLab automatically respects X-RateLimit-Remaining headers
  • Cost control: Monitor usage via the pricing page—costs scale linearly with successful extractions Example batch processing with Python asyncio:
Python
import asyncio
import alterlab

async def extract_token(client, url, schema):
    return await client.extract(url=url, schema=schema)

async def main():
    client = alterlab.Client("YOUR_API_KEY")
    schema = {"type": "object", "properties": {"price": {"type": "string"}}}
    urls = [
        f"https://etherscan.io/token/{token_addr}"
        for token_addr in token_addresses[:100]  # First 100 tokens
    ]
    
    tasks = [extract_token(client, url, schema) for url in urls]
    results = await asyncio.gather(*tasks, return_exceptions=True)
    
    # Process results
    for url, result in zip(urls, results):
        if not isinstance(result, Exception):
            print(f"{url}: {result.data['price']}")

asyncio.run(main())

This approach maintains efficiency while staying within AlterLab's fair usage policies. For enterprise volumes, contact sales about custom rate limits.

Key takeaways

  • Structured Etherscan data extraction requires schema definition, not HTML parsing
  • AlterLab's Extract API handles rendering, anti-bot, and validation automatically
  • Finance fields like ticker, price, and volume extract reliably as typed strings
  • Pay-as-you-go pricing ensures you only pay for successful extractions
  • Always verify public data compliance with Etherscan's robots.txt
Share

Was this article helpful?

Frequently Asked Questions

Etherscan provides limited free API endpoints for basic blockchain data, but lacks structured finance data extraction for market metrics. AlterLab fills this gap by enabling schema-based JSON extraction from public Etherscan pages for analytics and AI applications.
You can extract publicly available finance data including ticker, price, change_percent, volume, and market_cap using a custom JSON schema. AlterLab validates and returns typed output, eliminating the need for HTML parsing.
AlterLab uses pay-as-you-go pricing with extraction costs clamped between $0.001 and $0.50 per request. There are no minimums, credits never expire, and you only pay for successful extractions—see [pricing](/pricing) for details.