Agent skill

Polymarket API

by agiprolabs in agiprolabs/claude-trading-skills

Polymarket exchange mechanics — on-chain Polygon CTF, Gamma/CLOB/Data APIs, EIP-712 auth, identifier model, WebSocket, settlement, and geo/KYC constraint

MITAuto-check passedBackend & APIs

Install Polymarket API

skills CLI
$ npx skills add agiprolabs/claude-trading-skills --skill polymarket-api -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install agiprolabs/claude-trading-skills polymarket-api --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/agiprolabs/claude-trading-skills.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/polymarket-api .claude/skills/polymarket-api && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
polymarket-api
GitHub stars
410
Token cost
~1.6k tokens
SKILL.md length
512 words
Files
3 (incl. references)
Skills in repo
68
Repo updated
First seen
Licence
MIT

At a glance

Polymarket exchange mechanics — on-chain Polygon CTF, Gamma/CLOB/Data APIs, EIP-712 auth, identifier model, WebSocket, settlement, and geo/KYC constraint

  • Works in 2 steps: Read markets — Gamma API (no auth… → Order book and trading — CLOB API…
  • Tasks that involve Smart contracts
  • SKILL.md covers Identifier model, Quick Start, API surface overview and WebSocket, plus 4 more sections
  • Calls uv; reaches gamma-api.polymarket.com and clob.polymarket.com; needs POLYMARKET_PRIVATE_KEY

What it does

Polymarket API is an agent skill from agiprolabs/claude-trading-skills. Polymarket exchange mechanics — on-chain Polygon CTF, Gamma/CLOB/Data APIs, EIP-712 auth, identifier model, WebSocket, settlement, and geo/KYC constraint

Its SKILL.md is about 1.6k tokens, which your agent loads only when the skill is triggered. The skill folder holds 3 other files, including reference files (for example `references/clob-and-gamma-apis.md` and `references/settlement-and-ops.md`).

It sits in Backend & APIs, covering Smart contracts, Realtime and WebSockets and Capture the flag. It works with Polymarket and Circle USDC. The repository describes itself as: 68 trading, DeFi, and quantitative finance Agent Skills. Works with Claude Code, Cursor, Codex, Gemini CLI, and 30+ other tools. The licence is MIT.

When your agent uses it

  • Tasks that involve Smart contracts
  • Tasks that involve Realtime and WebSockets
  • Tasks that involve Capture the flag

Example prompts

  • “/polymarket-api”

Requirements

  • Python 3
  • A credential in POLYMARKET_PRIVATE_KEY

Workflow steps

2 steps, taken from the step headings in SKILL.md.

  1. Read markets — Gamma API (no auth required)
  2. Order book and trading — CLOB API (EIP-712 auth)

What it can do on your machine

Read from SKILL.md and the folder at commit 981e1d7. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • uv

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Hosts in commands or code, which the agent is likely to contact:

    • gamma-api.polymarket.com
    • clob.polymarket.com
    • data-api.polymarket.com

    Also links to:

    • docs.polymarket.com
    • github.com

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names these keys or tokens, usually read from environment variables:

    • POLYMARKET_PRIVATE_KEY

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Polymarket API loads about 1.6k tokens when it runs, and up to ~3.9k if it reads all its reference files. Until then it costs about 42 tokens; SKILL.md has 512 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~42
When it runs · the whole SKILL.md, loaded when a task matches
~1.6k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~3.9k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from agiprolabs/claude-trading-skills at commit 981e1d7, republished under its MIT licence (© agiprolabs). 512 words, ~1,586 tokens.

Download SKILL.mdSave it as .claude/skills/polymarket-api/SKILL.md (or your agent's skills folder). This skill also uses 2 other files; get the full folder from GitHub.
name
polymarket-api
description
Polymarket exchange mechanics — on-chain Polygon CTF, Gamma/CLOB/Data APIs, EIP-712 auth, identifier model, WebSocket, settlement, and geo/KYC constraint

Polymarket API

Polymarket is a prediction market on Polygon mainnet. Every market is a pair of YES/NO ERC-1155 tokens issued by the Conditional Token Framework (CTF), collateralized 1:1 in USDC. Off-chain CLOB matching, on-chain settlement, zero taker fees. Prices are in [0.00, 1.00] USDC; YES + NO ≈ 1.0 per market.


Before you write any API code — read the live docs first.

Polymarket endpoints and auth flows have changed without notice. Prefer the official py-clob-client SDK over hand-rolled HTTP; it handles EIP-712 derivation, API credential management, and order signing. Only hand-roll when the SDK doesn't expose what you need.


Identifier model

You will juggle four distinct IDs — get them confused and queries silently return wrong data.

IDWhat it is
condition_idOn-chain hex ID of the market (the CTF condition)
clob_token_idsThe YES/NO pair of ERC-1155 token IDs — a two-element list
token_idA single outcome token — what you pass to order-book and WebSocket queries
event_idParent grouping (e.g. all brackets for "NYC high today")

Quick Start

1. Read markets — Gamma API (no auth required)
python
import httpx

# CRITICAL: default sort is OLDEST-first — always override or you silently get closed markets
events = httpx.get("https://gamma-api.polymarket.com/events", params={
    "tag_id": 103040,        # category tag (e.g. weather)
    "order": "endDate",
    "ascending": "false",    # must be string "false", not bool
    "closed": "false",
}).json()

# Each event → markets[], each market has:
#   condition_id, clob_token_ids (YES/NO pair), question, outcomes, outcomePrices
for event in events:
    for mkt in event.get("markets", []):
        yes_token, no_token = mkt["clobTokenIds"]  # split the pair here
        print(mkt["question"], mkt["outcomePrices"])

Pagination: limit=100&offset=N, step by 100.

2. Order book and trading — CLOB API (EIP-712 auth)
bash
uv pip install py-clob-client
python
import os
from py_clob_client.client import ClobClient

client = ClobClient(
    "https://clob.polymarket.com",
    chain_id=137,                                     # Polygon mainnet
    key=os.environ["POLYMARKET_PRIVATE_KEY"],          # wallet private key — env only, NEVER hardcode
    signature_type=2,                                  # 2 = Gnosis Safe proxy (Polymarket UI accounts)
                                                       # 0 = direct EOA you fully control
)
# Derives API key/secret/passphrase from the wallet signature — call once per session
client.set_api_creds(client.create_or_derive_api_creds())

token_id = "<yes_token_from_clob_token_ids>"
book = client.get_order_book(token_id)     # bids/asks for one outcome token
price = client.get_price(token_id, side="BUY")

signature_type=2 is for the proxy/Safe accounts the Polymarket web UI creates (the funder address is the Safe). Use signature_type=0 for a raw EOA you control directly. Read the live SDK docs — the type you choose affects how orders are signed on-chain.

Wallet env vars: POLYMARKET_PRIVATE_KEY, POLYMARKET_FUNDER. Never hardcode keys.


API surface overview

APIHostAuthPurpose
Gammahttps://gamma-api.polymarket.comnoneEvents/markets/conditions/prices metadata
CLOBhttps://clob.polymarket.comEIP-712Order book, order placement/cancel
Datahttps://data-api.polymarket.comnoneHistorical trades
WebSocketwss://ws-subscriptions-clob.polymarket.com/ws/none (market) / JWT (user)Real-time book + trade ticks

Chain: Polygon mainnet chain_id=137. Collateral: USDC.e at 0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174.


WebSocket

python
# Connect to: wss://ws-subscriptions-clob.polymarket.com/ws/market
# Subscribe message:
{"type": "market", "assets_ids": ["<token_id>", "<token_id2>"]}

Event types: book (full snapshot on subscribe), price_change (delta updates), last_trade_price.

For user-level order/fill events, connect to /ws/user with a JWT derived from your API credentials.


Show full SKILL.md (202 more words)Show less

On-chain settlement and redemption

Polymarket weather markets resolve via Weather Underground ("History" tab), on the metro's local clock with DST, midnight-to-midnight. This differs from Kalshi, which uses LST (no DST) and NWS CLI — see kalshi-weather-markets for the divergence.

After resolution, winning tokens must be redeemed manually on-chain:

python
# Call CTF contract redeemPositions() — the SDK or direct web3.py call
# Winnings are NOT auto-swept to your wallet

Disputes on the international book escalate to the UMA optimistic oracle (token-holder vote). This is a real resolution-divergence risk vs. Kalshi's CFTC-CCP settlement — factor it into any cross-venue comparison.


US geo / KYC constraint

US persons are blocked from Polymarket. API calls from a US IP typically require a SOCKS5 proxy from an allowed jurisdiction (use a USE_PROXY env flag pattern; never hardcode the proxy address). This constraint — combined with on-chain capital lockup and USDC/USD friction — is why most Kalshi/Polymarket arbitrage is not executable at retail scale.


Cross-references

  • For strategy, sizing, and backtesting that apply across venues: prediction-market-strategy
  • For the Kalshi counterpart (RSA-PSS auth, REST host, tickers, order schema): kalshi-api
  • For weather settlement specifics (WU local-clock+DST vs Kalshi LST, KLGA vs KNYC station): kalshi-weather-markets

Files

References
  • references/clob-and-gamma-apis.md — Full API surface, all endpoints, EIP-712 auth detail, pagination, order schema, trading-parameter defaults
  • references/settlement-and-ops.md — WU/UMA resolution, redeemPositions, truth-source priority (IEM > WU > Open-Meteo), known-bad dates, geo/KYC, host-segregation, two-exchange architecture notes

© agiprolabs, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 2 other files (references) in skills/polymarket-api of agiprolabs/claude-trading-skills.

  • SKILL.md
  • references/clob-and-gamma-apis.md
  • references/settlement-and-ops.md

Open the folder on GitHubat commit 981e1d7

Compare with similar skills

Polymarket API next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Polymarket API compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Polymarket API this skillagiprolabs/claude-trading-skills410—~1.6kAutomated safety check: PassMIT
Web3 PolymarketPolymarket/agent-skills1912 repos~2kAutomated safety check: PassNone
Deposit QrSuperior-Trade/superior-skills2141 repos~1.1kAutomated safety check: PassMIT
Okx Dapp Discoveryinternet-court/internet-court-skill6.4k2 repos~6.9kAutomated safety check: PassMIT
Okx Dex Marketinternet-court/internet-court-skill6.4k1 repos~1.7kAutomated safety check: PassMIT
Capacitrmajiayu000/claude-skill-registry6661 repos~3kAutomated safety check: PassMIT

Similar skills

  • Web3 Polymarket

    Polymarket/agent-skills

    Polymarket integration for prediction market trading on Polygon.

    191 GitHub starsUsed in 2 repos~2k tokens
    Backend & APIsAuto-check passed
  • Deposit Qr

    Superior-Trade/superior-skills

    A skill your agent uses when a user needs a QR code or wallet payment URI to fund a Superior-managed EVM wallet on a specific chain before using Lighter, Polymarket, Hyperliquid, or other Superior…

    214 GitHub starsUsed in 1 repo~1.1k tokens
    Backend & APIsAuto-check passed
  • Okx Dapp Discovery

    internet-court/internet-court-skill

    Plugin router for 20 third-party DeFi protocols (Polymarket, Aave, Hyperliquid, PancakeSwap, Morpho, Raydium, Curve, Compound, Pendle, Lido, ether.fi, GMX, Kamino, Orca, Meteora, Clanker, pump.fun…

    6.4k GitHub starsUsed in 2 repos~6.9k tokens
    Backend & APIsAuto-check passed
  • Okx Dex Market

    internet-court/internet-court-skill

    HARD BLOCK — never use for prediction-market/Polymarket UpDown queries; route to okx-dapp-discovery when a named DApp (Polymarket/Aave/Hyperliquid/PancakeSwap/Morpho) appears with a timeframe, or…

    6.4k GitHub starsUsed in 1 repo~1.7k tokens
    Backend & APIsAuto-check passed
  • Capacitr

    majiayu000/claude-skill-registry

    Paste a URL or free text and get matched Polymarket / Hyperliquid / Deribit markets with Quotient edge scores.

    666 GitHub starsUsed in 1 repo~3k tokens
    Backend & APIsAuto-check passed
  • Okx Dapp Discovery

    aiskillstore/marketplace

    Plugin router for 20 third-party DeFi protocols (Polymarket, Aave, Hyperliquid, PancakeSwap, Morpho, Raydium, Curve, Compound, Pendle, Lido, ether.fi, GMX, Kamino, Orca, Meteora, Clanker, pump.fun…

    430 GitHub starsUsed in 1 repo~5.6k tokens
    Backend & APIsAuto-check passed

More from agiprolabs/claude-trading-skills

All 68 skills in this repo
  • Backtrader

    agiprolabs/claude-trading-skills

    Event-driven backtesting with bar-by-bar execution, complex order types, multiple analyzers, and custom indicators

    410 GitHub stars~2.4k tokensUpdated 1 mo ago
    Auto-check passed
  • Birdeye API

    agiprolabs/claude-trading-skills

    Solana token market data via Birdeye — prices, OHLCV, trades, token metadata, security checks, and trader activity

    410 GitHub stars~1.8k tokensUpdated 1 mo ago
    Auto-check passed
  • Coingecko API

    agiprolabs/claude-trading-skills

    Broad crypto market data from CoinGecko covering 13,000+ tokens.

    410 GitHub stars~1.6k tokensUpdated 1 mo ago
    Auto-check passed
  • Cointegration Analysis

    agiprolabs/claude-trading-skills

    Cointegration testing for pairs trading using Engle-Granger, Johansen, and rolling stability analysis

    410 GitHub stars~2.1k tokensUpdated 1 mo ago
    Auto-check passed
  • Copy Trading

    agiprolabs/claude-trading-skills

    Wallet evaluation, monitoring, and copy-trade strategy design for Solana DEX trading

    410 GitHub stars~2.4k tokensUpdated 1 mo ago
    Auto-check passed
  • Correlation Analysis

    agiprolabs/claude-trading-skills

    Cross-asset correlation analysis including rolling correlation, hierarchical clustering, tail dependence, and regime-dependent correlation

    410 GitHub stars~2.4k tokensUpdated 1 mo ago
    Auto-check passed

Categories

Questions about Polymarket API

What does Polymarket API do?

Polymarket exchange mechanics — on-chain Polygon CTF, Gamma/CLOB/Data APIs, EIP-712 auth, identifier model, WebSocket, settlement, and geo/KYC constraint. Polymarket API is an agent skill from agiprolabs/claude-trading-skills.

When should I use Polymarket API?

Polymarket API fits situations like: tasks that involve Smart contracts; tasks that involve Realtime and WebSockets; tasks that involve Capture the flag.

How do I install Polymarket API in Claude Code?

Run `npx skills add agiprolabs/claude-trading-skills --skill polymarket-api -a claude-code`. Or copy the skill folder (skills/polymarket-api in agiprolabs/claude-trading-skills) into .claude/skills/polymarket-api in your project. Claude Code loads it when a task matches its description.

How do I install Polymarket API in Codex?

Run `npx skills add agiprolabs/claude-trading-skills --skill polymarket-api -a codex`. Or copy the skill folder (skills/polymarket-api in agiprolabs/claude-trading-skills) into .agents/skills/polymarket-api in your project. Codex loads it when a task matches its description.

Can I use Polymarket API in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add agiprolabs/claude-trading-skills --skill polymarket-api -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/polymarket-api, .gemini/skills/polymarket-api, .github/skills/polymarket-api and .opencode/skills/polymarket-api in your project.

What does Polymarket API need to run?

Going by SKILL.md and its folder, Polymarket API needs the command-line tools its instructions call (uv) and credentials named POLYMARKET_PRIVATE_KEY. Our summary lists: Python 3; A credential in POLYMARKET_PRIVATE_KEY.

Does Polymarket API access the network?

SKILL.md names 5 domains. In commands or code: gamma-api.polymarket.com, clob.polymarket.com and data-api.polymarket.com; the agent is likely to contact these when it follows the instructions. As links in the text: docs.polymarket.com and github.com. This is read from the text; nothing was executed.

Is Polymarket API safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Polymarket API use?

Polymarket API is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Polymarket API use?

About 1.6k tokens (SKILL.md is roughly 6.3k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 2.3k tokens, read only when the agent opens those files.

What are the alternatives to Polymarket API?

Skills that share tags, products or a category with Polymarket API: Web3 Polymarket (Polymarket/agent-skills, 191 stars), Deposit Qr (Superior-Trade/superior-skills, 214 stars), Okx Dapp Discovery (internet-court/internet-court-skill, 6.4k stars) and Okx Dex Market (internet-court/internet-court-skill, 6.4k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Polymarket API?

agiprolabs (a GitHub user) maintains it in agiprolabs/claude-trading-skills, which has 410 GitHub stars. The repository holds 68 skills in this directory. The repository was last updated on September 3, 2026.

Source: agiprolabs/claude-trading-skills on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.