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

# Welcome to Struct

> The fastest API for Polymarket data.

Struct is the fastest API for Polymarket. **Queries are instant, no matter how active the trader or market.** Every derived value (PnL, leaderboards, positions, market and event metrics) is pre-computed and stored as a single materialised row, updated as on-chain events arrive, so what would otherwise be a scan over hundreds of thousands of trades is a single-row lookup.

<CardGroup cols={2}>
  <Card title="Quickstart" icon="bolt" href="/api-reference/getting-started">
    Get your API key and make your first request in minutes.
  </Card>

  <Card title="Authentication" icon="key" href="/introduction/authentication">
    Secret keys, JWT public keys, and how to call the API from a browser.
  </Card>

  <Card title="API Reference" icon="code" href="/api-reference/getting-started">
    Browse every endpoint, parameter, and response shape.
  </Card>

  <Card title="Dashboard" icon="grid-2" href="https://struct.to/dashboard">
    Manage your organisation, keys, webhooks, and billing.
  </Card>
</CardGroup>

## Why Struct?

<CardGroup cols={3}>
  <Card title="Materialised on write" icon="bolt">
    PnL, leaderboards, positions, and metrics are pre-computed as a single row. Every query is a one-row read, not a scan over months of trades.
  </Card>

  <Card title="One unified API" icon="layer-group">
    REST, websockets, and webhooks for every Polymarket entity in one place. No more stitching together gamma, CLOB, the subgraph, and on-chain reads.
  </Card>

  <Card title="Real-time streams" icon="signal-stream">
    Push delivery for trades, prices, PnL, positions, and order books over websockets, plus 30+ in-app alert types and 30+ webhook event types.
  </Card>
</CardGroup>

## Struct vs. Polymarket's direct APIs

|                                | Polymarket (Gamma + Data + CLOB)                                | Struct                                                                                                    |
| ------------------------------ | --------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------- |
| **Surface**                    | Three separate APIs plus the subgraph and on-chain reads        | One unified REST, websocket, and webhook API                                                              |
| **Trader PnL**                 | Available; does not include fees, win rate, open positions, etc | Mark-to-market and fee-accurate, with win rate, hold time, best/worst trade, splits, merges, and more     |
| **Leaderboards**               | Materialised, refreshed on a periodic cycle                     | Materialised and updated in real time as trades settle                                                    |
| **Trades stream**              | Available; thin payload (raw on-chain fields)                   | Enriched payload with slug, event, image, builder code, fee breakdown, trader pseudonym, neg-risk context |
| **Pending trades**             | Wait for chain confirmation                                     | Streamed from the mempool before they settle                                                              |
| **Per-wallet position stream** | User channel, requires that wallet's auth                       | Any wallet, no per-wallet auth, server-side filtered                                                      |
| **Webhooks**                   | Not available                                                   | 30+ event types with HMAC signing, retries, rotation, delivered instantly, no polling                     |
| **In-app alerts**              | Not available                                                   | Whale trades, PnL crossings, probability/price spikes, volume milestones over WS or HTTP                  |
| **JWT public-key auth**        | Not supported                                                   | First-class, JWKS or inline key, per-user limits                                                          |

## Use cases

<CardGroup cols={3}>
  <Card title="Trading platforms" icon="chart-area" href="/use-cases/trading-platforms">
    Custom trading UIs, aggregators, and copy-trading powered by real-time Polymarket data.
  </Card>

  <Card title="AI agents" icon="robot" href="/use-cases/ai-agents">
    Autonomous agents that research, monitor, and trade on prediction markets.
  </Card>

  <Card title="Analytics & research" icon="chart-mixed" href="/use-cases/analytics-research">
    Dashboards, quant research, and large-scale historical analysis.
  </Card>
</CardGroup>

## Start building

<CardGroup cols={2}>
  <Card title="TypeScript SDK" icon="js" href="/sdk/overview">
    Typed clients for REST, rooms, alerts, and webhook management.
  </Card>

  <Card title="WebSockets" icon="signal-stream" href="/websockets/getting-started">
    Subscribe to trades, prices, PnL, positions, order books, and metric streams.
  </Card>

  <Card title="Webhooks" icon="webhook" href="/webhooks/getting-started">
    HTTP event delivery for trades, milestones, spikes, PnL crossings, and market lifecycle.
  </Card>

  <Card title="Guides" icon="book" href="/guides/best-practices">
    Best practices, error handling, rate limits, and recipes for common integrations.
  </Card>
</CardGroup>
