# GEXLOG Agent API

Structured SPX options market data for AI agents.
Base URL: https://agent.gexlog.com

## Endpoints

### Free Endpoints

| Endpoint | Description | Access |
|----------|-------------|--------|
| `/agent/current` | Today's morning briefing — gamma regime, key levels, trade signal, forecast, narrative, playbook | Free |
| `/agent/evening` | Today's evening briefing — post-close refresh with updated levels and scorecard | Free |
| `/agent/weekend` | Weekend preview — week-ahead calendar, risk score, and outlook | Free |
| `/agent/dates` | List all dates with available archive data | Free |
| `/agent/health` | API health check | Free |

### Paid Endpoints (x402 USDC)

| Endpoint | Description | Price |
|----------|-------------|-------|
| `/agent/historical?date=YYYY-MM-DD` | Full morning + evening report for any past date | $0.01 USDC |
| `/agent/range?start=YYYY-MM-DD&end=YYYY-MM-DD` | Multi-day dataset — all reports in a date range (max 30 days) | $0.05 USDC |
| `/agent/regime?limit=30` | Regime classification timeline — lightweight summary of gamma regimes, signals, and key levels over time (max 90 days) | $0.02 USDC |

## Data Available

Every endpoint returns pre-computed SPX options market intelligence. No live calculations, no raw options chain data — everything is processed and structured for immediate consumption.

- **Gamma Regime**: Positive, Negative, Neutral, or Transitional classification based on dealer gamma exposure from nearest-expiration SPXW options.
- **Key Levels**: Put Wall, Call Wall, GEX Flip, Expected Move, and Pivot Levels (R1/R2/S1/S2) — all derived from options OI and prior session OHLC.
- **Trade Signal**: GO / CAUTION / WAIT guidance reflecting regime context, with strategy playbook (Iron Butterfly, credit spreads).
- **AI Narrative**: Morning and evening briefings generated by Claude and Gemini from pre-computed facts. Anti-hallucination architecture — AI structures the narrative, it does not calculate data.

### Field Reference (Morning Report)

Key fields returned by `/agent/current`. The evening and weekend reports share the same schema with additional post-close data.

| JSON Path | Type | Example | What It Tells You |
|-----------|------|---------|-------------------|
| `forecast.factors.gamma.value` | string | `"POSITIVE"` | Current gamma regime: dealers dampen (positive) or amplify (negative) moves |
| `forecast.factors.gamma.net_gex` | float | `2847530000` | Net dealer gamma exposure in dollar-gamma units |
| `forecast.factors.gamma.gex_flip` | float\|null | `5825.0` | Price where regime would flip. Null = deeply one-sided |
| `forecast.factors.gamma.flip_proximity` | string\|null | `"1.2%"` | Distance from spot to flip. Close = fragile regime |
| `levels.putWall` | float | `5800` | Dealer-implied downside support |
| `levels.callWall` | float | `5950` | Dealer-implied upside resistance |
| `levels.expectedMove` | float | `42.5` | Options-implied session range in SPX points |
| `guidance.signal` | string | `"GO"` | Trade signal: GO, CAUTION, or WAIT |
| `forecast.type` | string | `"RANGE BOUND"` | Day-type forecast |
| `forecast.confidence` | int | `72` | Forecast confidence (0 to 100) |
| `risk.level` | string | `"MODERATE"` | Composite risk assessment |
| `forecast.regime_streak.count` | int | `5` | Consecutive sessions in current regime |
| `market.es.price` | float | `5892.50` | ES futures price (pre-market reference) |
| `market.vix.price` | float | `16.42` | VIX level |

## Payment (x402)

Paid endpoints use the x402 protocol for machine-to-machine micropayments. No accounts, no subscriptions, no API keys required. Pay per request with USDC stablecoins.

### How It Works

1. Request a paid endpoint without payment -> server returns HTTP 402 with payment options
2. Your wallet signs a USDC authorization (off-chain, no gas cost to you)
3. Retry the request with the signed payment header -> server verifies and serves data
4. Settlement is handled by Coinbase CDP (standard wallets) or Circle Gateway (batched nanopayments)

### Accepted

| Token | Network | Settlement |
|-------|---------|------------|
| USDC | Base, Polygon, Arbitrum | Circle Gateway Nanopayments (batched, zero gas) |
| USDC | Base, Polygon, Arbitrum | Standard onchain via Coinbase CDP facilitator |
| USDC | Solana | Standard onchain via Coinbase CDP facilitator |

### Supported Wallets

- **MetaMask**: EVM wallet — connects to EVM networks for USDC payments.
- **Coinbase Wallet**: Native EVM support — lowest friction with Coinbase facilitator.
- **Phantom**: Solana wallet — pay with USDC on Solana. Zero gas (facilitator-sponsored).

Prices range from $0.01 to $0.05 per request. Even at these amounts, traditional payment rails are uneconomical — card processing alone floors out near $0.30 per transaction. x402 enables practical pay-per-request access, with Circle Nanopayments adding zero-gas batched settlement.

## WebMCP Tools

AI agents with WebMCP support can discover structured data tools on GEXLOG's dashboard pages. Tools register automatically via `document.modelContext` — no configuration needed.

### Available Tools

| Tool | Description |
|------|-------------|
| `get_current_briefing` | Today's morning, evening, or weekend report |
| `get_historical_briefing` | Full report for any past date |
| `get_date_range` | Multi-day dataset (max 30 days) |
| `get_available_dates` | List all archived dates |
| `get_regime_history` | Lightweight regime classification timeline (max 90 days) |

### Where to Find Tools

WebMCP tools are registered on these pages:
- gexlog.com — homepage
- gexlog.com/dashboard/ — main dashboard
- gexlog.com/dashboard/history/ — historical data viewer

## Direct API Access

You don't need WebMCP to use the API. Any HTTP client can call the endpoints directly.

### Free Endpoint

```bash
curl https://agent.gexlog.com/agent/current
```

Returns today's morning briefing as JSON — no authentication, no payment.

### Paid Endpoint (Without Payment)

```bash
curl -v https://agent.gexlog.com/agent/historical?date=2026-05-09

# Response: HTTP 402
# Header: PAYMENT-REQUIRED: (base64 JSON with price, seller address, network)
```

The 402 response includes everything a wallet needs to sign and submit payment.

### Receipt Tokens and Retries

After a successful payment, the response includes an `X-Access-Token` header. You can pass this token back in the `X-Access-Token` request header to re-fetch the exact same resource within 15 minutes without paying again.

Additionally, if a request carrying a valid `X-PAYMENT` signature fails due to a network drop or server error (e.g., 502), you can safely retry the exact same request with the exact same `X-PAYMENT` header within 15 minutes. The server will not settle a second time.

### Partner API Keys

Selected partners can bypass x402 payments with an API key:

```bash
curl -H "Authorization: Bearer YOUR_API_KEY" \
     https://agent.gexlog.com/agent/historical?date=2026-05-09
```

### OpenAPI Discovery

```bash
curl https://agent.gexlog.com/openapi.json
```

Machine-readable API spec for automated agent discovery. Includes endpoint schemas, pricing, and x402 payment metadata.

## Links

- [gexlog.com](https://gexlog.com) — main site and dashboard
- [Methodology](https://gexlog.com/dashboard/methodology/) — how every metric is calculated
- [The Gamma Brief](https://www.youtube.com/@gexlog) — daily YouTube briefings
- [x402 Protocol](https://www.x402.org/) — machine-to-machine payment standard
- [Circle Nanopayments](https://developers.circle.com/gateway/nanopayments) — batched USDC settlement
- [OpenAPI Spec](https://agent.gexlog.com/openapi.json)
- [llms.txt](https://gexlog.com/llms.txt)
- [Markdown twin](https://agent.gexlog.com/index.md)
- [API catalog (RFC 9727)](https://agent.gexlog.com/.well-known/api-catalog)
- [MCP server card](https://agent.gexlog.com/.well-known/mcp.json)
- [Agent skills index](https://gexlog.com/.well-known/agent-skills/index.json)
