developer api · v1.1

Copy-trade Polymarket from any agent, script, or app.

PolyZig exposes a full REST API and a first-party Model Context Protocol server. Hosted clients like Poke connect with PolyZig OAuth, so users sign in with Apple or email instead of pasting keys. Developer clients can still use scoped pzk_* keys. Agents can discover top traders, preview trades, start copy configs, monitor PnL, and place orders with sub-500ms execution.

Built for autonomous agents

OAuth login or scoped keys

Poke uses PolyZig OAuth so users approve access with Apple/email login. Developer clients can mint API keys from the dashboard with explicit scopes. Deny-by-default route gates keep unscoped agent credentials out of writes.

Idempotency on trading writes

REST writes use Idempotency-Key headers. MCP writes use an idempotency_key argument and fail closed if Redis safety is unavailable. Direct live orders and copy-config creation also require an unexpired preview_id.

Machine-first contracts

Every error has a stable code. Pagination metadata in response headers. Money serialized as decimal strings (*_dec mirror fields). OpenAPI 3.1 spec published at /openapi.json and Swagger UI at /api/docs.

Quick start

1. Hosted clients use OAuth

Poke recipes should register/connect through PolyZig OAuth. The user signs in with Apple, email, or another enabled PolyZig identity, approves scopes, and Poke receives a scoped pzo_* access token.

poke oauth
Authorization server: https://api.polyzig.com/.well-known/oauth-authorization-server
Protected resource:    https://api.polyzig.com/.well-known/oauth-protected-resource
MCP URL:               https://api.polyzig.com/api/mcp
Credential mode:       OAuth user login (Apple/email/connected identity)
Recommended scopes:    read:account read:positions read:trades read:markets trade:execute trade:cancel

2. Developer clients can mint a key

Sign in, visit /dashboard/keys, and create a key with the scopes your agent needs. The secret is shown once.

3. Verify with curl

bash
curl https://api.polyzig.com/api/users/me \
  -H "Authorization: Bearer pzk_live_..."

4. Start mirroring a trader

Always set paper_trading: true on the first run for any new target — watch a session, check PnL, then promote.

bash
# Create a paper-trading copy config for a target wallet
curl -X POST https://api.polyzig.com/api/configs \
  -H "Authorization: Bearer pzk_live_..." \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
    "target_address": "0xWHALE_ADDRESS",
    "target_name":    "polymarket-whale",
    "size_multiplier": "0.1",
    "paper_trading":   true
  }'

Or skip curl - use MCP

Poke uses the OAuth metadata above. For developer clients, drop this into Claude Desktop's claude_desktop_config.json (or Cursor's equivalent). Your agent gets the full tool catalogue, scoped to what your key allows.

claude_desktop_config.json
{
  "mcpServers": {
    "polyzig": {
      "type": "http",
      "url": "https://api.polyzig.com/api/mcp",
      "headers": {
        "Authorization": "Bearer pzk_live_..."
      }
    }
  }
}
Auto-discovery

Clients that consult /.well-known/mcp.json pick up the endpoint, transport, and scope list automatically.

Scopes

Default to the minimum scopes your agent needs. A monitoring agent should not have trade:execute; a copy-trading agent should not have wallet:write.

ScopeGrants
read:accountProfile, balance, PnL summary
read:positionsOpen + paper positions
read:tradesTrade history and fills
read:marketsMarket search, depth, history, open orders, leaderboard data
trade:executePlace orders; create + start + stop copy configs
trade:cancelCancel resting CLOB orders
wallet:writeClaim resolved positions, withdraw, wrap-to-pUSD

MCP tool catalogue

26 first-party tools. The MCP server returns only the subset your credential's scopes permit, so an agent doing read-only monitoring does not see write tools.

Discovery

  • get_platform_stats
    Median/p95 execution latency, recent fill volume.
  • get_trading_readinessread:account
    Balance, wallet status, scopes, setup blockers, and iMessage setup actions.
  • search_marketsread:markets
    iMessage-ready market cards with emoji badges, images/logos, choices, prices, and token IDs.
  • get_market_detailsread:markets
    Full market metadata, localized context, live prices, liquidity, outcome choices, and next actions.
  • get_market_depthread:markets
    CLOB order-book levels, spread, depth within 1c/2c/5c, and depth-card actions.
  • get_market_price_historyread:markets
    Sampled CLOB history with open/latest/high/low/change and chart/depth actions.
  • list_top_tradersread:markets
    Copyable leaderboard trader cards with avatars, badges, and preview-copy actions.

Read your state

  • list_open_positionsread:positions
    On-chain Polymarket positions with PnL.
  • list_paper_positionsread:positions
    Paper-trading positions — no real funds.
  • list_tradesread:trades
    Fill history with detection + execution latency.
  • get_user_summaryread:account
    Lifetime trade count + fees paid.

Manage copy configs

  • list_copy_configsread:account
    Every wallet you’re currently copying.
  • get_copy_configread:account
    Single config detail.
  • get_config_pnlread:account
    PnL breakdown for one config.
  • get_config_tradesread:trades
    Trades attributed to one config.
  • suggest_multiplierread:markets
    Recommended sizing for the user’s balance.
  • preview_copy_configtrade:execute
    Confirm target, sizing, caps, TP/SL, and live/paper mode.
  • create_copy_configtrade:execute
    Create an inactive config from a preview_id.
  • start_copyingtrade:execute
    Activate a copy config.
  • stop_copyingtrade:execute
    Deactivate (positions stay open).
  • delete_copy_configtrade:execute
    Permanent delete.

Direct trading

  • preview_market_ordertrade:execute
    Exact order preview with price, shares, token, and confirmation text.
  • place_market_ordertrade:execute
    Live market order from a preview_id.
  • list_open_ordersread:markets
    Resting CLOB orders.
  • cancel_ordertrade:cancel
    Cancel a single order by ID.
  • claim_positionswallet:write
    Redeem resolved positions on-chain.

Ready to build?

Sign in and mint your first key in under a minute. Start with read:* scopes — promote to write access once you trust the agent loop.

Open the API keys dashboard