全面优化实盘对接没有验证

This commit is contained in:
2026-07-14 07:29:03 +08:00
parent a1963e58ed
commit b3f770c55f
391 changed files with 114675 additions and 529 deletions
+278 -14
View File
@@ -3,65 +3,329 @@
# ============================================================
# 复制: cp .env.example .env
# 必填项: TELEGRAM_BOT_TOKEN + TELEGRAM_CHAT_ID
# 修改后需重启机器人才能生效
# ============================================================
# --- 资金与仓位 ---
# ╔══════════════════════════════════════════════════════════════╗
# ║ 资金与仓位 ║
# ╚══════════════════════════════════════════════════════════════╝
# 初始本金(美元),用于 Kelly 公式计算建议仓位
# 调大 → 建议仓位更大;调小 → 建议仓位更保守
INITIAL_CAPITAL_USD=10000
# 单笔最大仓位比例(占本金百分比)
# 0.05 = 5%,即单笔最多 $500(本金 $10000 时)
# 调大 → 允许更重的单笔仓位;调小 → 更分散
MAX_POSITION_PCT=0.05
# Kelly 分数系数(0~1),用于降低 Kelly 公式的激进程度
# 0.5 = 半凯利(推荐),1.0 = 全凯利(激进),0.25 = 四分之一凯利(保守)
# 调大 → 仓位更大但风险更高;调小 → 更保守
KELLY_FRACTION=0.5
# --- 价格防护 ---
# ╔══════════════════════════════════════════════════════════════╗
# ║ 价格防护 ║
# ╚══════════════════════════════════════════════════════════════╝
# 允许跟单的最低 / 最高价格
# 极端价格(<0.10 或 >0.90)通常是噪音或信息已充分定价,赔率极差
# 调大范围 → 接收更多信号但质量可能下降;收窄范围 → 只跟踪中等赔率市场
MIN_PRICE=0.10
MAX_PRICE=0.90
# --- 交易规则 ---
# ╔══════════════════════════════════════════════════════════════╗
# ║ 交易规则 ║
# ╚══════════════════════════════════════════════════════════════╝
# 被监控钱包的单笔最低交易金额(美元),低于此值被忽略
# 调大 → 过滤小额噪音,信号更少但更可靠;调小 → 更多信号但可能包含噪音
MIN_TRADE_SIZE_USD=500
# 信号产生后的模拟执行延迟(秒),实盘时有用
EXECUTION_DELAY_SECONDS=5
# 是否启用实盘交易(true=实盘下单,false=仅记录信号不执行)
# 设为 true 前必须填写下方的 POLY_API_KEY 等 CLOB 凭证
ENABLE_EXECUTION=false
# --- 钱包池(top N 监控)---
# ╔══════════════════════════════════════════════════════════════╗
# ║ 钱包池(目标钱包筛选) ║
# ╚══════════════════════════════════════════════════════════════╝
# 钱包池上限(最多跟踪多少个钱包)
# 实际数量取决于多少钱包通过下方三道过滤门槛,不足则全取
# 调大 → 池子更大,共识信号可能更多;调小 → 更聚焦
WALLET_POOL_SIZE=100
# ═══════════════════════════════════════════════════════════════
# 以下三个过滤条件共用一个时间窗口:WALLET_PNL_WINDOW_DAYS
# ═══════════════════════════════════════════════════════════════
# 钱包最低总盈亏(美元)— 窗口内的现金盈亏 + 已平仓盈亏
# 现金盈亏 = 当前持仓 cashPnl;已平仓盈亏 = /closed-positions 按 timestamp 过滤
# 调大 → 只要高盈利钱包;调小 → 扩大池子,可能混入不稳定钱包
WALLET_PNL_MIN_USD=5000
# 钱包最少交易笔数 — /trades 接口,按 transactionHash 去重,仅统计窗口内
# 调大 → 只要经验丰富的钱包;调小 → 扩大池子,包含新手钱包
WALLET_MIN_TRADES=30
# 钱包最少覆盖品类数 — /trades + /positions 的 eventSlug 合并去重,仅统计窗口内
# 调大 → 只要多元化钱包;调小 → 扩大池子,包含专注单一品类的钱包
WALLET_MIN_CATEGORIES=3
# 时间窗口(天),以上三个过滤条件共用此窗口
# 默认 90 天(从 30 天改为 90 天以降低幸存者偏差 — 只看 30 天会过度偏向
# 近期运气好的钱包,而 90 天能过滤掉短期波动,识别真正稳定的盈利者)
# 调大 → 数据量更大,门槛变低,更多钱包通过;调小 → 只看近期,更严格
WALLET_PNL_WINDOW_DAYS=90
# /closed-positions 分页上限(每页 50 条,20 页 = 1000 条)
# 超活跃钱包在 90 天窗口内可能产生 500+ 平仓记录,上限太低会截断 PnL
# 贝叶斯更新阶段自动用 3 倍此值(只处理池内 ~100 钱包,可承受更多 API 调用)
# 调大 → PnL 更准确但 API 调用更多;调小 → 更快但可能低估活跃钱包的 PnL
CLOSED_POSITIONS_MAX_PAGES=20
# 钱包池刷新间隔(小时),到期后重新扫描市场 + 重新评估钱包
# 调小 → 更频繁刷新,钱包池更新更快但 API 调用更多
# 调大 → 减少 API 压力,但可能错过新晋优质钱包
WALLET_REFRESH_HOURS=24
# --- 贝叶斯先验 ---
# ╔══════════════════════════════════════════════════════════════╗
# ║ 贝叶斯信誉分先验参数 ║
# ╚══════════════════════════════════════════════════════════════╝
# 新钱包的初始信誉分(0~1),0.5 表示"不确定其能力"
# 调大 → 对新钱包更信任,信号更容易触发;调小 → 对新钱包更谨慎
BAYESIAN_PRIOR_SKILL=0.5
# 历史表现衰减窗口(天),通过 /closed-positions 的 timestamp 字段过滤
# 只统计此窗口内的平仓盈亏来更新信誉分,超出窗口的平仓记录被忽略
# 调大 → 历史数据保留更久;调小 → 更看重近期表现
BAYESIAN_DECAY_DAYS=14
# --- Telegram 通知 ---
# 贝叶斯更新步长(0~1),控制单次信誉分变化幅度
# 0.05 = 每次最多调整 5%,比较保守;0.1 = 更激进
# 调大 → 信誉分变化更快但可能过度反应;调小 → 更平稳但适应慢
BAYESIAN_STEP=0.05
# ╔══════════════════════════════════════════════════════════════╗
# ║ Telegram 通知 ║
# ╚══════════════════════════════════════════════════════════════╝
# 是否开启 Telegram 信号推送
TELEGRAM_ENABLED=false
# Telegram Bot Token(从 @BotFather 获取)
TELEGRAM_BOT_TOKEN=
# Telegram 接收消息的 Chat ID(用户或群组 ID)
TELEGRAM_CHAT_ID=
# --- Polymarket CLOB (仅启用实盘时填) ---
# ╔══════════════════════════════════════════════════════════════╗
# ║ Polymarket CLOB 实盘凭证(启用实盘时必填) ║
# ╚══════════════════════════════════════════════════════════════╝
# Polymarket API Key(从 polymarket.com/settings/api 获取)
POLY_API_KEY=
# Polymarket API Secret
POLY_API_SECRET=
# Polymarket API Passphrase
POLY_API_PASSPHRASE=
# 钱包私钥(用于链上签名下单)
POLY_WALLET_PRIVATE_KEY=
# --- HTTP / 代理(按需) ---
# ╔══════════════════════════════════════════════════════════════╗
# ║ HTTP / 代理(按需配置) ║
# ╚══════════════════════════════════════════════════════════════╝
# HTTP 代理地址,用于访问 Polymarket API(国内网络可能需要)
# 格式: http://127.0.0.1:7890Clash/V2Ray 等代理)
# 留空则直连,不经过代理
HTTP_PROXY=
# --- 数据源轮询 ---
# ╔══════════════════════════════════════════════════════════════╗
# ║ 数据源轮询参数 ║
# ╚══════════════════════════════════════════════════════════════╝
# 轮询间隔(秒),每隔多久拉取一次所有钱包的最新交易
# 调小 → 更及时但 API 调用更多(注意频率限制);调大 → 省 API 但可能延迟
USER_POLL_INTERVAL_SECONDS=30
# 预热时长(秒),启动后跳过历史交易的时间窗口
# 避免机器人把启动前的旧交易当作"新交易"来跟单
# 调大 → 更安全地跳过热启动历史;调小 → 更快开始工作
STREAM_WARMUP_SECONDS=30
# 每个钱包每次拉取的最大交易记录数
# 预热期间会用这笔数建立"已见过"的基准线
# 调大 → 基准线更长,预热更慢;调小 → 更快但可能漏掉部分历史
STREAM_MAX_TRADES_PER_WALLET=20
# --- 共识参数 ---
# 是否开启详细轮询日志(每轮都打印 poll 信息)
# true → 每 30s 输出一次 poll 统计;false → 每 10 轮才输出一次
STREAM_VERBOSE_LOGGING=false
# ╔══════════════════════════════════════════════════════════════╗
# ║ 共识信号参数 ║
# ╚══════════════════════════════════════════════════════════════╝
# 共识时间窗口(秒),在此窗口内多个钱包的同方向交易才算"共识"
# 调大 → 更容易形成共识但信号可能滞后;调小 → 信号更及时但共识更难达成
CONSENSUS_WINDOW_SECONDS=600
# 最少共识钱包数,至少 N 个钱包同方向交易才触发信号
# 调大 → 信号更可靠但数量更少;调小 → 信号更多但可能包含噪音
CONSENSUS_MIN_WALLETS=2
# 共识强度阈值,买入强度 - 卖出强度 必须 ≥ 此值才触发
# 强度 = 各钱包信誉分之和,0.4 约等于 1 个 0.4 分钱包或 2 个 0.2 分钱包
# 调大 → 信号更确定但更难触发;调小 → 更容易触发信号
CONSENSUS_STRENGTH_THRESHOLD=0.4
# 钱包防抖(秒),同一钱包在同一市场 N 秒内只处理一次交易
# 防止同一钱包短时间内多次交易产生重复信号
# 调大 → 防抖更严格;调小 → 更敏感但可能重复
WALLET_DEBOUNCE_SECONDS=600
# 最低信誉分,信誉分低于此值的钱包被忽略
# 0~10.3 是比较宽松的阈值
# 调大 → 只跟高信誉钱包;调小 → 更包容但可能跟踪表现差的钱包
MIN_CREDIBILITY=0.3
# 信誉分更新间隔(分钟),贝叶斯算法根据最新表现重新计算钱包信誉
# 调小 → 信誉分变化更频繁;调大 → 更新更平稳
CREDIBILITY_UPDATE_MINUTES=60
# --- 调试日志 ---
# ╔══════════════════════════════════════════════════════════════╗
# ║ 信号过滤(策略修复) ║
# ╚══════════════════════════════════════════════════════════════╝
# 仅发 BUY 信号。SELL 在 Polymarket = 卖出已持有的 token(非做空),
# 无持仓跟踪无法跟单 SELL,仅记录为反向指标
# true → 只跟 BUY(推荐);false → 也跟 SELL 信号
BUY_ONLY_SIGNALS=true
# 同市场信号冷却(秒)— 同一 condition_id 发出信号后 N 秒内不再重复
# 86400 = 1 天,防止同一市场短时间内反复发信号
# 调大 → 更保守,一天最多一个信号/市场;调小 → 更频繁
SIGNAL_COOLDOWN_SECONDS=86400
# 跳过距结算不足 N 小时的市场(流动性薄 + 结算风险高)
# 24 = 跳过 24 小时内结算的市场
# 调大 → 更安全但可跟的市场更少;调小 → 接受更高结算风险
MIN_HOURS_TO_RESOLUTION=24
# ╔══════════════════════════════════════════════════════════════╗
# ║ 钱包池过滤(策略修复) ║
# ╚══════════════════════════════════════════════════════════════╝
# 排除做市商(同一 conditionId 持有 Yes+No 双边持仓的钱包)
# 做市商的交易不是方向性的,跟单无意义
# true → 排除双边持仓 >10% 的钱包;false → 不排除
EXCLUDE_MARKET_MAKERS=true
# 未实现 cashPnl 折扣(0.0~1.0
# Polymarket 中间价常高估实际可成交价(薄流动性 + bid-ask spread
# 0.5 = 只计一半未实现盈亏;1.0 = 全额计入;0.0 = 完全忽略未实现盈亏
CASH_PNL_DISCOUNT=0.5
# ╔══════════════════════════════════════════════════════════════╗
# ║ Kelly 仓位管理(策略修复) ║
# ╚══════════════════════════════════════════════════════════════╝
# 历史已 resolve 的信号不足 N 条时,不用 Kelly 公式,改用保守固定仓位
# 防止数据不足时 Kelly 公式产生不可靠的仓位建议
# 调大 → Kelly 更晚启用,前期更保守;调小 → Kelly 更早启用但可能不准
KELLY_MIN_SAMPLES=50
# Kelly 数据不足时的保守固定仓位比例(占本金百分比)
# 0.01 = 1%,即 $100 本金时每次下 $1
# 调大 → 前期仓位更大;调小 → 更保守
KELLY_FALLBACK_FRACTION=0.01
# ╔══════════════════════════════════════════════════════════════╗
# ║ 风控熔断(策略修复) ║
# ╚══════════════════════════════════════════════════════════════╝
# 信号发出前会检查三道风控闸门:日亏损 / 连续亏损 / 最大持仓
# 任一闸门触发都会阻止新信号产生
# 日亏损上限(美元)— 24h 内已实现亏损超过此值则暂停发信号
# 调大 → 容忍更大日内亏损;调小 → 更快止损
MAX_DAILY_LOSS_USD=500
# 连续亏损次数上限 — 连续 N 次信号亏损则暂停
# 调大 → 容忍更长连亏;调小 → 更快暂停
MAX_CONSECUTIVE_LOSSES=5
# 熔断暂停时长(分钟)— 闸门触发后暂停 N 分钟
# 调大 → 暂停更久,给市场更多时间恢复;调小 → 更快恢复
RISK_PAUSE_MINUTES=60
# 最大同时持仓数 — 未 resolve 的信号数超过此值则不发新信号
# 调大 → 允许更多并行持仓;调小 → 更集中
MAX_OPEN_POSITIONS=10
# ╔══════════════════════════════════════════════════════════════╗
# ║ 信号结果回填(策略分析) ║
# ╚══════════════════════════════════════════════════════════════╝
# 信号发出后,市场结算的结果会被自动回填到 copy_signals 表
# 数据用于 /analytics 看板的命中率与 PnL 聚合统计
# 回填循环间隔(分钟),每 N 分钟扫描一次未回填的信号
# 调小 → 更及时回填新结果但 API 调用更多;调大 → 更省 API
OUTCOME_RESOLVE_MINUTES=15
# 每批扫描的最大信号数(防止一次性打太多 API)
# 调大 → 单次回填更快但可能集中触发限流;调小 → 更温和
OUTCOME_RESOLVE_BATCH_SIZE=50
# 单次 /markets 请求超时(秒)
OUTCOME_RESOLVE_TIMEOUT=5.0
# ╔══════════════════════════════════════════════════════════════╗
# ║ 调试日志 ║
# ╚══════════════════════════════════════════════════════════════╝
# 是否打印 API 返回的原始交易数据(true=会输出大量日志,仅调试时用)
DEBUG_LOG_API_PAYLOADS=false
# --- 数据库 ---
# ╔══════════════════════════════════════════════════════════════╗
# ║ 数据库 ║
# ╚══════════════════════════════════════════════════════════════╝
# SQLite 数据库文件路径(相对项目根目录)
# 删除此文件即可清空所有数据,重新冷启动
DB_PATH=data/copytrader.db
# --- 日志 ---
LOG_LEVEL=INFO
# ╔══════════════════════════════════════════════════════════════╗
# ║ 日志级别 ║
# ╚══════════════════════════════════════════════════════════════╝
# 日志级别: DEBUG / INFO / WARNING / ERROR
# DEBUG → 输出所有调试信息(包括每笔交易过滤详情)
# INFO → 正常运行时推荐(信号、轮询统计、心跳等)
# WARNING → 仅警告和错误
LOG_LEVEL=INFO
+207
View File
@@ -0,0 +1,207 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[codz]
*$py.class
# C extensions
*.so
# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST
# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec
# Installer logs
pip-log.txt
pip-delete-this-directory.txt
# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py.cover
.hypothesis/
.pytest_cache/
cover/
# Translations
*.mo
*.pot
# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal
# Flask stuff:
instance/
.webassets-cache
# Scrapy stuff:
.scrapy
# Sphinx documentation
docs/_build/
# PyBuilder
.pybuilder/
target/
# Jupyter Notebook
.ipynb_checkpoints
# IPython
profile_default/
ipython_config.py
# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version
# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock
# UV
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
#uv.lock
# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock
#poetry.toml
# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
# pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
# https://pdm-project.org/en/latest/usage/project/#working-with-version-control
#pdm.lock
#pdm.toml
.pdm-python
.pdm-build/
# pixi
# Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
#pixi.lock
# Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
# in the .venv directory. It is recommended not to include this directory in version control.
.pixi
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/
# Celery stuff
celerybeat-schedule
celerybeat.pid
# SageMath parsed files
*.sage.py
# Environments
.env
.envrc
.venv
env/
venv/
ENV/
env.bak/
venv.bak/
# Spyder project settings
.spyderproject
.spyproject
# Rope project settings
.ropeproject
# mkdocs documentation
/site
# mypy
.mypy_cache/
.dmypy.json
dmypy.json
# Pyre type checker
.pyre/
# pytype static type analyzer
.pytype/
# Cython debug symbols
cython_debug/
# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/
# Abstra
# Abstra is an AI-powered process automation framework.
# Ignore directories containing user credentials, local state, and settings.
# Learn more at https://abstra.io/docs
.abstra/
# Visual Studio Code
# Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
# that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
# and can be added to the global gitignore or merged into this file. However, if you prefer,
# you could uncomment the following to ignore the entire vscode folder
# .vscode/
# Ruff stuff:
.ruff_cache/
# PyPI configuration file
.pypirc
# Cursor
# Cursor is an AI-powered code editor. `.cursorignore` specifies files/directories to
# exclude from AI features like autocomplete and code analysis. Recommended for sensitive data
# refer to https://docs.cursor.com/context/ignore-files
.cursorignore
.cursorindexingignore
# Marimo
marimo/_static/
marimo/_lsp/
__marimo__/
+69
View File
@@ -0,0 +1,69 @@
# Polymarket Documentation - Daily Update Instructions for AI Agent
## Mission
Your task is to check for updates to the Polymarket documentation and push any changes to the GitHub repository daily.
## What You Are
You are an AI assistant responsible for keeping the Polymarket documentation synchronized with the official docs.polymarket.com website.
## When to Run
Execute this task once per day. Choose a consistent time (e.g., early morning your time).
## Step-by-Step Instructions
### Step 1: Navigate to the Repository
Go to the PolymarketDocumentation folder:
```
/home/himalaya/clawd/PolymarketDocumentation
```
### Step 2: Check if TARGET.md Has New URLs
Read the TARGET.md file and check if any new URLs have been added compared to what's already been scraped. The file contains a list of documentation URLs that need to be fetched.
### Step 3: Scrape New or Updated Pages
For each URL in TARGET.md that doesn't already have a corresponding file in the docs/ folder, or if you suspect the official docs have been updated:
1. Use the web_fetch tool or curl to fetch each URL
2. Save the content as a .md file in the appropriate docs/ subfolder
3. Match the folder structure to the URL path (e.g., `/quickstart/overview.md` goes in `docs/quickstart/`)
### Step 4: Check for Changes
Run `git status` to see what files have been added or modified.
### Step 5: Commit Changes
If there are new or updated files:
1. Add all changes: `git add -A`
2. Commit with a message that includes today's date, for example: "Update Polymarket documentation - 2026-02-14"
3. Use `git commit` to save the changes locally
### Step 6: Push to GitHub
After committing, push the changes to the remote repository:
```
git push origin main
```
### Step 7: Report
Tell the user what was done:
- How many new files were added
- Which sections were updated
- Confirm the push was successful
## Important Notes
- Only commit and push if there are actual changes
- If TARGET.md hasn't changed and all docs are already scraped, simply report "No updates needed today"
- Keep the folder structure organized - match the URL paths
- The repository is at: https://github.com/Etherdrake/PolymarketDocumentation
## Example Output
When you complete this task, say something like:
"Checked Polymarket documentation. No new URLs in TARGET.md and all 117 files already present. No update needed today."
OR:
"Updated Polymarket documentation: Added 3 new API reference files (get-market-price, get-order-book, list-events). Pushed to GitHub successfully."
## Manual Trigger
If the user asks you to check for updates, run through these steps immediately rather than waiting for your daily schedule.
@@ -0,0 +1,202 @@
# Polymarket Documentation Scraper Instructions
## Overview
This document contains instructions for scraping Polymarket documentation from `docs.polymarket.com` and organizing it into the GitHub repository.
The target URLs are stored in `TARGET.md` - edit that file to add/remove URLs to scrape.
## How It Works
1. **TARGET.md** - Contains the list of URLs to scrape (one per line)
2. **INSTRUCTIONS.md** - This file with scraping instructions
3. **scrape.sh** - The automation script that reads from TARGET.md
## Quick Start
```bash
cd /home/himalaya/clawd/PolymarketDocumentation
./scrape.sh
```
## Directory Structure
Organize the scraped files into the following structure:
```
PolymarketDocumentation/
├── TARGET.md # Source URLs (edit this file)
├── INSTRUCTIONS.md # This file
├── scrape.sh # Automation script
├── quickstart/
│ ├── overview.md
│ ├── fetching-data.md
│ ├── first-order.md
│ └── reference/
│ ├── glossary.md
│ ├── endpoints.md
│ └── introduction/
│ └── rate-limits.md
├── developers/
│ ├── market-makers/
│ │ ├── introduction.md
│ │ ├── setup.md
│ │ ├── trading.md
│ │ ├── liquidity-rewards.md
│ │ ├── maker-rebates-program.md
│ │ ├── data-feeds.md
│ │ └── inventory.md
│ ├── CLOB/
│ │ ├── introduction.md
│ │ ├── status.md
│ │ ├── quickstart.md
│ │ ├── authentication.md
│ │ ├── geoblock.md
│ │ ├── timeseries.md
│ │ ├── clients/
│ │ │ ├── methods-overview.md
│ │ │ ├── methods-public.md
│ │ │ ├── methods-l1.md
│ │ │ ├── methods-l2.md
│ │ │ └── methods-builder.md
│ │ ├── orders/
│ │ │ ├── orders.md
│ │ │ ├── create-order.md
│ │ │ ├── create-order-batch.md
│ │ │ ├── get-order.md
│ │ │ ├── get-active-order.md
│ │ │ ├── check-scoring.md
│ │ │ ├── cancel-orders.md
│ │ │ └── onchain-order-info.md
│ │ ├── trades/
│ │ │ ├── trades-overview.md
│ │ │ └── trades.md
│ │ └── websocket/
│ │ ├── wss-overview.md
│ │ ├── wss-auth.md
│ │ ├── user-channel.md
│ │ └── market-channel.md
│ ├── sports-websocket/
│ │ ├── overview.md
│ │ ├── message-format.md
│ │ └── quickstart.md
│ ├── RTDS/
│ │ ├── RTDS-overview.md
│ │ ├── RTDS-crypto-prices.md
│ │ └── RTDS-comments.md
│ └── gamma-markets-api/
│ ├── overview.md
│ ├── gamma-structure.md
│ └── fetch-markets-guide.md
├── api-reference/
│ ├── orderbook/
│ │ ├── get-order-book-summary.md
│ │ └── get-multiple-order-books-summaries-by-request.md
│ ├── pricing/
│ │ ├── get-market-price.md
│ │ ├── get-multiple-market-prices.md
│ │ ├── get-multiple-market-prices-by-request.md
│ │ ├── get-midpoint-price.md
│ │ └── get-price-history-for-a-traded-token.md
│ └── spreads/
│ └── get-bid-ask-spreads.md
└── quickstart-websocket/
└── WSS-Quickstart.md
```
## The Scrape Script (scrape.sh)
```bash
#!/bin/bash
# Base URL
BASE_URL="https://docs.polymarket.com"
# Output directory
OUTPUT_DIR="PolymarketDocumentation"
# Create output directory
mkdir -p "$OUTPUT_DIR"
# Read URLs from TARGET.md (skip comments and empty lines)
grep -v '^#' "$OUTPUT_DIR/TARGET.md" | grep -v '^$' | while read -r url; do
# Extract the path portion (remove https://docs.polymarket.com/)
path="${url#https://docs.polymarket.com/}"
# Remove .md extension for directory structure
filename=$(basename "$path" .md)
dir=$(dirname "$path")
# Create directory
mkdir -p "$OUTPUT_DIR/$dir"
# Determine output file path
output_file="$OUTPUT_DIR/$path"
# Fetch the page
echo "Fetching: $url -> $output_file"
curl -s "$url" -o "$output_file"
# Check if successful
if [ $? -eq 0 ] && [ -s "$output_file" ]; then
echo " ✅ Success: $filename"
else
echo " ❌ Failed: $filename"
fi
# Rate limit (0.5 seconds between requests)
sleep 0.5
done
echo "Done! Scraped files to $OUTPUT_DIR/"
```
## Alternative: Using Python Script
```python
#!/usr/bin/env python3
import os
import urllib.request
import time
import re
BASE_URL = "https://docs.polymarket.com"
OUTPUT_DIR = "PolymarketDocumentation"
# Read URLs from TARGET.md
with open("TARGET.md", "r") as f:
urls = [line.strip() for line in f if line.strip() and not line.startswith("#")]
for url in urls:
# Extract path and create directories
path = url.replace("https://docs.polymarket.com/", "")
filepath = os.path.join(OUTPUT_DIR, path)
os.makedirs(os.path.dirname(filepath), exist_ok=True)
# Fetch the page
print(f"Fetching: {url}")
try:
urllib.request.urlretrieve(url, filepath)
print(f" ✅ Saved: {filepath}")
except Exception as e:
print(f" ❌ Error: {e}")
# Rate limit
time.sleep(0.5)
print("Done!")
```
## Notes
- The `.md` suffix converts HTML pages to markdown format automatically
- Some URLs may require authentication - handle accordingly
- Rate limiting should be respected between requests
- Check for HTTP 200 status codes to verify successful fetches
## Adding New URLs
To add new URLs to scrape, simply edit `TARGET.md` and add the URL on a new line:
```markdown
## New Section
https://docs.polymarket.com/new-section/page.md
```
Then run the scrape script again to fetch the new URLs.
+21
View File
@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2026 Max Bodewes
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
+2
View File
@@ -0,0 +1,2 @@
# PolymarketDocumentation
Full and completely scraped and maintained Polymarket documentation
+488
View File
@@ -0,0 +1,488 @@
# Target URLs for Polymarket Documentation
These URLs will be scraped and organized into the repository.
## Quickstart
https://docs.polymarket.com/quickstart.md
https://docs.polymarket.com/quickstart/overview.md
https://docs.polymarket.com/quickstart/fetching-data.md
https://docs.polymarket.com/quickstart/first-order.md
https://docs.polymarket.com/quickstart/introduction/rate-limits.md
https://docs.polymarket.com/quickstart/reference/endpoints.md
## Market Makers
https://docs.polymarket.com/market-makers/overview.md
https://docs.polymarket.com/market-makers/getting-started.md
https://docs.polymarket.com/market-makers/trading.md
https://docs.polymarket.com/market-makers/liquidity-rewards.md
https://docs.polymarket.com/market-makers/maker-rebates.md
https://docs.polymarket.com/market-makers/inventory.md
https://docs.polymarket.com/market-makers/combos.md
https://docs.polymarket.com/developers/market-makers/introduction.md
https://docs.polymarket.com/developers/market-makers/setup.md
https://docs.polymarket.com/developers/market-makers/data-feeds.md
## Polymarket Builders Program
https://docs.polymarket.com/builders/overview.md
https://docs.polymarket.com/builders/tiers.md
https://docs.polymarket.com/builders/api-keys.md
https://docs.polymarket.com/developers/builders/builder-intro.md
https://docs.polymarket.com/developers/builders/builder-tiers.md
https://docs.polymarket.com/developers/builders/builder-profile.md
https://docs.polymarket.com/developers/builders/order-attribution.md
https://docs.polymarket.com/developers/builders/relayer-client.md
https://docs.polymarket.com/developers/builders/blockchain-data-resources.md
https://docs.polymarket.com/developers/builders/examples.md
## Central Limit Order Book (CLOB)
https://docs.polymarket.com/trading/overview.md
https://docs.polymarket.com/trading/quickstart.md
https://docs.polymarket.com/developers/CLOB/introduction.md
https://docs.polymarket.com/developers/CLOB/status.md
https://docs.polymarket.com/developers/CLOB/quickstart.md
https://docs.polymarket.com/developers/CLOB/authentication.md
https://docs.polymarket.com/developers/CLOB/geoblock.md
https://docs.polymarket.com/developers/CLOB/clients/methods-overview.md
https://docs.polymarket.com/developers/CLOB/clients/methods-public.md
https://docs.polymarket.com/developers/CLOB/clients/methods-l1.md
https://docs.polymarket.com/developers/CLOB/clients/methods-l2.md
https://docs.polymarket.com/developers/CLOB/clients/methods-builder.md
## API Reference - Market Data
https://docs.polymarket.com/api-reference/introduction.md
https://docs.polymarket.com/api-reference/authentication.md
https://docs.polymarket.com/api-reference/rate-limits.md
https://docs.polymarket.com/api-reference/geoblock.md
https://docs.polymarket.com/api-reference/clients-sdks.md
## API Reference - Market Data (Data API)
https://docs.polymarket.com/market-data/overview.md
https://docs.polymarket.com/market-data/fetching-markets.md
https://docs.polymarket.com/api-reference/market-data/get-order-book.md
https://docs.polymarket.com/api-reference/market-data/get-order-books-request-body.md
https://docs.polymarket.com/api-reference/market-data/get-market-price.md
https://docs.polymarket.com/api-reference/market-data/get-market-prices-query-parameters.md
https://docs.polymarket.com/api-reference/market-data/get-market-prices-request-body.md
https://docs.polymarket.com/api-reference/data/get-midpoint-price.md
https://docs.polymarket.com/api-reference/market-data/get-midpoint-prices-query-parameters.md
https://docs.polymarket.com/api-reference/market-data/get-midpoint-prices-request-body.md
https://docs.polymarket.com/api-reference/market-data/get-spread.md
https://docs.polymarket.com/api-reference/market-data/get-spreads.md
https://docs.polymarket.com/api-reference/market-data/get-last-trade-price.md
https://docs.polymarket.com/api-reference/market-data/get-last-trade-prices-query-parameters.md
https://docs.polymarket.com/api-reference/market-data/get-last-trade-prices-request-body.md
https://docs.polymarket.com/api-reference/market-data/get-fee-rate.md
https://docs.polymarket.com/api-reference/market-data/get-fee-rate-by-path-parameter.md
https://docs.polymarket.com/api-reference/market-data/get-tick-size.md
https://docs.polymarket.com/api-reference/market-data/get-tick-size-by-path-parameter.md
https://docs.polymarket.com/api-reference/data/get-server-time.md
## API Reference - Orderbook
## API Reference - WSS RFQ
https://docs.polymarket.com/api-reference/wss/rfq.md
## API Reference - Trade (CLOB)
https://docs.polymarket.com/api-reference/trade/post-a-new-order.md
https://docs.polymarket.com/api-reference/trade/post-multiple-orders.md
https://docs.polymarket.com/api-reference/trade/get-single-order-by-id.md
https://docs.polymarket.com/api-reference/trade/get-user-orders.md
https://docs.polymarket.com/api-reference/trade/get-trades.md
https://docs.polymarket.com/api-reference/trade/cancel-single-order.md
https://docs.polymarket.com/api-reference/trade/cancel-multiple-orders.md
https://docs.polymarket.com/api-reference/trade/cancel-all-orders.md
https://docs.polymarket.com/api-reference/trade/cancel-orders-for-a-market.md
https://docs.polymarket.com/api-reference/trade/get-order-scoring-status.md
https://docs.polymarket.com/api-reference/trade/send-heartbeat.md
https://docs.polymarket.com/api-reference/trade/get-builder-trades.md
## Historical Timeseries Data
https://docs.polymarket.com/developers/CLOB/timeseries.md
## Order Management
https://docs.polymarket.com/developers/CLOB/orders/orders.md
https://docs.polymarket.com/developers/CLOB/orders/create-order.md
https://docs.polymarket.com/developers/CLOB/orders/create-order-batch.md
https://docs.polymarket.com/developers/CLOB/orders/get-order.md
https://docs.polymarket.com/developers/CLOB/orders/get-active-order.md
https://docs.polymarket.com/developers/CLOB/orders/check-scoring.md
https://docs.polymarket.com/developers/CLOB/orders/cancel-orders.md
https://docs.polymarket.com/developers/CLOB/orders/onchain-order-info.md
https://docs.polymarket.com/trading/orders/overview.md
https://docs.polymarket.com/trading/orders/create.md
https://docs.polymarket.com/trading/orders/cancel.md
https://docs.polymarket.com/trading/orders/attribution.md
## Trades
https://docs.polymarket.com/developers/CLOB/trades/trades-overview.md
https://docs.polymarket.com/developers/CLOB/trades/trades.md
## Websocket
https://docs.polymarket.com/market-data/websocket/overview.md
https://docs.polymarket.com/market-data/websocket/market-channel.md
https://docs.polymarket.com/market-data/websocket/user-channel.md
https://docs.polymarket.com/developers/CLOB/websocket/wss-overview.md
https://docs.polymarket.com/quickstart/websocket/WSS-Quickstart.md
https://docs.polymarket.com/developers/CLOB/websocket/wss-auth.md
https://docs.polymarket.com/developers/CLOB/websocket/user-channel.md
https://docs.polymarket.com/developers/CLOB/websocket/market-channel.md
https://docs.polymarket.com/api-reference/wss/market.md
https://docs.polymarket.com/api-reference/wss/user.md
## Sports Websocket
https://docs.polymarket.com/developers/sports-websocket/overview.md
https://docs.polymarket.com/developers/sports-websocket/message-format.md
https://docs.polymarket.com/developers/sports-websocket/quickstart.md
https://docs.polymarket.com/market-data/websocket/sports.md
https://docs.polymarket.com/api-reference/wss/sports.md
## Real Time Data Stream
https://docs.polymarket.com/market-data/websocket/rtds.md
https://docs.polymarket.com/developers/RTDS/RTDS-overview.md
https://docs.polymarket.com/developers/RTDS/RTDS-crypto-prices.md
https://docs.polymarket.com/developers/RTDS/RTDS-comments.md
## Gamma Structure
https://docs.polymarket.com/developers/gamma-markets-api/overview.md
https://docs.polymarket.com/developers/gamma-markets-api/gamma-structure.md
https://docs.polymarket.com/developers/gamma-markets-api/fetch-markets-guide.md
## Gamma Endpoints - Status
## API Reference - Sports
https://docs.polymarket.com/api-reference/sports/list-teams.md
https://docs.polymarket.com/api-reference/sports/get-sports-metadata-information.md
https://docs.polymarket.com/api-reference/sports/get-valid-sports-market-types.md
## API Reference - Tags
https://docs.polymarket.com/api-reference/tags/list-tags.md
https://docs.polymarket.com/api-reference/tags/get-tag-by-id.md
https://docs.polymarket.com/api-reference/tags/get-tag-by-slug.md
https://docs.polymarket.com/api-reference/tags/get-related-tags-relationships-by-tag-id.md
https://docs.polymarket.com/api-reference/tags/get-related-tags-relationships-by-tag-slug.md
https://docs.polymarket.com/api-reference/tags/get-tags-related-to-a-tag-id.md
https://docs.polymarket.com/api-reference/tags/get-tags-related-to-a-tag-slug.md
## API Reference - Events
https://docs.polymarket.com/api-reference/events/list-events.md
https://docs.polymarket.com/api-reference/events/list-events-keyset-pagination.md
https://docs.polymarket.com/api-reference/events/get-event-by-id.md
https://docs.polymarket.com/api-reference/events/get-event-tags.md
https://docs.polymarket.com/api-reference/events/get-event-by-slug.md
## API Reference - Markets
https://docs.polymarket.com/api-reference/markets/list-markets.md
https://docs.polymarket.com/api-reference/markets/list-markets-keyset-pagination.md
https://docs.polymarket.com/api-reference/markets/get-market-by-id.md
https://docs.polymarket.com/api-reference/markets/get-market-tags-by-id.md
https://docs.polymarket.com/api-reference/markets/get-market-by-slug.md
https://docs.polymarket.com/api-reference/markets/get-clob-market-info.md
https://docs.polymarket.com/api-reference/markets/get-market-by-token.md
https://docs.polymarket.com/api-reference/markets/get-prices-history.md
https://docs.polymarket.com/api-reference/markets/get-batch-prices-history.md
https://docs.polymarket.com/api-reference/markets/get-sampling-markets.md
https://docs.polymarket.com/api-reference/markets/get-simplified-markets.md
https://docs.polymarket.com/api-reference/markets/get-sampling-simplified-markets.md
## API Reference - Series
https://docs.polymarket.com/api-reference/series/list-series.md
https://docs.polymarket.com/api-reference/series/get-series-by-id.md
## API Reference - Comments
https://docs.polymarket.com/api-reference/comments/list-comments.md
https://docs.polymarket.com/api-reference/comments/get-comments-by-comment-id.md
https://docs.polymarket.com/api-reference/comments/get-comments-by-user-address.md
## API Reference - Profiles
https://docs.polymarket.com/api-reference/profiles/get-public-profile-by-wallet-address.md
## API Reference - Search
https://docs.polymarket.com/api-reference/search/search-markets-events-and-profiles.md
## API Reference - Data API Status
## API Reference - Misc
https://docs.polymarket.com/api-reference/misc/download-an-accounting-snapshot-zip-of-csvs.md
https://docs.polymarket.com/api-reference/misc/get-total-markets-a-user-has-traded.md
https://docs.polymarket.com/api-reference/misc/get-open-interest.md
https://docs.polymarket.com/api-reference/misc/get-live-volume-for-an-event.md
## API Reference - Core
https://docs.polymarket.com/api-reference/core/get-current-positions-for-a-user.md
https://docs.polymarket.com/api-reference/core/get-trades-for-a-user-or-markets.md
https://docs.polymarket.com/api-reference/core/get-user-activity.md
https://docs.polymarket.com/api-reference/core/get-top-holders-for-markets.md
https://docs.polymarket.com/api-reference/core/get-total-value-of-a-users-positions.md
https://docs.polymarket.com/api-reference/core/get-closed-positions-for-a-user.md
https://docs.polymarket.com/api-reference/core/get-trader-leaderboard-rankings.md
https://docs.polymarket.com/api-reference/core/get-positions-for-a-market.md
## API Reference - Builders
https://docs.polymarket.com/api-reference/builders/get-aggregated-builder-leaderboard.md
https://docs.polymarket.com/api-reference/builders/get-daily-builder-volume-time-series.md
## Bridge & Swap - Overview
https://docs.polymarket.com/developers/misc-endpoints/bridge-overview.md
## API Reference - Bridge
https://docs.polymarket.com/api-reference/bridge/get-supported-assets.md
https://docs.polymarket.com/api-reference/bridge/get-a-quote.md
https://docs.polymarket.com/api-reference/bridge/create-withdrawal-addresses.md
https://docs.polymarket.com/api-reference/bridge/get-transaction-status.md
https://docs.polymarket.com/api-reference/bridge/create-bridge-addresses.md
https://docs.polymarket.com/trading/bridge/deposit.md
https://docs.polymarket.com/trading/bridge/quote.md
https://docs.polymarket.com/trading/bridge/status.md
https://docs.polymarket.com/trading/bridge/supported-assets.md
https://docs.polymarket.com/trading/bridge/withdraw.md
## Subgraph
## Resolution
https://docs.polymarket.com/developers/resolution/UMA.md
## Conditional Token Frameworks (CTF)
https://docs.polymarket.com/trading/ctf/overview.md
https://docs.polymarket.com/trading/ctf/split.md
https://docs.polymarket.com/trading/ctf/merge.md
https://docs.polymarket.com/trading/ctf/redeem.md
https://docs.polymarket.com/developers/CTF/overview.md
https://docs.polymarket.com/developers/CTF/split.md
https://docs.polymarket.com/developers/CTF/merge.md
https://docs.polymarket.com/developers/CTF/redeem.md
https://docs.polymarket.com/developers/CTF/deployment-resources.md
## Proxy Wallets
https://docs.polymarket.com/developers/proxy-wallet.md
## Negative Risk
https://docs.polymarket.com/advanced/neg-risk.md
https://docs.polymarket.com/developers/neg-risk/overview.md
## Changelog
https://docs.polymarket.com/changelog/changelog.md
## Polymarket Learn - FAQ
https://docs.polymarket.com/polymarket-learn/FAQ/does-polymarket-have-an-api.md
https://docs.polymarket.com/polymarket-learn/FAQ/embeds.md
https://docs.polymarket.com/polymarket-learn/FAQ/geoblocking.md
https://docs.polymarket.com/polymarket-learn/FAQ/how-to-export-private-key.md
https://docs.polymarket.com/polymarket-learn/FAQ/is-my-money-safe.md
https://docs.polymarket.com/polymarket-learn/FAQ/is-polymarket-the-house.md
https://docs.polymarket.com/polymarket-learn/FAQ/polling.md
https://docs.polymarket.com/polymarket-learn/FAQ/recover-missing-deposit.md
https://docs.polymarket.com/polymarket-learn/FAQ/sell-early.md
https://docs.polymarket.com/polymarket-learn/FAQ/support.md
https://docs.polymarket.com/polymarket-learn/FAQ/wen-token.md
https://docs.polymarket.com/polymarket-learn/FAQ/what-are-prediction-markets.md
https://docs.polymarket.com/polymarket-learn/FAQ/why-do-i-need-crypto.md
## Polymarket Learn - Deposits
https://docs.polymarket.com/polymarket-learn/deposits/coinbase.md
https://docs.polymarket.com/polymarket-learn/deposits/how-to-withdraw.md
https://docs.polymarket.com/polymarket-learn/deposits/large-cross-chain-deposits.md
https://docs.polymarket.com/polymarket-learn/deposits/moonpay.md
https://docs.polymarket.com/polymarket-learn/deposits/supported-tokens.md
https://docs.polymarket.com/polymarket-learn/deposits/usdc-on-eth.md
## Polymarket Learn - Get Started
https://docs.polymarket.com/polymarket-learn/get-started/how-to-deposit.md
https://docs.polymarket.com/polymarket-learn/get-started/how-to-signup.md
https://docs.polymarket.com/polymarket-learn/get-started/making-your-first-trade.md
https://docs.polymarket.com/polymarket-learn/get-started/what-is-polymarket.md
## Polymarket Learn - Markets
https://docs.polymarket.com/polymarket-learn/markets/dispute.md
https://docs.polymarket.com/polymarket-learn/markets/how-are-markets-clarified.md
https://docs.polymarket.com/polymarket-learn/markets/how-are-markets-created.md
https://docs.polymarket.com/polymarket-learn/markets/how-are-markets-resolved.md
## Polymarket Learn - Trading
https://docs.polymarket.com/polymarket-learn/trading/fees.md
https://docs.polymarket.com/polymarket-learn/trading/holding-rewards.md
https://docs.polymarket.com/polymarket-learn/trading/how-are-prices-calculated.md
https://docs.polymarket.com/polymarket-learn/trading/limit-orders.md
https://docs.polymarket.com/polymarket-learn/trading/liquidity-rewards.md
https://docs.polymarket.com/polymarket-learn/trading/maker-rebates-program.md
https://docs.polymarket.com/polymarket-learn/trading/market-orders.md
https://docs.polymarket.com/polymarket-learn/trading/no-limits.md
https://docs.polymarket.com/polymarket-learn/trading/using-the-orderbook.md
## Polymarket 101
https://docs.polymarket.com/polymarket-101.md
## Concepts
https://docs.polymarket.com/concepts/markets-events.md
https://docs.polymarket.com/concepts/order-lifecycle.md
https://docs.polymarket.com/concepts/positions-tokens.md
https://docs.polymarket.com/concepts/prices-orderbook.md
https://docs.polymarket.com/concepts/resolution.md
https://docs.polymarket.com/concepts/pusd.md
## Trading
https://docs.polymarket.com/trading/fees.md
https://docs.polymarket.com/trading/gasless.md
https://docs.polymarket.com/trading/orderbook.md
https://docs.polymarket.com/trading/clients/public.md
https://docs.polymarket.com/trading/clients/l1.md
https://docs.polymarket.com/trading/clients/l2.md
https://docs.polymarket.com/trading/clients/builder.md
https://docs.polymarket.com/trading/deposit-wallets.md
https://docs.polymarket.com/trading/taker-rebates.md
## Index & Resources
https://docs.polymarket.com/index.md
https://docs.polymarket.com/resources/contract-addresses.md
https://docs.polymarket.com/resources/error-codes.md
https://docs.polymarket.com/resources/contracts.md
## NEW - API Reference - Rebates (2026-03-27)
https://docs.polymarket.com/api-reference/rebates/get-current-rebated-fees-for-a-maker.md
## NEW - API Reference - Relayer
https://docs.polymarket.com/api-reference/relayer-api-keys/get-all-relayer-api-keys.md
https://docs.polymarket.com/api-reference/relayer/check-if-a-safe-is-deployed.md
https://docs.polymarket.com/api-reference/relayer/check-if-a-wallet-is-deployed.md
https://docs.polymarket.com/api-reference/relayer/get-a-transaction-by-id.md
https://docs.polymarket.com/api-reference/relayer/get-current-nonce-for-a-user.md
https://docs.polymarket.com/api-reference/relayer/get-recent-transactions-for-a-user.md
https://docs.polymarket.com/api-reference/relayer/get-relayer-address-and-nonce.md
https://docs.polymarket.com/api-reference/relayer/submit-a-transaction.md
## NEW - API Reference - Rewards
https://docs.polymarket.com/api-reference/rewards/get-current-active-rewards-configurations.md
https://docs.polymarket.com/api-reference/rewards/get-earnings-for-user-by-date.md
https://docs.polymarket.com/api-reference/rewards/get-multiple-markets-with-rewards.md
https://docs.polymarket.com/api-reference/rewards/get-raw-rewards-for-a-specific-market.md
https://docs.polymarket.com/api-reference/rewards/get-reward-percentages-for-user.md
https://docs.polymarket.com/api-reference/rewards/get-total-earnings-for-user-by-date.md
https://docs.polymarket.com/api-reference/rewards/get-user-earnings-and-markets-configuration.md
## NEW - Resources
https://docs.polymarket.com/resources/blockchain-data.md
https://docs.polymarket.com/resources/referral-program.md
## NEW - Trading
https://docs.polymarket.com/trading/matching-engine.md
## Dev Tooling
https://docs.polymarket.com/dev-tooling.md
https://docs.polymarket.com/dev-tooling/python.md
https://docs.polymarket.com/dev-tooling/typescript.md
## NEW - Builders
https://docs.polymarket.com/builders/fees.md
## NEW - API Reference - Combo Markets (2026-06-17)
https://docs.polymarket.com/api-reference/combo-markets/get-combo-markets.md
## NEW - API Reference - Core (Combo) (2026-06-17)
https://docs.polymarket.com/api-reference/core/get-user-combo-activity.md
https://docs.polymarket.com/api-reference/core/get-user-combo-positions.md
## NEW - API Reference - Maker (RFQ) (2026-06-17)
https://docs.polymarket.com/api-reference/maker/cancel-a-quote.md
https://docs.polymarket.com/api-reference/maker/confirm-or-decline-last-look.md
https://docs.polymarket.com/api-reference/maker/submit-a-quote.md
## NEW - Perps (2026-07-13)
https://docs.polymarket.com/perps/overview.md
https://docs.polymarket.com/perps/account-management.md
https://docs.polymarket.com/perps/authenticated-sessions.md
https://docs.polymarket.com/perps/changelog.md
https://docs.polymarket.com/perps/concepts.md
https://docs.polymarket.com/perps/faq.md
https://docs.polymarket.com/perps/fund-your-account.md
https://docs.polymarket.com/perps/market-data.md
https://docs.polymarket.com/perps/overview.md
https://docs.polymarket.com/perps/place-your-first-trade.md
https://docs.polymarket.com/perps/rate-limits.md
https://docs.polymarket.com/perps/realtime-updates.md
https://docs.polymarket.com/perps/referral-program.md
https://docs.polymarket.com/perps/trading.md
https://docs.polymarket.com/perps/learn-about-trading/architecture.md
https://docs.polymarket.com/perps/learn-about-trading/fees.md
https://docs.polymarket.com/perps/learn-about-trading/funding.md
https://docs.polymarket.com/perps/learn-about-trading/geographic-restrictions.md
https://docs.polymarket.com/perps/learn-about-trading/index-price.md
https://docs.polymarket.com/perps/learn-about-trading/liquidation-mechanics.md
https://docs.polymarket.com/perps/learn-about-trading/margin.md
https://docs.polymarket.com/perps/learn-about-trading/mark-price.md
https://docs.polymarket.com/perps/learn-about-trading/market-sessions.md
https://docs.polymarket.com/perps/learn-about-trading/markets.md
https://docs.polymarket.com/perps/learn-about-trading/overview.md
## NEW - Perps WebSocket (2026-07-13)
https://docs.polymarket.com/api-reference/wss/perps-auth.md
https://docs.polymarket.com/api-reference/wss/perps-auto-cancel.md
https://docs.polymarket.com/api-reference/wss/perps-balances.md
https://docs.polymarket.com/api-reference/wss/perps-bbo.md
https://docs.polymarket.com/api-reference/wss/perps-book.md
https://docs.polymarket.com/api-reference/wss/perps-cancel-orders.md
https://docs.polymarket.com/api-reference/wss/perps-cancel-orders-coid.md
https://docs.polymarket.com/api-reference/wss/perps-deposits.md
https://docs.polymarket.com/api-reference/wss/perps-fills.md
https://docs.polymarket.com/api-reference/wss/perps-funding.md
https://docs.polymarket.com/api-reference/wss/perps-klines.md
https://docs.polymarket.com/api-reference/wss/perps-orders.md
https://docs.polymarket.com/api-reference/wss/perps-ping.md
https://docs.polymarket.com/api-reference/wss/perps-place-orders.md
https://docs.polymarket.com/api-reference/wss/perps-portfolio.md
https://docs.polymarket.com/api-reference/wss/perps-statistics.md
https://docs.polymarket.com/api-reference/wss/perps-tickers.md
https://docs.polymarket.com/api-reference/wss/perps-trades.md
https://docs.polymarket.com/api-reference/wss/perps-update-leverage.md
https://docs.polymarket.com/api-reference/wss/perps-withdrawals.md
## NEW - Account & Trading API (2026-07-13)
https://docs.polymarket.com/api-reference/apply-referral-code.md
https://docs.polymarket.com/api-reference/cancel-orders.md
https://docs.polymarket.com/api-reference/cancel-orders-coid.md
https://docs.polymarket.com/api-reference/check-invite-code.md
https://docs.polymarket.com/api-reference/create-account-invite.md
https://docs.polymarket.com/api-reference/create-orders.md
https://docs.polymarket.com/api-reference/create-proxy.md
https://docs.polymarket.com/api-reference/delete-proxy.md
https://docs.polymarket.com/api-reference/get-account-limits.md
https://docs.polymarket.com/api-reference/get-account-referral.md
https://docs.polymarket.com/api-reference/get-account-rewards.md
https://docs.polymarket.com/api-reference/get-account-stats.md
https://docs.polymarket.com/api-reference/get-auto-cancel-status.md
https://docs.polymarket.com/api-reference/get-balances.md
https://docs.polymarket.com/api-reference/get-bbo.md
https://docs.polymarket.com/api-reference/get-book.md
https://docs.polymarket.com/api-reference/get-collateral-assets.md
https://docs.polymarket.com/api-reference/get-credentials.md
https://docs.polymarket.com/api-reference/get-deposits.md
https://docs.polymarket.com/api-reference/get-equity.md
https://docs.polymarket.com/api-reference/get-exchange-info.md
https://docs.polymarket.com/api-reference/get-fees.md
https://docs.polymarket.com/api-reference/get-fills.md
https://docs.polymarket.com/api-reference/get-funding-charges.md
https://docs.polymarket.com/api-reference/get-historical-funding.md
https://docs.polymarket.com/api-reference/get-index.md
https://docs.polymarket.com/api-reference/get-instrument-config.md
https://docs.polymarket.com/api-reference/get-instruments.md
https://docs.polymarket.com/api-reference/get-internal-transfers.md
https://docs.polymarket.com/api-reference/get-klines.md
https://docs.polymarket.com/api-reference/get-limit-tiers.md
https://docs.polymarket.com/api-reference/get-open-orders.md
https://docs.polymarket.com/api-reference/get-orders.md
https://docs.polymarket.com/api-reference/get-pnl.md
https://docs.polymarket.com/api-reference/get-portfolio.md
https://docs.polymarket.com/api-reference/get-public-portfolio.md
https://docs.polymarket.com/api-reference/get-recent-trades.md
https://docs.polymarket.com/api-reference/get-server-time.md
https://docs.polymarket.com/api-reference/get-statistics.md
https://docs.polymarket.com/api-reference/get-tickers.md
https://docs.polymarket.com/api-reference/get-withdrawals.md
https://docs.polymarket.com/api-reference/internal-transfer.md
https://docs.polymarket.com/api-reference/set-auto-cancel.md
https://docs.polymarket.com/api-reference/test-connection.md
https://docs.polymarket.com/api-reference/update-leverage.md
https://docs.polymarket.com/api-reference/withdraw.md
@@ -0,0 +1,145 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
> Use this file to discover all available pages before exploring further.
# Negative Risk Markets
> Capital-efficient trading for multi-outcome events
**Negative risk** is a mechanism for multi-outcome events where only one outcome can win. It enables capital-efficient trading by allowing positions across all outcomes within an event to be related through a **conversion** operation.
## How It Works
In a standard multi-outcome event, each market is independent. If you want to bet against one outcome, you must buy that outcome's No tokens—but those No tokens have no relationship to the other outcomes.
Negative risk changes this. In a neg risk event:
* A **No share** in any market can be converted into **1 Yes share in every other market**
* This conversion happens through the Neg Risk Adapter contract
### Example
Consider an event: "Who will win the 2024 Presidential Election?" with three outcomes:
| Outcome | Your Position |
| ------- | ------------- |
| Trump | — |
| Harris | — |
| Other | 1 No |
With negative risk, that 1 No on "Other" can be converted into:
| Outcome | After Conversion |
| ------- | ---------------- |
| Trump | 1 Yes |
| Harris | 1 Yes |
| Other | — |
This is capital-efficient because betting against one outcome is economically equivalent to betting *for* all other outcomes.
## Identifying Neg Risk Markets
The Gamma API includes a `negRisk` boolean on events and markets:
```json theme={null}
{
"id": "123",
"title": "Who will win the 2024 Presidential Election?",
"negRisk": true,
"markets": [...]
}
```
When placing orders on neg risk markets, you must specify this in your order options:
```typescript theme={null}
const response = await client.createAndPostOrder(
{
tokenID: "TOKEN_ID",
price: 0.5,
size: 100,
side: Side.BUY,
},
{
tickSize: "0.01",
negRisk: true, // Required for neg risk markets
},
);
```
## Contract Addresses
Neg risk markets use different contracts than standard markets:
See [Contracts](/resources/contracts) for the Neg Risk Adapter and Neg Risk CTF Exchange addresses.
## Augmented Negative Risk
Standard negative risk requires the complete set of outcomes to be known at market creation. But sometimes new outcomes emerge after trading begins (e.g., a new candidate enters a race).
**Augmented negative risk** solves this with:
| Outcome Type | Description |
| ------------------------ | ------------------------------------------------------------- |
| **Named outcomes** | Known outcomes (e.g., "Trump", "Harris") |
| **Placeholder outcomes** | Reserved slots that can be clarified later (e.g., "Person A") |
| **Explicit Other** | Catches any outcome not explicitly named |
### How Placeholders Work
1. Event launches with named outcomes + placeholders + "Other"
2. When a new outcome emerges, a placeholder is clarified via the bulletin board
3. The "Other" definition narrows as placeholders are assigned
### Trading Rules for Augmented Neg Risk
<Warning>
Only trade on **named outcomes**. Placeholder outcomes should be ignored until
they are named or until resolution occurs. The Polymarket UI does not display
unnamed outcomes.
</Warning>
* If the correct outcome at resolution is not named, the market resolves to "Other"
* The "Other" outcome's definition changes as placeholders are clarified—avoid trading it directly
### Identifying Augmented Neg Risk
An event is augmented neg risk when both flags are true:
```json theme={null}
{
"enableNegRisk": true,
"negRiskAugmented": true
}
```
<Note>
The Gamma API includes a boolean field `negRisk` on events and markets, which indicates whether the event uses negative risk. For augmented neg risk events, an additional `enableNegRisk` field is also `true`. When placing orders, the SDK option is always `negRisk: true` / `neg_risk: True` regardless of whether the market is standard or augmented neg risk.
</Note>
## Technical Details
### Conversion Mechanics
The conversion operation is atomic and happens through the Neg Risk Adapter:
1. You hold 1 No token for Outcome A
2. Call the convert function on the adapter
3. You receive 1 Yes token for every other outcome in the event
## Resources
* [Neg Risk Adapter Source Code](https://github.com/Polymarket/neg-risk-ctf-adapter)
* [Gamma API Documentation](/market-data/overview)
## Next Steps
<CardGroup cols={2}>
<Card title="Markets & Events" icon="calendar" href="/concepts/markets-events">
Understand how multi-market events are structured.
</Card>
<Card title="Positions & Tokens" icon="coins" href="/concepts/positions-tokens">
Learn about token operations like split, merge, and redeem.
</Card>
</CardGroup>
@@ -0,0 +1,226 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
> Use this file to discover all available pages before exploring further.
# Apply Referral Code
> Apply a referral code to the authenticated account after signup. Accounts
can only apply a referral code if they do not already have one.
<Badge color="gray" size="md">Request Weight: **1**</Badge>
## OpenAPI
````yaml /api-spec/perps-openapi.json post /v1/account/referral
openapi: 3.0.3
info:
title: Polymarket Perps HTTP API
version: 1.0.0
description: HTTP API for Polymarket perpetual trading system.
license:
name: Apache 2.0
url: https://www.apache.org/licenses/LICENSE-2.0.html
servers:
- url: https://api.perpetuals.polymarket.com
description: Production Perps HTTP API
security: []
paths:
/v1/account/referral:
post:
summary: Apply Referral Code
description: >
Apply a referral code to the authenticated account after signup.
Accounts
can only apply a referral code if they do not already have one.
operationId: applyReferral
requestBody:
required: true
description: Referral code to apply.
content:
application/json:
schema:
$ref: '#/components/schemas/AccountReferralRequest'
examples:
applyReferral:
summary: Apply a referral code
value:
code: ABC123
responses:
'200':
description: Referral code accepted.
content:
application/json:
schema:
$ref: '#/components/schemas/GenericAccepted'
'400':
$ref: '#/components/responses/Error400Response'
'401':
$ref: '#/components/responses/Error401Response'
'429':
$ref: '#/components/responses/Error429Response'
'500':
$ref: '#/components/responses/Error500Response'
security:
- polymarket_proxy: []
polymarket_secret: []
components:
schemas:
AccountReferralRequest:
type: object
required:
- code
properties:
code:
$ref: '#/components/schemas/code'
GenericAccepted:
type: object
required:
- status
properties:
status:
type: string
enum:
- ok
code:
type: string
description: Referral or invite code
example: ABC123
Error400:
title: Error400
type: object
required:
- status
- error
properties:
status:
type: string
enum:
- err
error:
$ref: '#/components/schemas/error'
Error401:
title: Error401
type: object
required:
- status
- error
properties:
status:
type: string
enum:
- err
error:
$ref: '#/components/schemas/error'
Error429:
title: Error429
type: object
required:
- status
- error
properties:
status:
type: string
enum:
- err
error:
$ref: '#/components/schemas/error'
Error500:
title: Error500
type: object
required:
- status
- error
properties:
status:
type: string
enum:
- err
error:
$ref: '#/components/schemas/error'
error:
type: string
description: >-
Error identifier. For domain rejections and transport errors
(`401`/`404`/`429`/`500`) this is a stable, machine-readable snake_case
identifier that is part of the API contract and safe to branch on, e.g.
`insufficient_margin`, `insufficient_balance`, `order_not_found`,
`reduce_only_invalid`, `unauthorized`, `not_found`. For `400` it is a
human-readable validation detail whose wording may change. See the Error
handling guide for the domain identifiers. (Post-only / Fill-or-Kill
outcomes are order statuses such as `post_only_rejected`, not
rejections.)
example: insufficient_margin
responses:
Error400Response:
description: |
Bad request — the request was malformed or failed validation (bad query
parameters, unparseable body, invalid signature, or a domain pre-check).
The `error` field is a human-readable validation detail.
content:
application/json:
schema:
$ref: '#/components/schemas/Error400'
Error401Response:
description: >
Unauthorized — missing or invalid `POLYMARKET-PROXY` /
`POLYMARKET-SECRET`
credentials. `error` is `unauthorized`.
content:
application/json:
schema:
$ref: '#/components/schemas/Error401'
Error429Response:
description: >
Too Many Requests. `error` distinguishes the limit that was hit:
`ip_rate_limited` (per-IP token bucket), `action_rate_limited`
(per-account
action rate), or `open_orders_limit` (resting open-order cap).
headers:
Retry-After:
description: >
Whole seconds to wait before retrying. Present only on token-bucket
rate-limit rejections (`ip_rate_limited` and `action_rate_limited`);
a
conservative estimate of when enough capacity will have refilled to
admit the request. Absent on `open_orders_limit`, which is a
capacity
limit, not a rate limit — waiting does not free order slots; cancel
resting orders or wait for fills instead.
schema:
type: integer
example: 2
content:
application/json:
schema:
$ref: '#/components/schemas/Error429'
Error500Response:
description: |
Internal server error. `error` is `internal_error`.
content:
application/json:
schema:
$ref: '#/components/schemas/Error500'
securitySchemes:
polymarket_proxy:
type: apiKey
name: POLYMARKET-PROXY
in: header
description: Proxy address
polymarket_secret:
type: apiKey
name: POLYMARKET-SECRET
in: header
description: Correponding proxy secret
````
@@ -0,0 +1,437 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
> Use this file to discover all available pages before exploring further.
# Authentication
> How to authenticate requests to the CLOB API
The CLOB API uses two levels of authentication: **L1 (Private Key)** and **L2 (API Key)**. Either can be accomplished using the CLOB client or REST API.
## Public vs Authenticated
<CardGroup cols={1}>
<Card title="Public (No Auth)" icon="unlock">
The **Gamma API**, **Data API**, and CLOB read endpoints (orderbook, prices, spreads) require no authentication.
</Card>
<Card title="Authenticated (CLOB)" icon="lock">
CLOB trading endpoints (placing orders, cancellations, heartbeat) require all 5 `POLY_*` L2 HTTP headers.
</Card>
</CardGroup>
***
## Two-Level Authentication Model
The CLOB uses two levels of authentication: L1 (Private Key) and L2 (API Key). Either can be accomplished using the CLOB client or REST API
### L1 Authentication
L1 authentication uses the wallet's private key to sign an EIP-712 message used in the request header. It proves ownership and control over the private key. The private key stays in control of the user and all trading activity remains non-custodial.
**Used for:**
* Creating API credentials
* Deriving existing API credentials
* Signing and creating user's orders locally
### L2 Authentication
L2 uses API credentials (apiKey, secret, passphrase) generated from L1 authentication. These are used solely to authenticate requests made to the CLOB API. Requests are signed using HMAC-SHA256.
**Used for:**
* Cancel or get user's open orders
* Check user's balances and allowances
* Post user's signed orders
<Info>
Even with L2 authentication headers, methods that create user orders still
require the user to sign the order payload.
</Info>
***
## Getting API Credentials
Before making authenticated requests, you need to obtain API credentials using L1 authentication.
### Using the SDK
<Tabs>
<Tab title="TypeScript">
```typescript theme={null}
import { ClobClient } from "@polymarket/clob-client-v2";
import { createWalletClient, http } from "viem";
import { privateKeyToAccount } from "viem/accounts";
const account = privateKeyToAccount(process.env.PRIVATE_KEY as `0x${string}`);
const signer = createWalletClient({ account, transport: http() });
const client = new ClobClient({
host: "https://clob.polymarket.com",
chain: 137, // Polygon mainnet
signer,
});
// Creates new credentials or derives existing ones
const credentials = await client.createOrDeriveApiKey();
console.log(credentials);
// {
// key: "550e8400-e29b-41d4-a716-446655440000",
// secret: "base64EncodedSecretString",
// passphrase: "randomPassphraseString"
// }
```
</Tab>
<Tab title="Python">
```python theme={null}
from py_clob_client_v2 import ClobClient
import os
client = ClobClient(
host="https://clob.polymarket.com",
chain_id=137, # Polygon mainnet
key=os.getenv("PRIVATE_KEY")
)
# Creates new credentials or derives existing ones
credentials = client.create_or_derive_api_key()
print(credentials)
# {
# "apiKey": "550e8400-e29b-41d4-a716-446655440000",
# "secret": "base64EncodedSecretString",
# "passphrase": "randomPassphraseString"
# }
```
</Tab>
<Tab title="Rust">
```rust theme={null}
use std::str::FromStr;
use polymarket_client_sdk_v2::POLYGON;
use polymarket_client_sdk_v2::auth::{LocalSigner, Signer};
use polymarket_client_sdk_v2::clob::{Client, Config};
let private_key = std::env::var("POLYMARKET_PRIVATE_KEY")?;
let signer = LocalSigner::from_str(&private_key)?
.with_chain_id(Some(POLYGON));
// Creates new credentials or derives existing ones,
// then initializes the authenticated client — all in one step
let client = Client::new("https://clob.polymarket.com", Config::default())?
.authentication_builder(&signer)
.authenticate()
.await?;
let credentials = client.credentials();
println!("API Key: {}", credentials.key());
```
</Tab>
</Tabs>
<Warning>
**Never commit private keys to version control.** Always use environment
variables or secure key management systems.
</Warning>
### Using the REST API
While we highly recommend using our provided clients to handle signing and authentication, the following is for developers who choose NOT to use our [Python](https://github.com/Polymarket/py-clob-client-v2) or [TypeScript](https://github.com/Polymarket/clob-client-v2) clients.
**Create API Credentials**
```bash theme={null}
POST https://clob.polymarket.com/auth/api-key
```
**Derive API Credentials**
```bash theme={null}
GET https://clob.polymarket.com/auth/derive-api-key
```
Required L1 headers:
| Header | Description |
| ---------------- | ---------------------- |
| `POLY_ADDRESS` | Polygon signer address |
| `POLY_SIGNATURE` | CLOB EIP-712 signature |
| `POLY_TIMESTAMP` | Current UNIX timestamp |
| `POLY_NONCE` | Nonce (default: 0) |
The `POLY_SIGNATURE` is generated by signing the following EIP-712 struct:
<Accordion title="EIP-712 Signing Example">
<CodeGroup>
```typescript TypeScript theme={null}
const domain = {
name: "ClobAuthDomain",
version: "1",
chainId: chainId, // Polygon Chain ID 137
};
const types = {
ClobAuth: [
{ name: "address", type: "address" },
{ name: "timestamp", type: "string" },
{ name: "nonce", type: "uint256" },
{ name: "message", type: "string" },
],
};
const value = {
address: signingAddress, // The Signing address
timestamp: ts, // The CLOB API server timestamp
nonce: nonce, // The nonce used
message: "This message attests that I control the given wallet",
};
const sig = await signer._signTypedData(domain, types, value);
```
```python Python theme={null}
domain = {
"name": "ClobAuthDomain",
"version": "1",
"chainId": chainId, # Polygon Chain ID 137
}
types = {
"ClobAuth": [
{"name": "address", "type": "address"},
{"name": "timestamp", "type": "string"},
{"name": "nonce", "type": "uint256"},
{"name": "message", "type": "string"},
]
}
value = {
"address": signingAddress, # The signing address
"timestamp": ts, # The CLOB API server timestamp
"nonce": nonce, # The nonce used
"message": "This message attests that I control the given wallet",
}
sig = signer.sign_typed_data(domain, types, value)
```
</CodeGroup>
</Accordion>
Reference implementations:
* [TypeScript](https://github.com/Polymarket/clob-client-v2/blob/main/src/signing/eip712.ts)
* [Python](https://github.com/Polymarket/py-clob-client-v2/blob/main/py_clob_client_v2/signing/eip712.py)
Response:
```json theme={null}
{
"apiKey": "550e8400-e29b-41d4-a716-446655440000",
"secret": "base64EncodedSecretString",
"passphrase": "randomPassphraseString"
}
```
**You'll need all three values for L2 authentication.**
***
## L2 Authentication Headers
All trading endpoints require these 5 headers:
| Header | Description |
| ----------------- | ----------------------------- |
| `POLY_ADDRESS` | Polygon signer address |
| `POLY_SIGNATURE` | HMAC signature for request |
| `POLY_TIMESTAMP` | Current UNIX timestamp |
| `POLY_API_KEY` | User's API `apiKey` value |
| `POLY_PASSPHRASE` | User's API `passphrase` value |
The `POLY_SIGNATURE` for L2 is an HMAC-SHA256 signature created using the user's API credentials `secret` value. Reference implementations can be found in the [TypeScript](https://github.com/Polymarket/clob-client-v2/blob/main/src/signing/hmac.ts) and [Python](https://github.com/Polymarket/py-clob-client-v2/blob/main/py_clob_client_v2/signing/hmac.py) clients.
### CLOB Client
<Tabs>
<Tab title="TypeScript">
```typescript theme={null}
import { ClobClient, Side } from "@polymarket/clob-client-v2";
import { createWalletClient, http } from "viem";
import { privateKeyToAccount } from "viem/accounts";
const account = privateKeyToAccount(process.env.PRIVATE_KEY as `0x${string}`);
const signer = createWalletClient({ account, transport: http() });
const depositWalletAddress = process.env.DEPOSIT_WALLET_ADDRESS!;
const client = new ClobClient({
host: "https://clob.polymarket.com",
chain: 137,
signer,
creds: apiCreds, // Generated from L1 auth, API credentials enable L2 methods
signatureType: 3, // POLY_1271, explained below
funderAddress: depositWalletAddress, // deposit wallet funder
});
// Now you can trade!
const order = await client.createAndPostOrder(
{ tokenID: "123456", price: 0.65, size: 100, side: Side.BUY },
{ tickSize: "0.01", negRisk: false }
);
```
</Tab>
<Tab title="Python">
```python theme={null}
from py_clob_client_v2 import ClobClient, OrderArgs, PartialCreateOrderOptions
from py_clob_client_v2.order_builder.constants import BUY
import os
client = ClobClient(
host="https://clob.polymarket.com",
chain_id=137,
key=os.getenv("PRIVATE_KEY"),
creds=api_creds, # Generated from L1 auth, API credentials enable L2 methods
signature_type=3, # POLY_1271, explained below
funder=os.getenv("DEPOSIT_WALLET_ADDRESS")
)
# Now you can trade!
order = client.create_and_post_order(
OrderArgs(token_id="123456", price=0.65, size=100, side=BUY),
options=PartialCreateOrderOptions(tick_size="0.01", neg_risk=False),
)
```
</Tab>
<Tab title="Rust">
```rust theme={null}
use polymarket_client_sdk_v2::clob::types::{Side, SignatureType};
use polymarket_client_sdk_v2::types::dec;
let deposit_wallet = std::env::var("DEPOSIT_WALLET_ADDRESS")?.parse()?;
let client = Client::new("https://clob.polymarket.com", Config::default())?
.authentication_builder(&signer)
.funder(deposit_wallet)
.signature_type(SignatureType::Poly1271)
.authenticate()
.await?;
// Now you can trade!
let order = client.limit_order()
.token_id("123456".parse()?)
.price(dec!(0.65))
.size(dec!(100))
.side(Side::Buy)
.build().await?;
let signed = client.sign(&signer, order).await?;
let response = client.post_order(signed).await?;
```
</Tab>
</Tabs>
<Info>
Even with L2 authentication headers, methods that create user orders still
require the user to sign the order payload.
</Info>
***
## Signature Types and Funder
When initializing the L2 client, you must specify your wallet **signatureType** and the **funder** address which holds the funds:
| Signature Type | Value | Description |
| -------------- | ----- | -------------------------------------------------------------------------------------------------------------------------- |
| EOA | `0` | Standard Ethereum wallet (MetaMask). Funder is the EOA address and will need POL to pay gas on transactions. |
| POLY\_PROXY | `1` | Existing Polymarket proxy wallet flow, commonly used by users who logged in via Magic Link email/Google. |
| GNOSIS\_SAFE | `2` | Existing Gnosis Safe wallet flow. Existing Safe users can continue using this type. |
| POLY\_1271 | `3` | Deposit wallet flow for new API users. The funder is the deposit wallet address and orders are validated through ERC-1271. |
<Tip>
New API users should use deposit wallets with `POLY_1271`. Existing Safe and
Proxy users are unaffected and can keep using their current funder address and
signature type. See the [Deposit Wallet Guide](/trading/deposit-wallets) for
setup details.
</Tip>
***
## Security Best Practices
<AccordionGroup>
<Accordion title="Never expose private keys">
Store private keys in environment variables or secure key management systems. Never commit them to version control.
```bash theme={null}
# .env (never commit this file)
PRIVATE_KEY=0x...
```
</Accordion>
<Accordion title="Implement request signing on the server">
Never expose your API secret in client-side code. All authenticated requests should originate from your backend.
</Accordion>
</AccordionGroup>
***
## Troubleshooting
<AccordionGroup>
<Accordion title="Error - INVALID_SIGNATURE">
Your wallet's private key is incorrect or improperly formatted.
**Solutions:**
* Verify your private key is a valid hex string (starts with "0x")
* Ensure you're using the correct key for the intended address
* Check that the key has proper permissions
</Accordion>
<Accordion title="Error - NONCE_ALREADY_USED">
The nonce you provided has already been used to create an API key.
**Solutions:**
* Use `deriveApiKey()` with the same nonce to retrieve existing credentials
* Or use a different nonce with `createApiKey()`
</Accordion>
<Accordion title="Error - Invalid Funder Address">
Your funder address is incorrect or doesn't match your wallet.
**Solution:** Check your Polymarket profile address at [polymarket.com/settings](https://polymarket.com/settings).
If it does not exist or user has never logged into Polymarket.com, deploy it first before creating L2 authentication.
</Accordion>
<Accordion title="Lost both credentials and nonce">
Unfortunately, there's no way to recover lost API credentials without the nonce. You'll need to create new credentials:
```typescript theme={null}
// Create fresh credentials with a new nonce
const newCreds = await client.createApiKey();
// Save the nonce this time!
```
</Accordion>
</AccordionGroup>
***
## Next Steps
<CardGroup cols={2}>
<Card title="Place Your First Order" icon="plus" href="/trading/quickstart">
Learn how to create and submit orders.
</Card>
<Card title="Geographic Restrictions" icon="globe" href="/api-reference/geoblock">
Check trading availability by region.
</Card>
</CardGroup>
@@ -0,0 +1,128 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
> Use this file to discover all available pages before exploring further.
# Create bridge addresses
## OpenAPI
````yaml /api-spec/bridge-openapi.yaml post /deposit
openapi: 3.0.3
info:
title: Polymarket Bridge API
version: 1.0.0
description: HTTP API for Polymarket bridge and swap operations.
servers:
- url: https://bridge.polymarket.com
description: Polymarket Bridge API
security: []
tags:
- name: Bridge
description: Bridge and swap operations for Polymarket
paths:
/deposit:
post:
tags:
- Bridge
summary: Create bridge addresses
parameters:
- $ref: '#/components/parameters/BuilderCodeHeader'
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/DepositRequest'
example:
address: '0x56687bf447db6ffa42ffe2204a05edaa20f55839'
responses:
'201':
description: Bridge addresses created successfully
content:
application/json:
schema:
$ref: '#/components/schemas/DepositResponse'
'400':
description: >-
Bad Request - Invalid address, request body, or malformed
X-Builder-Code
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'500':
description: Server Error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
components:
parameters:
BuilderCodeHeader:
name: X-Builder-Code
in: header
required: false
description: >
Optional builder code (bytes32 hex) attributing this request to your
integration so transfer issues can be traced to your app. Omitting it
still succeeds but returns a `missing_builder_code` warning; a malformed
code returns 400. Get your code at
https://polymarket.com/settings?tab=builder
schema:
type: string
pattern: ^0x[a-fA-F0-9]{64}$
example: '0x00000000000000000000000000000000000000000000000000000000abcd1234'
schemas:
DepositRequest:
type: object
required:
- address
properties:
address:
$ref: '#/components/schemas/Address'
description: >-
Your Polymarket wallet address where deposited funds will be
credited as pUSD
DepositResponse:
type: object
properties:
address:
type: object
description: Bridge addresses for different blockchain networks
properties:
evm:
type: string
description: >-
EVM-compatible bridge address (Ethereum, Polygon, Arbitrum,
Base, etc.)
example: '0x23566f8b2E82aDfCf01846E54899d110e97AC053'
svm:
type: string
description: Solana Virtual Machine bridge address
example: CrvTBvzryYxBHbWu2TiQpcqD5M7Le7iBKzVmEj3f36Jb
btc:
type: string
description: Bitcoin bridge address
example: bc1q8eau83qffxcj8ht4hsjdza3lha9r3egfqysj3g
note:
type: string
description: Additional information about the bridge addresses
example: >-
Only certain chains and tokens are supported. See /supported-assets
for details.
ErrorResponse:
type: object
properties:
error:
type: string
required:
- error
Address:
type: string
description: Ethereum address (0x-prefixed, 40 hex chars)
pattern: ^0x[a-fA-F0-9]{40}$
example: '0x56687bf447db6ffa42ffe2204a05edaa20f55839'
````
@@ -0,0 +1,152 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
> Use this file to discover all available pages before exploring further.
# Create withdrawal addresses
## OpenAPI
````yaml /api-spec/bridge-openapi.yaml post /withdraw
openapi: 3.0.3
info:
title: Polymarket Bridge API
version: 1.0.0
description: HTTP API for Polymarket bridge and swap operations.
servers:
- url: https://bridge.polymarket.com
description: Polymarket Bridge API
security: []
tags:
- name: Bridge
description: Bridge and swap operations for Polymarket
paths:
/withdraw:
post:
tags:
- Bridge
summary: Create withdrawal addresses
parameters:
- $ref: '#/components/parameters/BuilderCodeHeader'
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/WithdrawalRequest'
example:
address: '0x9156dd10bea4c8d7e2d591b633d1694b1d764756'
toChainId: '1'
toTokenAddress: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48'
recipientAddr: '0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045'
responses:
'201':
description: Withdrawal addresses created successfully
content:
application/json:
schema:
$ref: '#/components/schemas/DepositResponse'
example:
address:
evm: '0x23566f8b2E82aDfCf01846E54899d110e97AC053'
svm: CrvTBvzryYxBHbWu2TiQpcqD5M7Le7iBKzVmEj3f36Jb
btc: bc1q8eau83qffxcj8ht4hsjdza3lha9r3egfqysj3g
note: >-
Send funds to these addresses to bridge to your destination
chain and token.
'400':
description: Bad Request - Invalid/missing parameters or malformed X-Builder-Code
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'500':
description: Server Error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
components:
parameters:
BuilderCodeHeader:
name: X-Builder-Code
in: header
required: false
description: >
Optional builder code (bytes32 hex) attributing this request to your
integration so transfer issues can be traced to your app. Omitting it
still succeeds but returns a `missing_builder_code` warning; a malformed
code returns 400. Get your code at
https://polymarket.com/settings?tab=builder
schema:
type: string
pattern: ^0x[a-fA-F0-9]{64}$
example: '0x00000000000000000000000000000000000000000000000000000000abcd1234'
schemas:
WithdrawalRequest:
type: object
required:
- address
- toChainId
- toTokenAddress
- recipientAddr
properties:
address:
$ref: '#/components/schemas/Address'
description: Source Polymarket wallet address on Polygon
toChainId:
type: string
description: >-
Destination chain ID (e.g., "1" for Ethereum, "8453" for Base,
"1151111081099710" for Solana)
example: '1'
toTokenAddress:
type: string
description: Destination token contract address
example: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48'
recipientAddr:
type: string
description: Destination wallet address where funds will be sent
example: '0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045'
DepositResponse:
type: object
properties:
address:
type: object
description: Bridge addresses for different blockchain networks
properties:
evm:
type: string
description: >-
EVM-compatible bridge address (Ethereum, Polygon, Arbitrum,
Base, etc.)
example: '0x23566f8b2E82aDfCf01846E54899d110e97AC053'
svm:
type: string
description: Solana Virtual Machine bridge address
example: CrvTBvzryYxBHbWu2TiQpcqD5M7Le7iBKzVmEj3f36Jb
btc:
type: string
description: Bitcoin bridge address
example: bc1q8eau83qffxcj8ht4hsjdza3lha9r3egfqysj3g
note:
type: string
description: Additional information about the bridge addresses
example: >-
Only certain chains and tokens are supported. See /supported-assets
for details.
ErrorResponse:
type: object
properties:
error:
type: string
required:
- error
Address:
type: string
description: Ethereum address (0x-prefixed, 40 hex chars)
pattern: ^0x[a-fA-F0-9]{40}$
example: '0x56687bf447db6ffa42ffe2204a05edaa20f55839'
````
@@ -0,0 +1,224 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
> Use this file to discover all available pages before exploring further.
# Get a quote
## OpenAPI
````yaml /api-spec/bridge-openapi.yaml post /quote
openapi: 3.0.3
info:
title: Polymarket Bridge API
version: 1.0.0
description: HTTP API for Polymarket bridge and swap operations.
servers:
- url: https://bridge.polymarket.com
description: Polymarket Bridge API
security: []
tags:
- name: Bridge
description: Bridge and swap operations for Polymarket
paths:
/quote:
post:
tags:
- Bridge
summary: Get a quote
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/QuoteRequest'
example:
fromAmountBaseUnit: '10000000'
fromChainId: '137'
fromTokenAddress: '0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359'
recipientAddress: '0x17eC161f126e82A8ba337f4022d574DBEaFef575'
toChainId: '137'
toTokenAddress: '0xC011a7E12a19f7B1f670d46F03B03f3342E82DFB'
responses:
'200':
description: Quote retrieved successfully
content:
application/json:
schema:
$ref: '#/components/schemas/QuoteResponse'
example:
estCheckoutTimeMs: 25000
estFeeBreakdown:
appFeeLabel: Fun.xyz fee
appFeePercent: 0
appFeeUsd: 0
fillCostPercent: 0
fillCostUsd: 0
gasUsd: 0.003854
maxSlippage: 0
minReceived: 14.488305
swapImpact: 0
swapImpactUsd: 0
totalImpact: 0
totalImpactUsd: 0
estInputUsd: 14.488305
estOutputUsd: 14.488305
estToTokenBaseUnit: '14491203'
quoteId: >-
0x00c34ba467184b0146406d62b0e60aaa24ed52460bd456222b6155a0d9de0ad5
'400':
description: Bad Request - Missing required field
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
missingFromAmount:
value:
error: fromAmountBaseUnit is required
missingFromChainId:
value:
error: fromChainId is required
missingFromTokenAddress:
value:
error: fromTokenAddress is required
missingRecipientAddress:
value:
error: recipientAddress is required
missingToChainId:
value:
error: toChainId is required
missingToTokenAddress:
value:
error: toTokenAddress is required
'500':
description: Server Error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
example:
error: cannot get quote
components:
schemas:
QuoteRequest:
type: object
required:
- fromAmountBaseUnit
- fromChainId
- fromTokenAddress
- recipientAddress
- toChainId
- toTokenAddress
properties:
fromAmountBaseUnit:
type: string
description: Amount of tokens to send
example: '10000000'
fromChainId:
type: string
description: Source Chain ID
example: '137'
fromTokenAddress:
type: string
description: Source token address
example: '0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359'
recipientAddress:
type: string
description: Address of the recipient
example: '0x17eC161f126e82A8ba337f4022d574DBEaFef575'
toChainId:
type: string
description: Destination Chain ID
example: '137'
toTokenAddress:
type: string
description: Destination token address
example: '0xC011a7E12a19f7B1f670d46F03B03f3342E82DFB'
QuoteResponse:
type: object
properties:
estCheckoutTimeMs:
type: integer
description: Estimated time to complete the checkout in milliseconds
example: 25000
estFeeBreakdown:
$ref: '#/components/schemas/FeeBreakdown'
estInputUsd:
type: number
description: Estimated token amount received in USD
example: 14.488305
estOutputUsd:
type: number
description: Estimated token amount sent in USD
example: 14.488305
estToTokenBaseUnit:
type: string
description: Estimated token amount received
example: '14491203'
quoteId:
type: string
description: Unique quote id of the request
example: '0x00c34ba467184b0146406d62b0e60aaa24ed52460bd456222b6155a0d9de0ad5'
ErrorResponse:
type: object
properties:
error:
type: string
required:
- error
FeeBreakdown:
type: object
description: Breakdown of the estimated fees
properties:
appFeeLabel:
type: string
description: Label of the app fee
example: Fun.xyz fee
appFeePercent:
type: number
description: App fees as a percentage of the total amount sent
example: 0
appFeeUsd:
type: number
description: App fees in USD
example: 0
fillCostPercent:
type: number
description: Fill cost percentage of the total amount sent
example: 0
fillCostUsd:
type: number
description: Fill cost in USD
example: 0
gasUsd:
type: number
description: Gas fee in USD
example: 0.003854
maxSlippage:
type: number
description: Maximum potential slippage as a percentage
example: 0
minReceived:
type: number
description: Amount after factoring slippage
example: 14.488305
swapImpact:
type: number
description: Swap impact as a percentage of the total amount sent
example: 0
swapImpactUsd:
type: number
description: Swap impact of the transaction in USD
example: 0
totalImpact:
type: number
description: Total impact as a percentage of the total amount sent
example: 0
totalImpactUsd:
type: number
description: Impact cost of the transaction
example: 0
````
@@ -0,0 +1,99 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
> Use this file to discover all available pages before exploring further.
# Get supported assets
## OpenAPI
````yaml /api-spec/bridge-openapi.yaml get /supported-assets
openapi: 3.0.3
info:
title: Polymarket Bridge API
version: 1.0.0
description: HTTP API for Polymarket bridge and swap operations.
servers:
- url: https://bridge.polymarket.com
description: Polymarket Bridge API
security: []
tags:
- name: Bridge
description: Bridge and swap operations for Polymarket
paths:
/supported-assets:
get:
tags:
- Bridge
summary: Get supported assets
responses:
'200':
description: Successfully retrieved supported assets
content:
application/json:
schema:
$ref: '#/components/schemas/SupportedAssetsResponse'
'500':
description: Server Error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
components:
schemas:
SupportedAssetsResponse:
type: object
properties:
supportedAssets:
type: array
items:
$ref: '#/components/schemas/SupportedAsset'
description: >-
List of supported assets with minimum amounts for deposits and
withdrawals
ErrorResponse:
type: object
properties:
error:
type: string
required:
- error
SupportedAsset:
type: object
properties:
chainId:
type: string
description: Chain ID
example: '1'
chainName:
type: string
description: Human-readable chain name
example: Ethereum
token:
$ref: '#/components/schemas/Token'
minCheckoutUsd:
type: number
description: Minimum amount in USD for deposits and withdrawals
example: 45
Token:
type: object
properties:
name:
type: string
description: Full token name
example: USD Coin
symbol:
type: string
description: Token symbol
example: USDC
address:
type: string
description: Token contract address
example: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48'
decimals:
type: integer
description: Token decimals
example: 6
````
@@ -0,0 +1,154 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
> Use this file to discover all available pages before exploring further.
# Get transaction status
## OpenAPI
````yaml /api-spec/bridge-openapi.yaml get /status/{address}
openapi: 3.0.3
info:
title: Polymarket Bridge API
version: 1.0.0
description: HTTP API for Polymarket bridge and swap operations.
servers:
- url: https://bridge.polymarket.com
description: Polymarket Bridge API
security: []
tags:
- name: Bridge
description: Bridge and swap operations for Polymarket
paths:
/status/{address}:
get:
tags:
- Bridge
summary: Get transaction status
parameters:
- name: address
in: path
required: true
description: >-
The address to query for transaction status (EVM, SVM, or BTC
address from the `/deposit` or `/withdraw` response)
schema:
type: string
example: EXoZue2avJae1d45B3fVw2unhkrtToSYQqHtHgfZ2cbE
responses:
'200':
description: Successfully retrieved transaction status
content:
application/json:
schema:
$ref: '#/components/schemas/TransactionStatusResponse'
example:
transactions:
- fromChainId: '1151111081099710'
fromTokenAddress: '11111111111111111111111111111111'
fromAmountBaseUnit: '13566635'
toChainId: '137'
toTokenAddress: '0xC011a7E12a19f7B1f670d46F03B03f3342E82DFB'
status: DEPOSIT_DETECTED
- fromChainId: '1151111081099710'
fromTokenAddress: '11111111111111111111111111111111'
fromAmountBaseUnit: '13400000'
toChainId: '137'
toTokenAddress: '0xC011a7E12a19f7B1f670d46F03B03f3342E82DFB'
createdTimeMs: 1757646914535
status: PROCESSING
- fromChainId: '1151111081099710'
fromTokenAddress: '11111111111111111111111111111111'
fromAmountBaseUnit: '13500152'
toChainId: '137'
toTokenAddress: '0xC011a7E12a19f7B1f670d46F03B03f3342E82DFB'
txHash: >-
3atr19NAiNCYt24RHM1WnzZp47RXskpTDzspJoCBBaMFwUB8fk37hFkxz35P5UEnnmWz21rb2t5wJ8pq3EE2XnxU
createdTimeMs: 1757531217339
status: COMPLETED
'400':
description: Bad Request - Missing address parameter
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
example:
error: address is required
'500':
description: Server Error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
example:
error: cannot get transaction status
components:
schemas:
TransactionStatusResponse:
type: object
properties:
transactions:
type: array
items:
$ref: '#/components/schemas/Transaction'
description: List of transactions for the given address
ErrorResponse:
type: object
properties:
error:
type: string
required:
- error
Transaction:
type: object
properties:
fromChainId:
type: string
description: Source chain ID
example: '1151111081099710'
fromTokenAddress:
type: string
description: Source token contract address
example: '11111111111111111111111111111111'
fromAmountBaseUnit:
type: string
description: Amount in base units (without decimals)
example: '13566635'
toChainId:
type: string
description: Destination chain ID
example: '137'
toTokenAddress:
type: string
description: Destination token contract address
example: '0xC011a7E12a19f7B1f670d46F03B03f3342E82DFB'
status:
type: string
description: >
Current status of the transaction. If a transaction fails, remains
stuck, or funds are held due to a compliance check, direct users to
our Bridge API provider's support
(https://intercom.help/funxyz/en/articles/10732578-contact-us).
enum:
- DEPOSIT_DETECTED
- PROCESSING
- ORIGIN_TX_CONFIRMED
- SUBMITTED
- COMPLETED
- FAILED
example: COMPLETED
txHash:
type: string
description: Transaction hash (only available when status is COMPLETED)
example: >-
3atr19NAiNCYt24RHM1WnzZp47RXskpTDzspJoCBBaMFwUB8fk37hFkxz35P5UEnnmWz21rb2t5wJ8pq3EE2XnxU
createdTimeMs:
type: number
description: >-
Unix timestamp in milliseconds when transaction was created (missing
when status is DEPOSIT_DETECTED)
example: 1757531217339
````
@@ -0,0 +1,122 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
> Use this file to discover all available pages before exploring further.
# Get aggregated builder leaderboard
## OpenAPI
````yaml /api-spec/data-openapi.yaml get /v1/builders/leaderboard
openapi: 3.0.3
info:
title: Polymarket Data API
version: 1.0.0
description: >
HTTP API for Polymarket data. This specification documents all public
routes.
servers:
- url: https://data-api.polymarket.com
description: Relative server (same host)
security: []
tags:
- name: Data API Status
description: Data API health check
- name: Core
- name: Builders
- name: Misc
paths:
/v1/builders/leaderboard:
get:
tags:
- Builders
summary: Get aggregated builder leaderboard
parameters:
- in: query
name: timePeriod
schema:
type: string
enum:
- DAY
- WEEK
- MONTH
- ALL
default: DAY
description: |
The time period to aggregate results over.
- in: query
name: limit
schema:
type: integer
default: 25
minimum: 0
maximum: 50
description: Maximum number of builders to return
- in: query
name: offset
schema:
type: integer
default: 0
minimum: 0
maximum: 1000
description: Starting index for pagination
responses:
'200':
description: Success
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/LeaderboardEntry'
'400':
description: Bad Request
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'500':
description: Server Error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
components:
schemas:
LeaderboardEntry:
type: object
properties:
rank:
type: string
description: The rank position of the builder
builder:
type: string
description: The builder name or identifier
builderCode:
type: string
description: >-
The builder's onchain attribution code as attached to orders via
`builderCode` (see CLOB V2). Empty string for legacy builders
without a registered code.
volume:
type: number
description: Total trading volume attributed to this builder
activeUsers:
type: integer
description: Number of active users for this builder
verified:
type: boolean
description: Whether the builder is verified
builderLogo:
type: string
description: URL to the builder's logo image
ErrorResponse:
type: object
properties:
error:
type: string
required:
- error
````
@@ -0,0 +1,111 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
> Use this file to discover all available pages before exploring further.
# Get daily builder volume time-series
## OpenAPI
````yaml /api-spec/data-openapi.yaml get /v1/builders/volume
openapi: 3.0.3
info:
title: Polymarket Data API
version: 1.0.0
description: >
HTTP API for Polymarket data. This specification documents all public
routes.
servers:
- url: https://data-api.polymarket.com
description: Relative server (same host)
security: []
tags:
- name: Data API Status
description: Data API health check
- name: Core
- name: Builders
- name: Misc
paths:
/v1/builders/volume:
get:
tags:
- Builders
summary: Get daily builder volume time-series
parameters:
- in: query
name: timePeriod
schema:
type: string
enum:
- DAY
- WEEK
- MONTH
- ALL
default: DAY
description: |
The time period to fetch daily records for.
responses:
'200':
description: Success - Returns array of daily volume records
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/BuilderVolumeEntry'
'400':
description: Bad Request
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'500':
description: Server Error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
components:
schemas:
BuilderVolumeEntry:
type: object
properties:
dt:
type: string
format: date-time
description: The timestamp for this volume entry in ISO 8601 format
example: '2025-11-15T00:00:00Z'
builder:
type: string
description: The builder name or identifier
builderCode:
type: string
description: >-
The builder's onchain attribution code as attached to orders via
`builderCode` (see CLOB V2). Empty string for legacy builders
without a registered code.
builderLogo:
type: string
description: URL to the builder's logo image
verified:
type: boolean
description: Whether the builder is verified
volume:
type: number
description: Trading volume for this builder on this date
activeUsers:
type: integer
description: Number of active users for this builder on this date
rank:
type: string
description: The rank position of the builder on this date
ErrorResponse:
type: object
properties:
error:
type: string
required:
- error
````
@@ -0,0 +1,278 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
> Use this file to discover all available pages before exploring further.
# Cancel Orders COID
> Cancel orders by client order ID.
Requires proxy signature, see [proxy signing](/http/signing#2-proxy-signing).
<Badge color="gray" size="md">Request Weight: **1 + floor(n / 20)**</Badge> <Badge color="gray" size="md">Action Weight: **0**</Badge>
## OpenAPI
````yaml /api-spec/perps-openapi.json delete /v1/trade/orders-coid
openapi: 3.0.3
info:
title: Polymarket Perps HTTP API
version: 1.0.0
description: HTTP API for Polymarket perpetual trading system.
license:
name: Apache 2.0
url: https://www.apache.org/licenses/LICENSE-2.0.html
servers:
- url: https://api.perpetuals.polymarket.com
description: Production Perps HTTP API
security: []
paths:
/v1/trade/orders-coid:
delete:
summary: Cancel Orders COID
description: >
Cancel orders by client order ID.
Requires proxy signature, see [proxy
signing](/http/signing#2-proxy-signing).
operationId: cancelOrdersByCoid
requestBody:
description: Cancel by coid request.
content:
application/json:
schema:
$ref: '#/components/schemas/CancelByCoidRequest'
responses:
'200':
description: Cancel response.
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/CancelResponse'
'400':
$ref: '#/components/responses/Error400Response'
'429':
$ref: '#/components/responses/Error429Response'
'500':
$ref: '#/components/responses/Error500Response'
security: []
components:
schemas:
CancelByCoidRequest:
allOf:
- type: object
required:
- op
properties:
op:
$ref: '#/components/schemas/OpCancelOrdersByCoid'
- $ref: '#/components/schemas/BaseOp'
- type: object
properties:
exp:
$ref: '#/components/schemas/exp'
CancelResponse:
oneOf:
- $ref: '#/components/schemas/CancelAccepted'
- $ref: '#/components/schemas/CancelRejected'
OpCancelOrdersByCoid:
type: object
required:
- type
- args
properties:
type:
type: string
enum:
- cancelOrdersCOID
args:
type: array
description: |
Array of client order IDs to cancel. Cancelling an order that has
attached take-profit / stop-loss children (see `CreateOrder.tr`)
cascades to those children — they are cancelled with reason
`ParentCancelled`.
items:
$ref: '#/components/schemas/coid'
BaseOp:
type: object
required:
- sig
- salt
- ts
properties:
sig:
$ref: '#/components/schemas/sig'
salt:
$ref: '#/components/schemas/salt'
ts:
$ref: '#/components/schemas/ts'
exp:
type: integer
description: >-
Command expiry timestamp in Unix milliseconds. If provided, it must be
in the future and within the gateway's default command timeout. It can
shorten request validity but cannot extend it. This is not an order
auto-cancel time.
example: 1767225600000
CancelAccepted:
type: object
required:
- status
- oid
properties:
status:
type: string
enum:
- ok
oid:
$ref: '#/components/schemas/oid'
coid:
$ref: '#/components/schemas/coid'
description: Echoed only when the request carried a client_order_id.
CancelRejected:
type: object
required:
- status
- error
properties:
status:
type: string
enum:
- err
oid:
$ref: '#/components/schemas/oid'
coid:
$ref: '#/components/schemas/coid'
error:
$ref: '#/components/schemas/error'
Error400:
title: Error400
type: object
required:
- status
- error
properties:
status:
type: string
enum:
- err
error:
$ref: '#/components/schemas/error'
Error429:
title: Error429
type: object
required:
- status
- error
properties:
status:
type: string
enum:
- err
error:
$ref: '#/components/schemas/error'
Error500:
title: Error500
type: object
required:
- status
- error
properties:
status:
type: string
enum:
- err
error:
$ref: '#/components/schemas/error'
coid:
type: string
description: Client order ID
minLength: 32
maxLength: 32
pattern: ^[0-9a-f]{32}$
example: 550e8400e29b41d4a716446655440000
sig:
type: string
description: Signature in hex format
example: 0x1234567890...
salt:
type: integer
description: Salt
example: 1234567890
ts:
type: integer
description: >-
Request timestamp. Unix milliseconds for most operations; Unix seconds
for withdrawals (must match the on-chain EIP-712 struct verified against
block.timestamp).
example: 1767225600000
oid:
type: integer
description: Order ID
example: 1234567890
error:
type: string
description: >-
Error identifier. For domain rejections and transport errors
(`401`/`404`/`429`/`500`) this is a stable, machine-readable snake_case
identifier that is part of the API contract and safe to branch on, e.g.
`insufficient_margin`, `insufficient_balance`, `order_not_found`,
`reduce_only_invalid`, `unauthorized`, `not_found`. For `400` it is a
human-readable validation detail whose wording may change. See the Error
handling guide for the domain identifiers. (Post-only / Fill-or-Kill
outcomes are order statuses such as `post_only_rejected`, not
rejections.)
example: insufficient_margin
responses:
Error400Response:
description: |
Bad request — the request was malformed or failed validation (bad query
parameters, unparseable body, invalid signature, or a domain pre-check).
The `error` field is a human-readable validation detail.
content:
application/json:
schema:
$ref: '#/components/schemas/Error400'
Error429Response:
description: >
Too Many Requests. `error` distinguishes the limit that was hit:
`ip_rate_limited` (per-IP token bucket), `action_rate_limited`
(per-account
action rate), or `open_orders_limit` (resting open-order cap).
headers:
Retry-After:
description: >
Whole seconds to wait before retrying. Present only on token-bucket
rate-limit rejections (`ip_rate_limited` and `action_rate_limited`);
a
conservative estimate of when enough capacity will have refilled to
admit the request. Absent on `open_orders_limit`, which is a
capacity
limit, not a rate limit — waiting does not free order slots; cancel
resting orders or wait for fills instead.
schema:
type: integer
example: 2
content:
application/json:
schema:
$ref: '#/components/schemas/Error429'
Error500Response:
description: |
Internal server error. `error` is `internal_error`.
content:
application/json:
schema:
$ref: '#/components/schemas/Error500'
````
@@ -0,0 +1,277 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
> Use this file to discover all available pages before exploring further.
# Cancel Orders
> Cancel orders.
Requires proxy signature, see [proxy signing](/http/signing#2-proxy-signing).
<Badge color="gray" size="md">Request Weight: **1 + floor(n / 20)**</Badge> <Badge color="gray" size="md">Action Weight: **0**</Badge>
## OpenAPI
````yaml /api-spec/perps-openapi.json delete /v1/trade/orders
openapi: 3.0.3
info:
title: Polymarket Perps HTTP API
version: 1.0.0
description: HTTP API for Polymarket perpetual trading system.
license:
name: Apache 2.0
url: https://www.apache.org/licenses/LICENSE-2.0.html
servers:
- url: https://api.perpetuals.polymarket.com
description: Production Perps HTTP API
security: []
paths:
/v1/trade/orders:
delete:
summary: Cancel Orders
description: >
Cancel orders.
Requires proxy signature, see [proxy
signing](/http/signing#2-proxy-signing).
operationId: cancelOrders
requestBody:
description: Cancel request.
content:
application/json:
schema:
$ref: '#/components/schemas/CancelRequest'
responses:
'200':
description: Cancel response.
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/CancelResponse'
'400':
$ref: '#/components/responses/Error400Response'
'429':
$ref: '#/components/responses/Error429Response'
'500':
$ref: '#/components/responses/Error500Response'
security: []
components:
schemas:
CancelRequest:
allOf:
- type: object
required:
- op
properties:
op:
$ref: '#/components/schemas/OpCancelOrders'
- $ref: '#/components/schemas/BaseOp'
- type: object
properties:
exp:
$ref: '#/components/schemas/exp'
CancelResponse:
oneOf:
- $ref: '#/components/schemas/CancelAccepted'
- $ref: '#/components/schemas/CancelRejected'
OpCancelOrders:
type: object
required:
- type
- args
properties:
type:
type: string
enum:
- cancelOrders
args:
type: array
description: |
Array of order IDs to cancel. Cancelling an order that has attached
take-profit / stop-loss children (see `CreateOrder.tr`) cascades to
those children — they are cancelled with reason `ParentCancelled`.
items:
$ref: '#/components/schemas/oid'
BaseOp:
type: object
required:
- sig
- salt
- ts
properties:
sig:
$ref: '#/components/schemas/sig'
salt:
$ref: '#/components/schemas/salt'
ts:
$ref: '#/components/schemas/ts'
exp:
type: integer
description: >-
Command expiry timestamp in Unix milliseconds. If provided, it must be
in the future and within the gateway's default command timeout. It can
shorten request validity but cannot extend it. This is not an order
auto-cancel time.
example: 1767225600000
CancelAccepted:
type: object
required:
- status
- oid
properties:
status:
type: string
enum:
- ok
oid:
$ref: '#/components/schemas/oid'
coid:
$ref: '#/components/schemas/coid'
description: Echoed only when the request carried a client_order_id.
CancelRejected:
type: object
required:
- status
- error
properties:
status:
type: string
enum:
- err
oid:
$ref: '#/components/schemas/oid'
coid:
$ref: '#/components/schemas/coid'
error:
$ref: '#/components/schemas/error'
Error400:
title: Error400
type: object
required:
- status
- error
properties:
status:
type: string
enum:
- err
error:
$ref: '#/components/schemas/error'
Error429:
title: Error429
type: object
required:
- status
- error
properties:
status:
type: string
enum:
- err
error:
$ref: '#/components/schemas/error'
Error500:
title: Error500
type: object
required:
- status
- error
properties:
status:
type: string
enum:
- err
error:
$ref: '#/components/schemas/error'
oid:
type: integer
description: Order ID
example: 1234567890
sig:
type: string
description: Signature in hex format
example: 0x1234567890...
salt:
type: integer
description: Salt
example: 1234567890
ts:
type: integer
description: >-
Request timestamp. Unix milliseconds for most operations; Unix seconds
for withdrawals (must match the on-chain EIP-712 struct verified against
block.timestamp).
example: 1767225600000
coid:
type: string
description: Client order ID
minLength: 32
maxLength: 32
pattern: ^[0-9a-f]{32}$
example: 550e8400e29b41d4a716446655440000
error:
type: string
description: >-
Error identifier. For domain rejections and transport errors
(`401`/`404`/`429`/`500`) this is a stable, machine-readable snake_case
identifier that is part of the API contract and safe to branch on, e.g.
`insufficient_margin`, `insufficient_balance`, `order_not_found`,
`reduce_only_invalid`, `unauthorized`, `not_found`. For `400` it is a
human-readable validation detail whose wording may change. See the Error
handling guide for the domain identifiers. (Post-only / Fill-or-Kill
outcomes are order statuses such as `post_only_rejected`, not
rejections.)
example: insufficient_margin
responses:
Error400Response:
description: |
Bad request — the request was malformed or failed validation (bad query
parameters, unparseable body, invalid signature, or a domain pre-check).
The `error` field is a human-readable validation detail.
content:
application/json:
schema:
$ref: '#/components/schemas/Error400'
Error429Response:
description: >
Too Many Requests. `error` distinguishes the limit that was hit:
`ip_rate_limited` (per-IP token bucket), `action_rate_limited`
(per-account
action rate), or `open_orders_limit` (resting open-order cap).
headers:
Retry-After:
description: >
Whole seconds to wait before retrying. Present only on token-bucket
rate-limit rejections (`ip_rate_limited` and `action_rate_limited`);
a
conservative estimate of when enough capacity will have refilled to
admit the request. Absent on `open_orders_limit`, which is a
capacity
limit, not a rate limit — waiting does not free order slots; cancel
resting orders or wait for fills instead.
schema:
type: integer
example: 2
content:
application/json:
schema:
$ref: '#/components/schemas/Error429'
Error500Response:
description: |
Internal server error. `error` is `internal_error`.
content:
application/json:
schema:
$ref: '#/components/schemas/Error500'
````
@@ -0,0 +1,162 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
> Use this file to discover all available pages before exploring further.
# Check Invite Code
> Check whether an invite code can be used. When `address` is provided, the
response is invalid if that address already has an account.
<Badge color="gray" size="md">Request Weight: **1**</Badge>
## OpenAPI
````yaml /api-spec/perps-openapi.json get /v1/info/invite
openapi: 3.0.3
info:
title: Polymarket Perps HTTP API
version: 1.0.0
description: HTTP API for Polymarket perpetual trading system.
license:
name: Apache 2.0
url: https://www.apache.org/licenses/LICENSE-2.0.html
servers:
- url: https://api.perpetuals.polymarket.com
description: Production Perps HTTP API
security: []
paths:
/v1/info/invite:
get:
summary: Check Invite Code
description: >
Check whether an invite code can be used. When `address` is provided,
the
response is invalid if that address already has an account.
operationId: checkInviteCode
parameters:
- name: code
in: query
required: true
schema:
$ref: '#/components/schemas/code'
- name: address
in: query
required: false
schema:
$ref: '#/components/schemas/address'
responses:
'200':
description: Invite code validation response.
content:
application/json:
schema:
$ref: '#/components/schemas/InviteCheckResponse'
'429':
$ref: '#/components/responses/Error429Response'
'500':
$ref: '#/components/responses/Error500Response'
security: []
components:
schemas:
code:
type: string
description: Referral or invite code
example: ABC123
address:
type: string
description: Address
example: '0x1234567890abcdef1234567890abcdef12345678'
InviteCheckResponse:
type: object
required:
- valid
properties:
valid:
type: boolean
description: Whether the invite code can be used.
error:
type: string
description: Present when the invite code is invalid or unusable.
Error429:
title: Error429
type: object
required:
- status
- error
properties:
status:
type: string
enum:
- err
error:
$ref: '#/components/schemas/error'
Error500:
title: Error500
type: object
required:
- status
- error
properties:
status:
type: string
enum:
- err
error:
$ref: '#/components/schemas/error'
error:
type: string
description: >-
Error identifier. For domain rejections and transport errors
(`401`/`404`/`429`/`500`) this is a stable, machine-readable snake_case
identifier that is part of the API contract and safe to branch on, e.g.
`insufficient_margin`, `insufficient_balance`, `order_not_found`,
`reduce_only_invalid`, `unauthorized`, `not_found`. For `400` it is a
human-readable validation detail whose wording may change. See the Error
handling guide for the domain identifiers. (Post-only / Fill-or-Kill
outcomes are order statuses such as `post_only_rejected`, not
rejections.)
example: insufficient_margin
responses:
Error429Response:
description: >
Too Many Requests. `error` distinguishes the limit that was hit:
`ip_rate_limited` (per-IP token bucket), `action_rate_limited`
(per-account
action rate), or `open_orders_limit` (resting open-order cap).
headers:
Retry-After:
description: >
Whole seconds to wait before retrying. Present only on token-bucket
rate-limit rejections (`ip_rate_limited` and `action_rate_limited`);
a
conservative estimate of when enough capacity will have refilled to
admit the request. Absent on `open_orders_limit`, which is a
capacity
limit, not a rate limit — waiting does not free order slots; cancel
resting orders or wait for fills instead.
schema:
type: integer
example: 2
content:
application/json:
schema:
$ref: '#/components/schemas/Error429'
Error500Response:
description: |
Internal server error. `error` is `internal_error`.
content:
application/json:
schema:
$ref: '#/components/schemas/Error500'
````
@@ -0,0 +1,99 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
> Use this file to discover all available pages before exploring further.
# Clients & SDKs
> Official open-source libraries for interacting with Polymarket
Polymarket provides official open-source clients in TypeScript, Python, and Rust. All three support the full CLOB API including market data, order management, and authentication.
## Installation
<CodeGroup>
```bash TypeScript theme={null}
npm install @polymarket/clob-client-v2 viem
```
```bash Python theme={null}
pip install py-clob-client-v2
```
```bash Rust theme={null}
cargo add polymarket_client_sdk_v2 --features clob
```
</CodeGroup>
## Quick Example
<CodeGroup>
```typescript TypeScript theme={null}
import { ClobClient } from "@polymarket/clob-client-v2";
const client = new ClobClient({
host: "https://clob.polymarket.com",
chain: 137,
signer,
creds: apiCreds,
});
const markets = await client.getMarkets();
```
```python Python theme={null}
from py_clob_client_v2 import ClobClient
client = ClobClient(
"https://clob.polymarket.com",
key=private_key,
chain_id=137,
creds=api_creds,
)
markets = client.get_markets()
```
```rust Rust theme={null}
use polymarket_client_sdk_v2::clob::{Client, Config};
let client = Client::new("https://clob.polymarket.com", Config::default())?
.authentication_builder(&signer)
.authenticate()
.await?;
let markets = client.markets(None).await?;
```
</CodeGroup>
## Source Code
| Language | Package | Repository |
| ---------- | ---------------------------- | ------------------------------------------------------------------------------------------ |
| TypeScript | `@polymarket/clob-client-v2` | [github.com/Polymarket/clob-client-v2](https://github.com/Polymarket/clob-client-v2) |
| Python | `py-clob-client-v2` | [github.com/Polymarket/py-clob-client-v2](https://github.com/Polymarket/py-clob-client-v2) |
| Rust | `polymarket_client_sdk_v2` | [github.com/Polymarket/rs-clob-client-v2](https://github.com/Polymarket/rs-clob-client-v2) |
Each repository includes working examples in the `/examples` directory.
## Relayer SDK
For [gasless transactions](/trading/gasless), the relayer client handles deposit
wallet creation and signed wallet batches for new API users. Existing Safe and
Proxy wallet flows remain supported.
| Language | Package | Repository |
| ---------- | ------------------------------------ | ---------------------------------------------------------------------------------------------------------- |
| TypeScript | `@polymarket/builder-relayer-client` | [github.com/Polymarket/builder-relayer-client](https://github.com/Polymarket/builder-relayer-client) |
| Python | `py-builder-relayer-client` | [github.com/Polymarket/py-builder-relayer-client](https://github.com/Polymarket/py-builder-relayer-client) |
## Next Steps
<CardGroup cols={2}>
<Card title="Quickstart" icon="rocket" href="/quickstart">
Set up your client and place your first order.
</Card>
<Card title="Authentication" icon="lock" href="/api-reference/authentication">
Understand L1/L2 auth and API credentials.
</Card>
</CardGroup>
@@ -0,0 +1,218 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
> Use this file to discover all available pages before exploring further.
# Get combo markets
> Returns active markets that can be used as combo legs, ordered by volume
descending. This endpoint is public and does not require CLOB
authentication.
Entries in `position_ids`, `outcomes`, and `outcome_prices` correspond by
array index (`[0]` is YES, `[1]` is NO). Use `next_cursor` unchanged in
the next request; a value of `null` indicates the final page.
## OpenAPI
````yaml /api-spec/combos-rfq-openapi.yaml get /v1/rfq/combo-markets
openapi: 3.1.0
info:
title: Polymarket Combinatorial RFQ API
description: >
REST API for the combinatorial RFQ (Request for Quote) system.
This spec covers the publicly documented endpoints used by quoters (market
makers): the combo-market catalog and the authenticated maker commands for
submitting, cancelling, and confirming quotes.
Conventions:
- All `*_e6` fields are six-decimal fixed-point values encoded as
**strings**
to avoid number precision issues.
- All timestamps are **Unix milliseconds** (integer); zero/omitted means
unset.
- Errors return an HTTP status code with a body of the form `{ "error":
"..." }`.
license:
name: MIT
identifier: MIT
version: 1.0.0
servers:
- url: https://combos-rfq-api.polymarket.com
description: Production combinatorial RFQ API
security: []
tags:
- name: Combo Markets
description: Public catalog of markets that can be used as combo legs
- name: Maker
description: Authenticated quoter (maker) commands
paths:
/v1/rfq/combo-markets:
get:
tags:
- Combo Markets
summary: Get combo markets
description: >
Returns active markets that can be used as combo legs, ordered by volume
descending. This endpoint is public and does not require CLOB
authentication.
Entries in `position_ids`, `outcomes`, and `outcome_prices` correspond
by
array index (`[0]` is YES, `[1]` is NO). Use `next_cursor` unchanged in
the next request; a value of `null` indicates the final page.
operationId: getComboMarkets
parameters:
- name: limit
in: query
required: false
description: Number of markets to return. Defaults to `50`; maximum `100`.
schema:
type: integer
minimum: 1
maximum: 100
default: 50
- name: cursor
in: query
required: false
description: Opaque cursor returned as `next_cursor` by the previous response.
schema:
type: string
- name: exclude
in: query
required: false
description: >-
Comma-separated condition IDs to omit, such as markets already
shown.
schema:
type: string
example: 0x4cd7...110ff,0x0391ab0e...
responses:
'200':
description: Catalog page of combo-able markets
content:
application/json:
schema:
$ref: '#/components/schemas/ComboMarketsResponse'
example:
markets:
- id: '1897034'
condition_id: 0x4cd7...110ff
position_ids:
- 1012585...362880
- 1012585...362881
slug: fifwc-mex-rsa-2026-06-11-mex
title: Will Mexico win on 2026-06-11?
outcomes:
- 'Yes'
- 'No'
outcome_prices:
- '0.685'
- '0.315'
image: https://...
volume: 330327.7128580074
tags:
- sports
- soccer
- games
- world-cup
next_cursor: Mg
'400':
$ref: '#/components/responses/BadRequest'
security: []
components:
schemas:
ComboMarketsResponse:
type: object
properties:
markets:
type: array
items:
$ref: '#/components/schemas/ComboMarket'
next_cursor:
type:
- string
- 'null'
description: Cursor for the next page, or `null` on the final page.
required:
- markets
- next_cursor
ComboMarket:
type: object
properties:
id:
type: string
condition_id:
type: string
position_ids:
type: array
description: Combo position IDs; `[0]` is YES, `[1]` is NO.
items:
type: string
slug:
type: string
title:
type: string
outcomes:
type: array
items:
type: string
outcome_prices:
type: array
items:
type: string
image:
type: string
volume:
type: number
format: double
tags:
type: array
items:
type: string
required:
- id
- condition_id
- position_ids
- slug
- title
- outcomes
- outcome_prices
- image
- volume
- tags
ErrorResponse:
type: object
properties:
error:
type: string
description: Human-readable error detail
required:
- error
responses:
BadRequest:
description: >-
Invalid request (malformed JSON, invalid parameters, or failed
validation)
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
example:
error: invalid quote
````
@@ -0,0 +1,212 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
> Use this file to discover all available pages before exploring further.
# Get comments by comment id
## OpenAPI
````yaml /api-spec/gamma-openapi.yaml get /comments/{id}
openapi: 3.0.3
info:
title: Markets API
version: 1.0.0
description: REST API specification for public endpoints used by the Markets service.
servers:
- url: https://gamma-api.polymarket.com
description: Polymarket Gamma API Production Server
security: []
tags:
- name: Gamma Status
description: Gamma API status and health check
- name: Sports
description: Sports-related endpoints including teams and game data
- name: Tags
description: Tag management and related tag operations
- name: Events
description: Event management and event-related operations
- name: Markets
description: Market data and market-related operations
- name: Comments
description: Comment system and user interactions
- name: Series
description: Series management and related operations
- name: Profiles
description: User profile management
- name: Search
description: Search functionality across different entity types
paths:
/comments/{id}:
get:
tags:
- Comments
summary: Get comments by comment id
operationId: getCommentsById
parameters:
- name: id
in: path
required: true
schema:
type: integer
- name: get_positions
in: query
schema:
type: boolean
responses:
'200':
description: Comments
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Comment'
components:
schemas:
Comment:
type: object
properties:
id:
type: string
body:
type: string
nullable: true
parentEntityType:
type: string
nullable: true
parentEntityID:
type: integer
nullable: true
parentCommentID:
type: string
nullable: true
userAddress:
type: string
nullable: true
replyAddress:
type: string
nullable: true
createdAt:
type: string
format: date-time
nullable: true
updatedAt:
type: string
format: date-time
nullable: true
profile:
$ref: '#/components/schemas/CommentProfile'
reactions:
type: array
items:
$ref: '#/components/schemas/Reaction'
reportCount:
type: integer
nullable: true
reactionCount:
type: integer
nullable: true
CommentProfile:
type: object
properties:
name:
type: string
nullable: true
pseudonym:
type: string
nullable: true
displayUsernamePublic:
type: boolean
nullable: true
bio:
type: string
nullable: true
isMod:
type: boolean
nullable: true
isCreator:
type: boolean
nullable: true
proxyWallet:
type: string
nullable: true
baseAddress:
type: string
nullable: true
profileImage:
type: string
nullable: true
profileImageOptimized:
$ref: '#/components/schemas/ImageOptimization'
positions:
type: array
items:
$ref: '#/components/schemas/CommentPosition'
Reaction:
type: object
properties:
id:
type: string
commentID:
type: integer
nullable: true
reactionType:
type: string
nullable: true
icon:
type: string
nullable: true
userAddress:
type: string
nullable: true
createdAt:
type: string
format: date-time
nullable: true
profile:
$ref: '#/components/schemas/CommentProfile'
ImageOptimization:
type: object
properties:
id:
type: string
imageUrlSource:
type: string
nullable: true
imageUrlOptimized:
type: string
nullable: true
imageSizeKbSource:
type: number
nullable: true
imageSizeKbOptimized:
type: number
nullable: true
imageOptimizedComplete:
type: boolean
nullable: true
imageOptimizedLastUpdated:
type: string
nullable: true
relID:
type: integer
nullable: true
field:
type: string
nullable: true
relname:
type: string
nullable: true
CommentPosition:
type: object
properties:
tokenId:
type: string
nullable: true
positionSize:
type: string
nullable: true
````
@@ -0,0 +1,237 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
> Use this file to discover all available pages before exploring further.
# Get comments by user address
## OpenAPI
````yaml /api-spec/gamma-openapi.yaml get /comments/user_address/{user_address}
openapi: 3.0.3
info:
title: Markets API
version: 1.0.0
description: REST API specification for public endpoints used by the Markets service.
servers:
- url: https://gamma-api.polymarket.com
description: Polymarket Gamma API Production Server
security: []
tags:
- name: Gamma Status
description: Gamma API status and health check
- name: Sports
description: Sports-related endpoints including teams and game data
- name: Tags
description: Tag management and related tag operations
- name: Events
description: Event management and event-related operations
- name: Markets
description: Market data and market-related operations
- name: Comments
description: Comment system and user interactions
- name: Series
description: Series management and related operations
- name: Profiles
description: User profile management
- name: Search
description: Search functionality across different entity types
paths:
/comments/user_address/{user_address}:
get:
tags:
- Comments
- Profiles
summary: Get comments by user address
operationId: getCommentsByUserAddress
parameters:
- name: user_address
in: path
required: true
schema:
type: string
- $ref: '#/components/parameters/limit'
- $ref: '#/components/parameters/offset'
- $ref: '#/components/parameters/order'
- $ref: '#/components/parameters/ascending'
responses:
'200':
description: Comments
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Comment'
components:
parameters:
limit:
name: limit
in: query
schema:
type: integer
minimum: 0
offset:
name: offset
in: query
schema:
type: integer
minimum: 0
order:
name: order
in: query
schema:
type: string
description: Comma-separated list of fields to order by
ascending:
name: ascending
in: query
schema:
type: boolean
schemas:
Comment:
type: object
properties:
id:
type: string
body:
type: string
nullable: true
parentEntityType:
type: string
nullable: true
parentEntityID:
type: integer
nullable: true
parentCommentID:
type: string
nullable: true
userAddress:
type: string
nullable: true
replyAddress:
type: string
nullable: true
createdAt:
type: string
format: date-time
nullable: true
updatedAt:
type: string
format: date-time
nullable: true
profile:
$ref: '#/components/schemas/CommentProfile'
reactions:
type: array
items:
$ref: '#/components/schemas/Reaction'
reportCount:
type: integer
nullable: true
reactionCount:
type: integer
nullable: true
CommentProfile:
type: object
properties:
name:
type: string
nullable: true
pseudonym:
type: string
nullable: true
displayUsernamePublic:
type: boolean
nullable: true
bio:
type: string
nullable: true
isMod:
type: boolean
nullable: true
isCreator:
type: boolean
nullable: true
proxyWallet:
type: string
nullable: true
baseAddress:
type: string
nullable: true
profileImage:
type: string
nullable: true
profileImageOptimized:
$ref: '#/components/schemas/ImageOptimization'
positions:
type: array
items:
$ref: '#/components/schemas/CommentPosition'
Reaction:
type: object
properties:
id:
type: string
commentID:
type: integer
nullable: true
reactionType:
type: string
nullable: true
icon:
type: string
nullable: true
userAddress:
type: string
nullable: true
createdAt:
type: string
format: date-time
nullable: true
profile:
$ref: '#/components/schemas/CommentProfile'
ImageOptimization:
type: object
properties:
id:
type: string
imageUrlSource:
type: string
nullable: true
imageUrlOptimized:
type: string
nullable: true
imageSizeKbSource:
type: number
nullable: true
imageSizeKbOptimized:
type: number
nullable: true
imageOptimizedComplete:
type: boolean
nullable: true
imageOptimizedLastUpdated:
type: string
nullable: true
relID:
type: integer
nullable: true
field:
type: string
nullable: true
relname:
type: string
nullable: true
CommentPosition:
type: object
properties:
tokenId:
type: string
nullable: true
positionSize:
type: string
nullable: true
````
@@ -0,0 +1,251 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
> Use this file to discover all available pages before exploring further.
# List comments
## OpenAPI
````yaml /api-spec/gamma-openapi.yaml get /comments
openapi: 3.0.3
info:
title: Markets API
version: 1.0.0
description: REST API specification for public endpoints used by the Markets service.
servers:
- url: https://gamma-api.polymarket.com
description: Polymarket Gamma API Production Server
security: []
tags:
- name: Gamma Status
description: Gamma API status and health check
- name: Sports
description: Sports-related endpoints including teams and game data
- name: Tags
description: Tag management and related tag operations
- name: Events
description: Event management and event-related operations
- name: Markets
description: Market data and market-related operations
- name: Comments
description: Comment system and user interactions
- name: Series
description: Series management and related operations
- name: Profiles
description: User profile management
- name: Search
description: Search functionality across different entity types
paths:
/comments:
get:
tags:
- Comments
summary: List comments
operationId: listComments
parameters:
- $ref: '#/components/parameters/limit'
- $ref: '#/components/parameters/offset'
- $ref: '#/components/parameters/order'
- $ref: '#/components/parameters/ascending'
- name: parent_entity_type
in: query
schema:
type: string
enum:
- Event
- Series
- market
- name: parent_entity_id
in: query
schema:
type: integer
- name: get_positions
in: query
schema:
type: boolean
- name: holders_only
in: query
schema:
type: boolean
responses:
'200':
description: List of comments
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Comment'
components:
parameters:
limit:
name: limit
in: query
schema:
type: integer
minimum: 0
offset:
name: offset
in: query
schema:
type: integer
minimum: 0
order:
name: order
in: query
schema:
type: string
description: Comma-separated list of fields to order by
ascending:
name: ascending
in: query
schema:
type: boolean
schemas:
Comment:
type: object
properties:
id:
type: string
body:
type: string
nullable: true
parentEntityType:
type: string
nullable: true
parentEntityID:
type: integer
nullable: true
parentCommentID:
type: string
nullable: true
userAddress:
type: string
nullable: true
replyAddress:
type: string
nullable: true
createdAt:
type: string
format: date-time
nullable: true
updatedAt:
type: string
format: date-time
nullable: true
profile:
$ref: '#/components/schemas/CommentProfile'
reactions:
type: array
items:
$ref: '#/components/schemas/Reaction'
reportCount:
type: integer
nullable: true
reactionCount:
type: integer
nullable: true
CommentProfile:
type: object
properties:
name:
type: string
nullable: true
pseudonym:
type: string
nullable: true
displayUsernamePublic:
type: boolean
nullable: true
bio:
type: string
nullable: true
isMod:
type: boolean
nullable: true
isCreator:
type: boolean
nullable: true
proxyWallet:
type: string
nullable: true
baseAddress:
type: string
nullable: true
profileImage:
type: string
nullable: true
profileImageOptimized:
$ref: '#/components/schemas/ImageOptimization'
positions:
type: array
items:
$ref: '#/components/schemas/CommentPosition'
Reaction:
type: object
properties:
id:
type: string
commentID:
type: integer
nullable: true
reactionType:
type: string
nullable: true
icon:
type: string
nullable: true
userAddress:
type: string
nullable: true
createdAt:
type: string
format: date-time
nullable: true
profile:
$ref: '#/components/schemas/CommentProfile'
ImageOptimization:
type: object
properties:
id:
type: string
imageUrlSource:
type: string
nullable: true
imageUrlOptimized:
type: string
nullable: true
imageSizeKbSource:
type: number
nullable: true
imageSizeKbOptimized:
type: number
nullable: true
imageOptimizedComplete:
type: boolean
nullable: true
imageOptimizedLastUpdated:
type: string
nullable: true
relID:
type: integer
nullable: true
field:
type: string
nullable: true
relname:
type: string
nullable: true
CommentPosition:
type: object
properties:
tokenId:
type: string
nullable: true
positionSize:
type: string
nullable: true
````
@@ -0,0 +1,194 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
> Use this file to discover all available pages before exploring further.
# Get closed positions for a user
## OpenAPI
````yaml /api-spec/data-openapi.yaml get /closed-positions
openapi: 3.0.3
info:
title: Polymarket Data API
version: 1.0.0
description: >
HTTP API for Polymarket data. This specification documents all public
routes.
servers:
- url: https://data-api.polymarket.com
description: Relative server (same host)
security: []
tags:
- name: Data API Status
description: Data API health check
- name: Core
- name: Builders
- name: Misc
paths:
/closed-positions:
get:
tags:
- Core
summary: Get closed positions for a user
parameters:
- in: query
name: user
required: true
schema:
$ref: '#/components/schemas/Address'
description: The address of the user in question
- in: query
name: market
style: form
explode: false
schema:
type: array
items:
$ref: '#/components/schemas/Hash64'
description: >-
The conditionId of the market in question. Supports multiple csv
separated values. Cannot be used with the eventId param.
- in: query
name: title
schema:
type: string
maxLength: 100
description: Filter by market title
- in: query
name: eventId
style: form
explode: false
schema:
type: array
items:
type: integer
minimum: 1
description: >-
The event id of the event in question. Supports multiple csv
separated values. Returns positions for all markets for those event
ids. Cannot be used with the market param.
- in: query
name: limit
schema:
type: integer
default: 10
minimum: 0
maximum: 50
description: The max number of positions to return
- in: query
name: offset
schema:
type: integer
default: 0
minimum: 0
maximum: 100000
description: The starting index for pagination
- in: query
name: sortBy
schema:
type: string
enum:
- REALIZEDPNL
- TITLE
- PRICE
- AVGPRICE
- TIMESTAMP
default: REALIZEDPNL
description: The sort criteria
- in: query
name: sortDirection
schema:
type: string
enum:
- ASC
- DESC
default: DESC
description: The sort direction
responses:
'200':
description: Success
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/ClosedPosition'
'400':
description: Bad Request
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'401':
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'500':
description: Server Error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
components:
schemas:
Address:
type: string
description: User Profile Address (0x-prefixed, 40 hex chars)
pattern: ^0x[a-fA-F0-9]{40}$
example: '0x56687bf447db6ffa42ffe2204a05edaa20f55839'
Hash64:
type: string
description: 0x-prefixed 64-hex string
pattern: ^0x[a-fA-F0-9]{64}$
example: '0xdd22472e552920b8438158ea7238bfadfa4f736aa4cee91a6b86c39ead110917'
ClosedPosition:
type: object
properties:
proxyWallet:
$ref: '#/components/schemas/Address'
asset:
type: string
conditionId:
$ref: '#/components/schemas/Hash64'
avgPrice:
type: number
totalBought:
type: number
realizedPnl:
type: number
curPrice:
type: number
timestamp:
type: integer
format: int64
title:
type: string
slug:
type: string
icon:
type: string
eventSlug:
type: string
outcome:
type: string
outcomeIndex:
type: integer
oppositeOutcome:
type: string
oppositeAsset:
type: string
endDate:
type: string
ErrorResponse:
type: object
properties:
error:
type: string
required:
- error
````
@@ -0,0 +1,221 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
> Use this file to discover all available pages before exploring further.
# Get current positions for a user
## OpenAPI
````yaml /api-spec/data-openapi.yaml get /positions
openapi: 3.0.3
info:
title: Polymarket Data API
version: 1.0.0
description: >
HTTP API for Polymarket data. This specification documents all public
routes.
servers:
- url: https://data-api.polymarket.com
description: Relative server (same host)
security: []
tags:
- name: Data API Status
description: Data API health check
- name: Core
- name: Builders
- name: Misc
paths:
/positions:
get:
tags:
- Core
summary: Get current positions for a user
parameters:
- in: query
name: user
required: true
schema:
$ref: '#/components/schemas/Address'
description: User address (required)
- in: query
name: market
style: form
explode: false
schema:
type: array
items:
$ref: '#/components/schemas/Hash64'
description: >-
Comma-separated list of condition IDs. Mutually exclusive with
eventId.
- in: query
name: eventId
style: form
explode: false
schema:
type: array
items:
type: integer
minimum: 1
description: Comma-separated list of event IDs. Mutually exclusive with market.
- in: query
name: sizeThreshold
schema:
type: number
default: 1
minimum: 0
- in: query
name: redeemable
schema:
type: boolean
default: false
- in: query
name: mergeable
schema:
type: boolean
default: false
- in: query
name: limit
schema:
type: integer
default: 100
minimum: 0
maximum: 500
- in: query
name: offset
schema:
type: integer
default: 0
minimum: 0
maximum: 10000
- in: query
name: sortBy
schema:
type: string
enum:
- CURRENT
- INITIAL
- TOKENS
- CASHPNL
- PERCENTPNL
- TITLE
- RESOLVING
- PRICE
- AVGPRICE
default: TOKENS
- in: query
name: sortDirection
schema:
type: string
enum:
- ASC
- DESC
default: DESC
- in: query
name: title
schema:
type: string
maxLength: 100
responses:
'200':
description: Success
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Position'
'400':
description: Bad Request
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'401':
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'500':
description: Server Error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
components:
schemas:
Address:
type: string
description: User Profile Address (0x-prefixed, 40 hex chars)
pattern: ^0x[a-fA-F0-9]{40}$
example: '0x56687bf447db6ffa42ffe2204a05edaa20f55839'
Hash64:
type: string
description: 0x-prefixed 64-hex string
pattern: ^0x[a-fA-F0-9]{64}$
example: '0xdd22472e552920b8438158ea7238bfadfa4f736aa4cee91a6b86c39ead110917'
Position:
type: object
properties:
proxyWallet:
$ref: '#/components/schemas/Address'
asset:
type: string
conditionId:
$ref: '#/components/schemas/Hash64'
size:
type: number
avgPrice:
type: number
initialValue:
type: number
currentValue:
type: number
cashPnl:
type: number
percentPnl:
type: number
totalBought:
type: number
realizedPnl:
type: number
percentRealizedPnl:
type: number
curPrice:
type: number
redeemable:
type: boolean
mergeable:
type: boolean
title:
type: string
slug:
type: string
icon:
type: string
eventSlug:
type: string
outcome:
type: string
outcomeIndex:
type: integer
oppositeOutcome:
type: string
oppositeAsset:
type: string
endDate:
type: string
negativeRisk:
type: boolean
ErrorResponse:
type: object
properties:
error:
type: string
required:
- error
````
@@ -0,0 +1,193 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
> Use this file to discover all available pages before exploring further.
# Get positions for a market
## OpenAPI
````yaml /api-spec/data-openapi.yaml get /v1/market-positions
openapi: 3.0.3
info:
title: Polymarket Data API
version: 1.0.0
description: >
HTTP API for Polymarket data. This specification documents all public
routes.
servers:
- url: https://data-api.polymarket.com
description: Relative server (same host)
security: []
tags:
- name: Data API Status
description: Data API health check
- name: Core
- name: Builders
- name: Misc
paths:
/v1/market-positions:
get:
tags:
- Core
summary: Get positions for a market
parameters:
- in: query
name: market
required: true
schema:
$ref: '#/components/schemas/Hash64'
description: The condition ID of the market to query positions for
- in: query
name: user
schema:
$ref: '#/components/schemas/Address'
description: Filter to a single user by proxy wallet address
- in: query
name: status
schema:
type: string
enum:
- OPEN
- CLOSED
- ALL
default: ALL
description: |
Filter positions by status.
- `OPEN` — Only positions with size > 0.01
- `CLOSED` — Only positions with size <= 0.01
- `ALL` — All positions regardless of size
- in: query
name: sortBy
schema:
type: string
enum:
- TOKENS
- CASH_PNL
- REALIZED_PNL
- TOTAL_PNL
default: TOTAL_PNL
description: |
Sort positions by:
- `TOKENS` — Position size (number of tokens)
- `CASH_PNL` — Unrealized cash PnL
- `REALIZED_PNL` — Realized PnL
- `TOTAL_PNL` — Total PnL (cash_pnl + realized_pnl)
- in: query
name: sortDirection
schema:
type: string
enum:
- ASC
- DESC
default: DESC
- in: query
name: limit
schema:
type: integer
default: 50
minimum: 0
maximum: 500
description: Max number of positions to return per outcome token
- in: query
name: offset
schema:
type: integer
default: 0
minimum: 0
maximum: 10000
description: Pagination offset per outcome token
responses:
'200':
description: Success
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/MetaMarketPositionV1'
'400':
description: Bad Request
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'401':
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'500':
description: Server Error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
components:
schemas:
Hash64:
type: string
description: 0x-prefixed 64-hex string
pattern: ^0x[a-fA-F0-9]{64}$
example: '0xdd22472e552920b8438158ea7238bfadfa4f736aa4cee91a6b86c39ead110917'
Address:
type: string
description: User Profile Address (0x-prefixed, 40 hex chars)
pattern: ^0x[a-fA-F0-9]{40}$
example: '0x56687bf447db6ffa42ffe2204a05edaa20f55839'
MetaMarketPositionV1:
type: object
properties:
token:
type: string
description: The outcome token asset ID
positions:
type: array
items:
$ref: '#/components/schemas/MarketPositionV1'
ErrorResponse:
type: object
properties:
error:
type: string
required:
- error
MarketPositionV1:
type: object
properties:
proxyWallet:
$ref: '#/components/schemas/Address'
name:
type: string
profileImage:
type: string
verified:
type: boolean
asset:
type: string
conditionId:
$ref: '#/components/schemas/Hash64'
avgPrice:
type: number
size:
type: number
currPrice:
type: number
currentValue:
type: number
cashPnl:
type: number
totalBought:
type: number
realizedPnl:
type: number
totalPnl:
type: number
outcome:
type: string
outcomeIndex:
type: integer
````
@@ -0,0 +1,140 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
> Use this file to discover all available pages before exploring further.
# Get top holders for markets
## OpenAPI
````yaml /api-spec/data-openapi.yaml get /holders
openapi: 3.0.3
info:
title: Polymarket Data API
version: 1.0.0
description: >
HTTP API for Polymarket data. This specification documents all public
routes.
servers:
- url: https://data-api.polymarket.com
description: Relative server (same host)
security: []
tags:
- name: Data API Status
description: Data API health check
- name: Core
- name: Builders
- name: Misc
paths:
/holders:
get:
tags:
- Core
summary: Get top holders for markets
parameters:
- in: query
name: limit
schema:
type: integer
default: 20
minimum: 0
maximum: 20
description: Maximum number of holders to return per token. Capped at 20.
- in: query
name: market
required: true
style: form
explode: false
schema:
type: array
items:
$ref: '#/components/schemas/Hash64'
description: Comma-separated list of condition IDs.
- in: query
name: minBalance
schema:
type: integer
default: 1
minimum: 0
maximum: 999999
responses:
'200':
description: Success
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/MetaHolder'
'400':
description: Bad Request
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'401':
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'500':
description: Server Error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
components:
schemas:
Hash64:
type: string
description: 0x-prefixed 64-hex string
pattern: ^0x[a-fA-F0-9]{64}$
example: '0xdd22472e552920b8438158ea7238bfadfa4f736aa4cee91a6b86c39ead110917'
MetaHolder:
type: object
properties:
token:
type: string
holders:
type: array
items:
$ref: '#/components/schemas/Holder'
ErrorResponse:
type: object
properties:
error:
type: string
required:
- error
Holder:
type: object
properties:
proxyWallet:
$ref: '#/components/schemas/Address'
bio:
type: string
asset:
type: string
pseudonym:
type: string
amount:
type: number
displayUsernamePublic:
type: boolean
outcomeIndex:
type: integer
name:
type: string
profileImage:
type: string
profileImageOptimized:
type: string
Address:
type: string
description: User Profile Address (0x-prefixed, 40 hex chars)
pattern: ^0x[a-fA-F0-9]{40}$
example: '0x56687bf447db6ffa42ffe2204a05edaa20f55839'
````
@@ -0,0 +1,97 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
> Use this file to discover all available pages before exploring further.
# Get total value of a user's positions
## OpenAPI
````yaml /api-spec/data-openapi.yaml get /value
openapi: 3.0.3
info:
title: Polymarket Data API
version: 1.0.0
description: >
HTTP API for Polymarket data. This specification documents all public
routes.
servers:
- url: https://data-api.polymarket.com
description: Relative server (same host)
security: []
tags:
- name: Data API Status
description: Data API health check
- name: Core
- name: Builders
- name: Misc
paths:
/value:
get:
tags:
- Core
summary: Get total value of a user's positions
parameters:
- in: query
name: user
required: true
schema:
$ref: '#/components/schemas/Address'
- in: query
name: market
style: form
explode: false
schema:
type: array
items:
$ref: '#/components/schemas/Hash64'
responses:
'200':
description: Success
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Value'
'400':
description: Bad Request
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'500':
description: Server Error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
components:
schemas:
Address:
type: string
description: User Profile Address (0x-prefixed, 40 hex chars)
pattern: ^0x[a-fA-F0-9]{40}$
example: '0x56687bf447db6ffa42ffe2204a05edaa20f55839'
Hash64:
type: string
description: 0x-prefixed 64-hex string
pattern: ^0x[a-fA-F0-9]{64}$
example: '0xdd22472e552920b8438158ea7238bfadfa4f736aa4cee91a6b86c39ead110917'
Value:
type: object
properties:
user:
$ref: '#/components/schemas/Address'
value:
type: number
ErrorResponse:
type: object
properties:
error:
type: string
required:
- error
````
@@ -0,0 +1,162 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
> Use this file to discover all available pages before exploring further.
# Get trader leaderboard rankings
## OpenAPI
````yaml /api-spec/data-openapi.yaml get /v1/leaderboard
openapi: 3.0.3
info:
title: Polymarket Data API
version: 1.0.0
description: >
HTTP API for Polymarket data. This specification documents all public
routes.
servers:
- url: https://data-api.polymarket.com
description: Relative server (same host)
security: []
tags:
- name: Data API Status
description: Data API health check
- name: Core
- name: Builders
- name: Misc
paths:
/v1/leaderboard:
get:
tags:
- Core
summary: Get trader leaderboard rankings
parameters:
- in: query
name: category
schema:
type: string
enum:
- OVERALL
- POLITICS
- SPORTS
- ESPORTS
- CRYPTO
- CULTURE
- MENTIONS
- WEATHER
- ECONOMICS
- TECH
- FINANCE
default: OVERALL
description: Market category for the leaderboard
- in: query
name: timePeriod
schema:
type: string
enum:
- DAY
- WEEK
- MONTH
- ALL
default: DAY
description: Time period for leaderboard results
- in: query
name: orderBy
schema:
type: string
enum:
- PNL
- VOL
default: PNL
description: Leaderboard ordering criteria
- in: query
name: limit
schema:
type: integer
default: 25
minimum: 1
maximum: 50
description: Max number of leaderboard traders to return
- in: query
name: offset
schema:
type: integer
default: 0
minimum: 0
maximum: 1000
description: Starting index for pagination
- in: query
name: user
schema:
$ref: '#/components/schemas/Address'
description: Limit leaderboard to a single user by address
- in: query
name: userName
schema:
type: string
description: Limit leaderboard to a single username
responses:
'200':
description: Success
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/TraderLeaderboardEntry'
'400':
description: Bad Request
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'500':
description: Server Error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
components:
schemas:
Address:
type: string
description: User Profile Address (0x-prefixed, 40 hex chars)
pattern: ^0x[a-fA-F0-9]{40}$
example: '0x56687bf447db6ffa42ffe2204a05edaa20f55839'
TraderLeaderboardEntry:
type: object
properties:
rank:
type: string
description: The rank position of the trader
proxyWallet:
$ref: '#/components/schemas/Address'
userName:
type: string
description: The trader's username
vol:
type: number
description: Trading volume for this trader
pnl:
type: number
description: Profit and loss for this trader
profileImage:
type: string
description: URL to the trader's profile image
xUsername:
type: string
description: The trader's X (Twitter) username
verifiedBadge:
type: boolean
description: Whether the trader has a verified badge
ErrorResponse:
type: object
properties:
error:
type: string
required:
- error
````
@@ -0,0 +1,210 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
> Use this file to discover all available pages before exploring further.
# Get trades for a user or markets
## OpenAPI
````yaml /api-spec/data-openapi.yaml get /trades
openapi: 3.0.3
info:
title: Polymarket Data API
version: 1.0.0
description: >
HTTP API for Polymarket data. This specification documents all public
routes.
servers:
- url: https://data-api.polymarket.com
description: Relative server (same host)
security: []
tags:
- name: Data API Status
description: Data API health check
- name: Core
- name: Builders
- name: Misc
paths:
/trades:
get:
tags:
- Core
summary: Get trades for a user or markets
parameters:
- in: query
name: limit
schema:
type: integer
default: 100
minimum: 0
maximum: 10000
- in: query
name: offset
schema:
type: integer
default: 0
minimum: 0
maximum: 10000
- in: query
name: takerOnly
schema:
type: boolean
default: true
- in: query
name: filterType
schema:
type: string
enum:
- CASH
- TOKENS
description: Must be provided together with filterAmount.
- in: query
name: filterAmount
schema:
type: number
minimum: 0
description: Must be provided together with filterType.
- in: query
name: market
style: form
explode: false
schema:
type: array
items:
$ref: '#/components/schemas/Hash64'
description: >-
Comma-separated list of condition IDs. Mutually exclusive with
eventId.
- in: query
name: eventId
style: form
explode: false
schema:
type: array
items:
type: integer
minimum: 1
description: Comma-separated list of event IDs. Mutually exclusive with market.
- in: query
name: user
schema:
$ref: '#/components/schemas/Address'
- in: query
name: side
schema:
type: string
enum:
- BUY
- SELL
- in: query
name: start
schema:
type: integer
minimum: 0
description: >-
Lower-bound timestamp (epoch seconds) for the trade window. Omit or
pass `0` for the default window (most recent ~3 years); pass a
positive epoch (e.g. `1`) to retrieve full history.
- in: query
name: end
schema:
type: integer
minimum: 0
description: >-
Upper-bound timestamp (epoch seconds) for the trade window. Omit for
the default (current time); rows newer than `end` are excluded.
responses:
'200':
description: Success
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Trade'
'400':
description: Bad Request
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'401':
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'500':
description: Server Error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
components:
schemas:
Hash64:
type: string
description: 0x-prefixed 64-hex string
pattern: ^0x[a-fA-F0-9]{64}$
example: '0xdd22472e552920b8438158ea7238bfadfa4f736aa4cee91a6b86c39ead110917'
Address:
type: string
description: User Profile Address (0x-prefixed, 40 hex chars)
pattern: ^0x[a-fA-F0-9]{40}$
example: '0x56687bf447db6ffa42ffe2204a05edaa20f55839'
Trade:
type: object
properties:
proxyWallet:
$ref: '#/components/schemas/Address'
side:
type: string
enum:
- BUY
- SELL
asset:
type: string
conditionId:
$ref: '#/components/schemas/Hash64'
size:
type: number
price:
type: number
timestamp:
type: integer
format: int64
title:
type: string
slug:
type: string
icon:
type: string
eventSlug:
type: string
outcome:
type: string
outcomeIndex:
type: integer
name:
type: string
pseudonym:
type: string
bio:
type: string
profileImage:
type: string
profileImageOptimized:
type: string
transactionHash:
type: string
ErrorResponse:
type: object
properties:
error:
type: string
required:
- error
````
@@ -0,0 +1,255 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
> Use this file to discover all available pages before exploring further.
# Get user activity
## OpenAPI
````yaml /api-spec/data-openapi.yaml get /activity
openapi: 3.0.3
info:
title: Polymarket Data API
version: 1.0.0
description: >
HTTP API for Polymarket data. This specification documents all public
routes.
servers:
- url: https://data-api.polymarket.com
description: Relative server (same host)
security: []
tags:
- name: Data API Status
description: Data API health check
- name: Core
- name: Builders
- name: Misc
paths:
/activity:
get:
tags:
- Core
summary: Get user activity
parameters:
- in: query
name: limit
schema:
type: integer
default: 100
minimum: 0
maximum: 500
- in: query
name: offset
schema:
type: integer
default: 0
minimum: 0
maximum: 10000
- in: query
name: user
required: true
schema:
$ref: '#/components/schemas/Address'
- in: query
name: market
style: form
explode: false
schema:
type: array
items:
$ref: '#/components/schemas/Hash64'
description: >-
Comma-separated list of condition IDs. Mutually exclusive with
eventId.
- in: query
name: eventId
style: form
explode: false
schema:
type: array
items:
type: integer
minimum: 1
description: Comma-separated list of event IDs. Mutually exclusive with market.
- in: query
name: type
style: form
explode: false
schema:
type: array
items:
type: string
enum:
- TRADE
- SPLIT
- MERGE
- REDEEM
- REWARD
- CONVERSION
- DEPOSIT
- WITHDRAWAL
- YIELD
- MAKER_REBATE
- TAKER_REBATE
- REFERRAL_REWARD
- in: query
name: start
schema:
type: integer
minimum: 0
description: >-
Lower-bound timestamp (epoch seconds) for the activity window. Omit
or pass `0` for the default window (most recent ~3 years); pass a
positive epoch (e.g. `1`) to retrieve full history.
- in: query
name: end
schema:
type: integer
minimum: 0
description: >-
Upper-bound timestamp (epoch seconds) for the activity window. Omit
for the default (current time); rows newer than `end` are excluded.
- in: query
name: sortBy
schema:
type: string
enum:
- TIMESTAMP
- TOKENS
- CASH
default: TIMESTAMP
- in: query
name: sortDirection
schema:
type: string
enum:
- ASC
- DESC
default: DESC
- in: query
name: side
schema:
type: string
enum:
- BUY
- SELL
responses:
'200':
description: Success
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Activity'
'400':
description: Bad Request
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'401':
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'500':
description: Server Error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
components:
schemas:
Address:
type: string
description: User Profile Address (0x-prefixed, 40 hex chars)
pattern: ^0x[a-fA-F0-9]{40}$
example: '0x56687bf447db6ffa42ffe2204a05edaa20f55839'
Hash64:
type: string
description: 0x-prefixed 64-hex string
pattern: ^0x[a-fA-F0-9]{64}$
example: '0xdd22472e552920b8438158ea7238bfadfa4f736aa4cee91a6b86c39ead110917'
Activity:
type: object
properties:
proxyWallet:
$ref: '#/components/schemas/Address'
timestamp:
type: integer
format: int64
conditionId:
$ref: '#/components/schemas/Hash64'
type:
type: string
enum:
- TRADE
- SPLIT
- MERGE
- REDEEM
- REWARD
- CONVERSION
- DEPOSIT
- WITHDRAWAL
- YIELD
- MAKER_REBATE
- TAKER_REBATE
- REFERRAL_REWARD
size:
type: number
usdcSize:
type: number
transactionHash:
type: string
price:
type: number
asset:
type: string
side:
type: string
enum:
- BUY
- SELL
outcomeIndex:
type: integer
title:
type: string
slug:
type: string
icon:
type: string
eventSlug:
type: string
outcome:
type: string
name:
type: string
pseudonym:
type: string
bio:
type: string
profileImage:
type: string
profileImageOptimized:
type: string
isCombo:
type: boolean
description: >-
True when this row is part of a combinatorial (multi-market)
position. Flag only — combo detail is not embedded here. The row's
conditionId equals the combo's combo_condition_id; pass it to
/v1/activity/combos or /v1/positions/combos via market_id to fetch
legs and detail. Omitted on non-combo rows.
ErrorResponse:
type: object
properties:
error:
type: string
required:
- error
````
@@ -0,0 +1,280 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
> Use this file to discover all available pages before exploring further.
# Get user combo activity
> Combo lifecycle and redeem events (split / merge / convert / compress / wrap / unwrap / redeem) for a user, with per-leg breakdown. The combo counterpart to /activity trade rows. Also available at /v1/data/user/{address}/activity/combos (address from the path).
## OpenAPI
````yaml /api-spec/data-openapi.yaml get /v1/activity/combos
openapi: 3.0.3
info:
title: Polymarket Data API
version: 1.0.0
description: >
HTTP API for Polymarket data. This specification documents all public
routes.
servers:
- url: https://data-api.polymarket.com
description: Relative server (same host)
security: []
tags:
- name: Data API Status
description: Data API health check
- name: Core
- name: Builders
- name: Misc
paths:
/v1/activity/combos:
get:
tags:
- Core
summary: Get user combo activity
description: >-
Combo lifecycle and redeem events (split / merge / convert / compress /
wrap / unwrap / redeem) for a user, with per-leg breakdown. The combo
counterpart to /activity trade rows. Also available at
/v1/data/user/{address}/activity/combos (address from the path).
parameters:
- in: query
name: user
required: true
schema:
$ref: '#/components/schemas/Address'
- in: query
name: market_id
style: form
explode: false
schema:
type: array
items:
$ref: '#/components/schemas/ComboConditionId'
description: >-
Comma-separated combo_condition_id values to filter to specific
combos. These equal the market_id of isCombo rows on /activity. Omit
for all of the user's combo activity.
- in: query
name: limit
schema:
type: integer
default: 50
minimum: 0
maximum: 500
- in: query
name: offset
schema:
type: integer
default: 0
minimum: 0
maximum: 10000
- in: query
name: cursor
schema:
type: string
description: >-
Opaque continuation token from a previous response's
pagination.next_cursor. When present it supersedes offset (which is
ignored). Invalid, tampered, or cross-endpoint tokens return 400.
responses:
'200':
description: Success
content:
application/json:
schema:
$ref: '#/components/schemas/CombosActivityResponse'
'400':
description: Bad Request
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'401':
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'500':
description: Server Error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
components:
schemas:
Address:
type: string
description: User Profile Address (0x-prefixed, 40 hex chars)
pattern: ^0x[a-fA-F0-9]{40}$
example: '0x56687bf447db6ffa42ffe2204a05edaa20f55839'
ComboConditionId:
type: string
description: >-
Combo condition ID (0x-prefixed, 62 hex chars / bytes31). Equals the
market_id (unified) / conditionId (legacy) of isCombo rows on /activity.
pattern: ^0x[a-fA-F0-9]{62}$
example: '0x0391ab0ebea17b65ba87e071b0566e816b0000000000000000000000000000'
CombosActivityResponse:
type: object
properties:
activity:
type: array
items:
$ref: '#/components/schemas/ComboActivity'
pagination:
$ref: '#/components/schemas/Pagination'
ErrorResponse:
type: object
properties:
error:
type: string
required:
- error
ComboActivity:
type: object
properties:
id:
type: string
event_kind:
type: string
description: >-
Raw on-chain event, e.g. PositionsSplit, PositionsMerged,
PositionRedeemed.
side:
type: string
description: Normalized label for rendering.
enum:
- Split
- Merge
- Convert
- Compress
- Wrap
- Unwrap
- Redeem
module_kind:
type: string
description: Always Combinatorial.
user_address:
$ref: '#/components/schemas/Address'
combo_condition_id:
$ref: '#/components/schemas/ComboConditionId'
combo_position_id:
type: string
module_id:
type: integer
amount_usdc:
type: number
nullable: true
description: Lifecycle amount; null on redeems.
payout_usdc:
type: number
nullable: true
description: Redeem payout; null on lifecycle events.
timestamp:
type: integer
format: int64
tx_dttm:
type: string
description: RFC3339 UTC
tx_hash:
type: string
log_index:
type: integer
block_number:
type: integer
format: int64
legs:
type: array
items:
$ref: '#/components/schemas/ComboLeg'
Pagination:
type: object
description: >-
Standard pagination metadata. No total count; has_more is derived from
page fullness. next_cursor is opaque.
properties:
limit:
type: integer
offset:
type: integer
has_more:
type: boolean
next_cursor:
type: string
nullable: true
description: >-
Opaque signed cursor for the next page; null when has_more is false.
Pass it back verbatim as ?cursor= on the next request (keep the same
sort where the endpoint has one). Never parse or construct it. On
cursor-enabled endpoints this makes deep pagination O(page) and
stable against concurrent inserts.
ComboLeg:
type: object
properties:
leg_index:
type: integer
leg_position_id:
type: string
leg_condition_id:
type: string
description: The leg market's condition ID (distinct from the combo's).
leg_outcome_index:
type: integer
leg_outcome_label:
type: string
leg_status:
type: string
description: Placeholder (OPEN) until leg-resolution integration ships.
leg_resolved_at:
type: string
nullable: true
leg_current_price:
type: string
description: Placeholder ("0") until live-price integration ships.
market:
$ref: '#/components/schemas/ComboMarket'
ComboMarket:
type: object
properties:
market_id:
type: string
slug:
type: string
title:
type: string
outcome:
type: string
image_url:
type: string
icon_url:
type: string
category:
type: string
subcategory:
type: string
tags:
type: array
items:
type: string
end_date:
type: string
description: RFC3339 UTC
event:
$ref: '#/components/schemas/ComboEvent'
ComboEvent:
type: object
properties:
event_id:
type: string
event_slug:
type: string
event_title:
type: string
event_image:
type: string
````
@@ -0,0 +1,329 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
> Use this file to discover all available pages before exploring further.
# Get user combo positions
> Combinatorial (multi-market) positions held by a user, with per-leg breakdown. Also available at /v1/data/user/{address}/positions/combos (address from the path).
## OpenAPI
````yaml /api-spec/data-openapi.yaml get /v1/positions/combos
openapi: 3.0.3
info:
title: Polymarket Data API
version: 1.0.0
description: >
HTTP API for Polymarket data. This specification documents all public
routes.
servers:
- url: https://data-api.polymarket.com
description: Relative server (same host)
security: []
tags:
- name: Data API Status
description: Data API health check
- name: Core
- name: Builders
- name: Misc
paths:
/v1/positions/combos:
get:
tags:
- Core
summary: Get user combo positions
description: >-
Combinatorial (multi-market) positions held by a user, with per-leg
breakdown. Also available at /v1/data/user/{address}/positions/combos
(address from the path).
parameters:
- in: query
name: user
required: true
schema:
$ref: '#/components/schemas/Address'
- in: query
name: status
schema:
type: string
enum:
- OPEN
- PARTIAL
- RESOLVED_WIN
- RESOLVED_LOSS
- in: query
name: sort
schema:
type: string
enum:
- current_value_desc
- first_entry_desc
- entry_cost_desc
- resolved_at_desc
- updated_asc
default: current_value_desc
- in: query
name: market_id
style: form
explode: false
schema:
type: array
items:
$ref: '#/components/schemas/ComboConditionId'
description: >-
Comma-separated combo_condition_id values to filter to specific
combos. These equal the market_id of isCombo rows on /activity. Omit
for all of the user's combos.
- in: query
name: limit
schema:
type: integer
default: 20
minimum: 0
maximum: 1000
- in: query
name: offset
schema:
type: integer
default: 0
minimum: 0
maximum: 100000
- in: query
name: updatedAfter
schema:
type: integer
description: >-
Incremental-sync watermark (epoch seconds, inclusive): only rows
whose updated_at is at or after this time. Positions mutate on
resolution and redemption, so this catches changes a creation-time
filter cannot. In sync mode
(updatedAfter/updatedBefore/sort=updated_asc) every live row is
returned regardless of balance, and the effective upper bound is
clamped ~90s behind now (commit-visibility safety lag) — very recent
rows appear on the next poll. Rows at the boundary may re-deliver:
upsert by (combo_condition_id, combo_position_id).
- in: query
name: updatedBefore
schema:
type: integer
description: >-
Optional upper bound (epoch seconds, inclusive) for updated_at;
clamped to the safety lag. Must be >= updatedAfter.
- in: query
name: cursor
schema:
type: string
description: >-
Opaque continuation token from a previous response's
pagination.next_cursor. When present it supersedes offset (which is
ignored). Invalid, tampered, or cross-endpoint tokens return 400.
responses:
'200':
description: Success
content:
application/json:
schema:
$ref: '#/components/schemas/CombosResponse'
'400':
description: Bad Request
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'401':
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'500':
description: Server Error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
components:
schemas:
Address:
type: string
description: User Profile Address (0x-prefixed, 40 hex chars)
pattern: ^0x[a-fA-F0-9]{40}$
example: '0x56687bf447db6ffa42ffe2204a05edaa20f55839'
ComboConditionId:
type: string
description: >-
Combo condition ID (0x-prefixed, 62 hex chars / bytes31). Equals the
market_id (unified) / conditionId (legacy) of isCombo rows on /activity.
pattern: ^0x[a-fA-F0-9]{62}$
example: '0x0391ab0ebea17b65ba87e071b0566e816b0000000000000000000000000000'
CombosResponse:
type: object
properties:
combos:
type: array
items:
$ref: '#/components/schemas/ComboPosition'
pagination:
$ref: '#/components/schemas/Pagination'
ErrorResponse:
type: object
properties:
error:
type: string
required:
- error
ComboPosition:
type: object
properties:
combo_condition_id:
$ref: '#/components/schemas/ComboConditionId'
combo_position_id:
type: string
module_id:
type: integer
description: 3 = Combinatorial
user_address:
$ref: '#/components/schemas/Address'
shares_balance:
type: string
description: Decimal string (precision-preserving).
entry_avg_price_usdc:
type: string
entry_cost_usdc:
type: string
description: >-
REMAINING cost basis (entry_avg_price × shares_balance). Reads ~0
after a winning combo is redeemed — use total_cost_usdc to display
what was paid on closed positions.
realized_payout_usdc:
type: string
description: >-
Gross redemption proceeds (winning combo shares redeem 1:1 at $1).
"0.00" while OPEN / unredeemed / RESOLVED_LOSS; accumulates under
PARTIAL. Gross payout, not net PnL — net = realized_payout_usdc
total_cost_usdc.
total_cost_usdc:
type: string
description: >-
Original cost basis = entry_avg_price × (shares_balance +
realized_payout). Survives redemption burning the shares; equals
entry_cost_usdc while OPEN.
status:
type: string
enum:
- OPEN
- PARTIAL
- RESOLVED_WIN
- RESOLVED_LOSS
first_entry_at:
type: string
description: RFC3339 UTC
resolved_at:
type: string
nullable: true
updated_at:
type: string
description: >-
Last-modified time (UTC, ISO 8601). Bumps on any recompute of the
row (trade, redemption, resolution classification) — the
incremental-sync watermark field. Omitted on responses served by the
legacy backend.
legs_total:
type: integer
legs_resolved:
type: integer
legs_pending:
type: integer
legs:
type: array
items:
$ref: '#/components/schemas/ComboLeg'
Pagination:
type: object
description: >-
Standard pagination metadata. No total count; has_more is derived from
page fullness. next_cursor is opaque.
properties:
limit:
type: integer
offset:
type: integer
has_more:
type: boolean
next_cursor:
type: string
nullable: true
description: >-
Opaque signed cursor for the next page; null when has_more is false.
Pass it back verbatim as ?cursor= on the next request (keep the same
sort where the endpoint has one). Never parse or construct it. On
cursor-enabled endpoints this makes deep pagination O(page) and
stable against concurrent inserts.
ComboLeg:
type: object
properties:
leg_index:
type: integer
leg_position_id:
type: string
leg_condition_id:
type: string
description: The leg market's condition ID (distinct from the combo's).
leg_outcome_index:
type: integer
leg_outcome_label:
type: string
leg_status:
type: string
description: Placeholder (OPEN) until leg-resolution integration ships.
leg_resolved_at:
type: string
nullable: true
leg_current_price:
type: string
description: Placeholder ("0") until live-price integration ships.
market:
$ref: '#/components/schemas/ComboMarket'
ComboMarket:
type: object
properties:
market_id:
type: string
slug:
type: string
title:
type: string
outcome:
type: string
image_url:
type: string
icon_url:
type: string
category:
type: string
subcategory:
type: string
tags:
type: array
items:
type: string
end_date:
type: string
description: RFC3339 UTC
event:
$ref: '#/components/schemas/ComboEvent'
ComboEvent:
type: object
properties:
event_id:
type: string
event_slug:
type: string
event_title:
type: string
event_image:
type: string
````
@@ -0,0 +1,236 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
> Use this file to discover all available pages before exploring further.
# Create Account Invite
> Create or return the authenticated account's primary invite code. The call
is idempotent for accounts that already have a primary invite code.
<Badge color="gray" size="md">Request Weight: **1**</Badge>
## OpenAPI
````yaml /api-spec/perps-openapi.json post /v1/account/invite
openapi: 3.0.3
info:
title: Polymarket Perps HTTP API
version: 1.0.0
description: HTTP API for Polymarket perpetual trading system.
license:
name: Apache 2.0
url: https://www.apache.org/licenses/LICENSE-2.0.html
servers:
- url: https://api.perpetuals.polymarket.com
description: Production Perps HTTP API
security: []
paths:
/v1/account/invite:
post:
summary: Create Account Invite
description: >
Create or return the authenticated account's primary invite code. The
call
is idempotent for accounts that already have a primary invite code.
operationId: createAccountInvite
requestBody:
description: Empty invite creation request.
content:
application/json:
schema:
$ref: '#/components/schemas/CreateInviteRequest'
examples:
createAccountInvite:
summary: Create or get the authenticated account invite code
value: {}
responses:
'200':
description: Account invite response.
content:
application/json:
schema:
$ref: '#/components/schemas/CreateInviteResponse'
'400':
$ref: '#/components/responses/Error400Response'
'401':
$ref: '#/components/responses/Error401Response'
'429':
$ref: '#/components/responses/Error429Response'
'500':
$ref: '#/components/responses/Error500Response'
security:
- polymarket_proxy: []
polymarket_secret: []
components:
schemas:
CreateInviteRequest:
type: object
additionalProperties: false
CreateInviteResponse:
type: object
required:
- status
- code
- referrals_available
- cooldown_ms
properties:
status:
type: string
enum:
- ok
code:
$ref: '#/components/schemas/code'
referrals_available:
type: integer
minimum: 0
description: Remaining lifetime referrals for this invite code.
cooldown_ms:
type: integer
nullable: true
minimum: 0
description: >-
Milliseconds until referrals become available again. Null for
lifetime caps because no windowed cooldown applies.
code:
type: string
description: Referral or invite code
example: ABC123
Error400:
title: Error400
type: object
required:
- status
- error
properties:
status:
type: string
enum:
- err
error:
$ref: '#/components/schemas/error'
Error401:
title: Error401
type: object
required:
- status
- error
properties:
status:
type: string
enum:
- err
error:
$ref: '#/components/schemas/error'
Error429:
title: Error429
type: object
required:
- status
- error
properties:
status:
type: string
enum:
- err
error:
$ref: '#/components/schemas/error'
Error500:
title: Error500
type: object
required:
- status
- error
properties:
status:
type: string
enum:
- err
error:
$ref: '#/components/schemas/error'
error:
type: string
description: >-
Error identifier. For domain rejections and transport errors
(`401`/`404`/`429`/`500`) this is a stable, machine-readable snake_case
identifier that is part of the API contract and safe to branch on, e.g.
`insufficient_margin`, `insufficient_balance`, `order_not_found`,
`reduce_only_invalid`, `unauthorized`, `not_found`. For `400` it is a
human-readable validation detail whose wording may change. See the Error
handling guide for the domain identifiers. (Post-only / Fill-or-Kill
outcomes are order statuses such as `post_only_rejected`, not
rejections.)
example: insufficient_margin
responses:
Error400Response:
description: |
Bad request — the request was malformed or failed validation (bad query
parameters, unparseable body, invalid signature, or a domain pre-check).
The `error` field is a human-readable validation detail.
content:
application/json:
schema:
$ref: '#/components/schemas/Error400'
Error401Response:
description: >
Unauthorized — missing or invalid `POLYMARKET-PROXY` /
`POLYMARKET-SECRET`
credentials. `error` is `unauthorized`.
content:
application/json:
schema:
$ref: '#/components/schemas/Error401'
Error429Response:
description: >
Too Many Requests. `error` distinguishes the limit that was hit:
`ip_rate_limited` (per-IP token bucket), `action_rate_limited`
(per-account
action rate), or `open_orders_limit` (resting open-order cap).
headers:
Retry-After:
description: >
Whole seconds to wait before retrying. Present only on token-bucket
rate-limit rejections (`ip_rate_limited` and `action_rate_limited`);
a
conservative estimate of when enough capacity will have refilled to
admit the request. Absent on `open_orders_limit`, which is a
capacity
limit, not a rate limit — waiting does not free order slots; cancel
resting orders or wait for fills instead.
schema:
type: integer
example: 2
content:
application/json:
schema:
$ref: '#/components/schemas/Error429'
Error500Response:
description: |
Internal server error. `error` is `internal_error`.
content:
application/json:
schema:
$ref: '#/components/schemas/Error500'
securitySchemes:
polymarket_proxy:
type: apiKey
name: POLYMARKET-PROXY
in: header
description: Proxy address
polymarket_secret:
type: apiKey
name: POLYMARKET-SECRET
in: header
description: Correponding proxy secret
````
@@ -0,0 +1,362 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
> Use this file to discover all available pages before exploring further.
# Create Orders
> Create new orders.
Requires proxy signature, see [proxy signing](/http/signing#2-proxy-signing).
<Badge color="gray" size="md">Request Weight: **1 + floor(n / 20)**</Badge> <Badge color="gray" size="md">Action Weight: **1 / order**</Badge>
## OpenAPI
````yaml /api-spec/perps-openapi.json post /v1/trade/orders
openapi: 3.0.3
info:
title: Polymarket Perps HTTP API
version: 1.0.0
description: HTTP API for Polymarket perpetual trading system.
license:
name: Apache 2.0
url: https://www.apache.org/licenses/LICENSE-2.0.html
servers:
- url: https://api.perpetuals.polymarket.com
description: Production Perps HTTP API
security: []
paths:
/v1/trade/orders:
post:
summary: Create Orders
description: >
Create new orders.
Requires proxy signature, see [proxy
signing](/http/signing#2-proxy-signing).
operationId: createOrders
requestBody:
description: Order request.
content:
application/json:
schema:
$ref: '#/components/schemas/OrderRequest'
responses:
'200':
description: >-
Order ACK response. Order result should be fetched using the get
orders endpoint.
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/OrderResponse'
'400':
$ref: '#/components/responses/Error400Response'
'429':
$ref: '#/components/responses/Error429Response'
'500':
$ref: '#/components/responses/Error500Response'
security: []
components:
schemas:
OrderRequest:
allOf:
- type: object
required:
- op
properties:
op:
$ref: '#/components/schemas/OpCreateOrders'
- $ref: '#/components/schemas/BaseOp'
- type: object
properties:
exp:
$ref: '#/components/schemas/exp'
OrderResponse:
oneOf:
- $ref: '#/components/schemas/OrderAccepted'
- $ref: '#/components/schemas/OrderRejected'
OpCreateOrders:
type: object
required:
- type
- args
properties:
type:
type: string
enum:
- createOrders
args:
type: array
items:
$ref: '#/components/schemas/CreateOrder'
grp:
$ref: '#/components/schemas/grp'
BaseOp:
type: object
required:
- sig
- salt
- ts
properties:
sig:
$ref: '#/components/schemas/sig'
salt:
$ref: '#/components/schemas/salt'
ts:
$ref: '#/components/schemas/ts'
exp:
type: integer
description: >-
Command expiry timestamp in Unix milliseconds. If provided, it must be
in the future and within the gateway's default command timeout. It can
shorten request validity but cannot extend it. This is not an order
auto-cancel time.
example: 1767225600000
OrderAccepted:
type: object
required:
- status
- oid
properties:
status:
type: string
enum:
- ok
oid:
$ref: '#/components/schemas/oid'
coid:
$ref: '#/components/schemas/coid'
description: Echoed only when the request carried a client_order_id.
OrderRejected:
type: object
required:
- status
- error
properties:
status:
type: string
enum:
- err
oid:
$ref: '#/components/schemas/oid'
coid:
$ref: '#/components/schemas/coid'
error:
$ref: '#/components/schemas/error'
Error400:
title: Error400
type: object
required:
- status
- error
properties:
status:
type: string
enum:
- err
error:
$ref: '#/components/schemas/error'
Error429:
title: Error429
type: object
required:
- status
- error
properties:
status:
type: string
enum:
- err
error:
$ref: '#/components/schemas/error'
Error500:
title: Error500
type: object
required:
- status
- error
properties:
status:
type: string
enum:
- err
error:
$ref: '#/components/schemas/error'
CreateOrder:
type: object
required:
- iid
- buy
- qty
properties:
iid:
$ref: '#/components/schemas/iid'
buy:
$ref: '#/components/schemas/buy'
p:
$ref: '#/components/schemas/p'
qty:
$ref: '#/components/schemas/qty'
tif:
$ref: '#/components/schemas/tif'
po:
$ref: '#/components/schemas/po'
ro:
$ref: '#/components/schemas/ro'
c:
$ref: '#/components/schemas/coid'
tr:
type: object
description: Optional trigger attached to this order.
properties:
market:
$ref: '#/components/schemas/market'
trp:
$ref: '#/components/schemas/trp'
tpsl:
$ref: '#/components/schemas/tpsl'
grp:
type: string
description: TPSL grouping
enum:
- order
- position
sig:
type: string
description: Signature in hex format
example: 0x1234567890...
salt:
type: integer
description: Salt
example: 1234567890
ts:
type: integer
description: >-
Request timestamp. Unix milliseconds for most operations; Unix seconds
for withdrawals (must match the on-chain EIP-712 struct verified against
block.timestamp).
example: 1767225600000
oid:
type: integer
description: Order ID
example: 1234567890
coid:
type: string
description: Client order ID
minLength: 32
maxLength: 32
pattern: ^[0-9a-f]{32}$
example: 550e8400e29b41d4a716446655440000
error:
type: string
description: >-
Error identifier. For domain rejections and transport errors
(`401`/`404`/`429`/`500`) this is a stable, machine-readable snake_case
identifier that is part of the API contract and safe to branch on, e.g.
`insufficient_margin`, `insufficient_balance`, `order_not_found`,
`reduce_only_invalid`, `unauthorized`, `not_found`. For `400` it is a
human-readable validation detail whose wording may change. See the Error
handling guide for the domain identifiers. (Post-only / Fill-or-Kill
outcomes are order statuses such as `post_only_rejected`, not
rejections.)
example: insufficient_margin
iid:
type: integer
description: Instrument ID
example: 1
buy:
type: boolean
description: Is buy
example: true
p:
type: string
description: Price
example: '100.00'
qty:
type: string
description: Quantity in no. of contracts
example: '10.00'
tif:
type: string
description: Time in force
enum:
- gtc
- ioc
- fok
po:
type: boolean
description: Post only
default: false
example: false
ro:
type: boolean
description: Reduce only
example: false
default: false
market:
type: boolean
description: Whether the trigger executes as a market order
trp:
type: string
description: Trigger price
example: '110.00'
tpsl:
type: string
description: Trigger type
enum:
- tp
- sl
responses:
Error400Response:
description: |
Bad request — the request was malformed or failed validation (bad query
parameters, unparseable body, invalid signature, or a domain pre-check).
The `error` field is a human-readable validation detail.
content:
application/json:
schema:
$ref: '#/components/schemas/Error400'
Error429Response:
description: >
Too Many Requests. `error` distinguishes the limit that was hit:
`ip_rate_limited` (per-IP token bucket), `action_rate_limited`
(per-account
action rate), or `open_orders_limit` (resting open-order cap).
headers:
Retry-After:
description: >
Whole seconds to wait before retrying. Present only on token-bucket
rate-limit rejections (`ip_rate_limited` and `action_rate_limited`);
a
conservative estimate of when enough capacity will have refilled to
admit the request. Absent on `open_orders_limit`, which is a
capacity
limit, not a rate limit — waiting does not free order slots; cancel
resting orders or wait for fills instead.
schema:
type: integer
example: 2
content:
application/json:
schema:
$ref: '#/components/schemas/Error429'
Error500Response:
description: |
Internal server error. `error` is `internal_error`.
content:
application/json:
schema:
$ref: '#/components/schemas/Error500'
````
@@ -0,0 +1,302 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
> Use this file to discover all available pages before exploring further.
# Create Proxy
> Create a new proxy to sign orders. Returns an API secret for private account access.
Requires EOA signature, see [EOA signing](/http/signing#1-eoa-signing).
<Badge color="gray" size="md">Request Weight: **1**</Badge>
## OpenAPI
````yaml /api-spec/perps-openapi.json post /v1/account/proxy
openapi: 3.0.3
info:
title: Polymarket Perps HTTP API
version: 1.0.0
description: HTTP API for Polymarket perpetual trading system.
license:
name: Apache 2.0
url: https://www.apache.org/licenses/LICENSE-2.0.html
servers:
- url: https://api.perpetuals.polymarket.com
description: Production Perps HTTP API
security: []
paths:
/v1/account/proxy:
post:
summary: Create Proxy
description: >
Create a new proxy to sign orders. Returns an API secret for private
account access.
Requires EOA signature, see [EOA signing](/http/signing#1-eoa-signing).
operationId: createProxy
requestBody:
description: Proxy creation request.
content:
application/json:
schema:
$ref: '#/components/schemas/ProxyRequest'
examples:
createProxy:
summary: Create a proxy
value:
op:
type: createProxy
args:
owner: '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266'
proxy: '0x70997970C51812dc3A010C7d01b50e0d17dc79C8'
expiry: 1767225600000
sig: >-
0x4d11d89f6d8e2f0fd22fb5dd9e6e88a35f3a2c0f3a9e4ff9f8f0da5e6c5f241d2ed7d173f7fcb15726b8a7e7f1f1277ec54c060f5b3ab4d72dbf4d0e40ee6e9a1c
salt: 123456789
ts: 1767000000000
responses:
'200':
description: Proxy creation response.
content:
application/json:
schema:
$ref: '#/components/schemas/ProxyResponse'
'400':
$ref: '#/components/responses/Error400Response'
'422':
$ref: '#/components/responses/Error422Response'
'429':
$ref: '#/components/responses/Error429Response'
'500':
$ref: '#/components/responses/Error500Response'
security: []
components:
schemas:
ProxyRequest:
allOf:
- type: object
required:
- op
properties:
op:
$ref: '#/components/schemas/OpCreateProxy'
- $ref: '#/components/schemas/BaseOp'
- type: object
properties:
label:
$ref: '#/components/schemas/label'
code:
$ref: '#/components/schemas/code'
ProxyResponse:
type: object
required:
- status
- secret
properties:
status:
type: string
enum:
- ok
secret:
$ref: '#/components/schemas/secret'
OpCreateProxy:
type: object
required:
- type
- args
properties:
type:
type: string
enum:
- createProxy
args:
type: object
required:
- owner
- proxy
- expiry
properties:
owner:
$ref: '#/components/schemas/owner'
proxy:
$ref: '#/components/schemas/proxy'
expiry:
$ref: '#/components/schemas/expiry'
BaseOp:
type: object
required:
- sig
- salt
- ts
properties:
sig:
$ref: '#/components/schemas/sig'
salt:
$ref: '#/components/schemas/salt'
ts:
$ref: '#/components/schemas/ts'
label:
type: string
description: Human-readable label for a proxy key or internal transfer
example: trading-bot
code:
type: string
description: Referral or invite code
example: ABC123
secret:
type: string
description: API secret
example: wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
Error400:
title: Error400
type: object
required:
- status
- error
properties:
status:
type: string
enum:
- err
error:
$ref: '#/components/schemas/error'
GenericRejected:
type: object
required:
- status
- error
properties:
status:
type: string
enum:
- err
error:
$ref: '#/components/schemas/error'
Error429:
title: Error429
type: object
required:
- status
- error
properties:
status:
type: string
enum:
- err
error:
$ref: '#/components/schemas/error'
Error500:
title: Error500
type: object
required:
- status
- error
properties:
status:
type: string
enum:
- err
error:
$ref: '#/components/schemas/error'
owner:
type: string
description: Owner address in hex format
example: '0x1234567890abcdef1234567890abcdef12345678'
proxy:
type: string
description: Proxy address in hex format
example: '0x70997970C51812dc3A010C7d01b50e0d17dc79C8'
expiry:
type: integer
description: Expiry timestamp in milliseconds
example: 1767225600000
sig:
type: string
description: Signature in hex format
example: 0x1234567890...
salt:
type: integer
description: Salt
example: 1234567890
ts:
type: integer
description: >-
Request timestamp. Unix milliseconds for most operations; Unix seconds
for withdrawals (must match the on-chain EIP-712 struct verified against
block.timestamp).
example: 1767225600000
error:
type: string
description: >-
Error identifier. For domain rejections and transport errors
(`401`/`404`/`429`/`500`) this is a stable, machine-readable snake_case
identifier that is part of the API contract and safe to branch on, e.g.
`insufficient_margin`, `insufficient_balance`, `order_not_found`,
`reduce_only_invalid`, `unauthorized`, `not_found`. For `400` it is a
human-readable validation detail whose wording may change. See the Error
handling guide for the domain identifiers. (Post-only / Fill-or-Kill
outcomes are order statuses such as `post_only_rejected`, not
rejections.)
example: insufficient_margin
responses:
Error400Response:
description: |
Bad request — the request was malformed or failed validation (bad query
parameters, unparseable body, invalid signature, or a domain pre-check).
The `error` field is a human-readable validation detail.
content:
application/json:
schema:
$ref: '#/components/schemas/Error400'
Error422Response:
description: |
Unprocessable Entity — the request was well-formed but a domain rule
rejected it on its merits (insufficient balance, invalid leverage,
proxy already exists, …). The body is the discriminated rejection
(`status: err`) with the engine error identifier in `error`.
content:
application/json:
schema:
$ref: '#/components/schemas/GenericRejected'
Error429Response:
description: >
Too Many Requests. `error` distinguishes the limit that was hit:
`ip_rate_limited` (per-IP token bucket), `action_rate_limited`
(per-account
action rate), or `open_orders_limit` (resting open-order cap).
headers:
Retry-After:
description: >
Whole seconds to wait before retrying. Present only on token-bucket
rate-limit rejections (`ip_rate_limited` and `action_rate_limited`);
a
conservative estimate of when enough capacity will have refilled to
admit the request. Absent on `open_orders_limit`, which is a
capacity
limit, not a rate limit — waiting does not free order slots; cancel
resting orders or wait for fills instead.
schema:
type: integer
example: 2
content:
application/json:
schema:
$ref: '#/components/schemas/Error429'
Error500Response:
description: |
Internal server error. `error` is `internal_error`.
content:
application/json:
schema:
$ref: '#/components/schemas/Error500'
````
@@ -0,0 +1,263 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
> Use this file to discover all available pages before exploring further.
# Delete Proxy
> Delete a proxy by address.
Requires EOA signature, see [EOA signing](/http/signing#1-eoa-signing).
<Badge color="gray" size="md">Request Weight: **1**</Badge>
## OpenAPI
````yaml /api-spec/perps-openapi.json delete /v1/account/proxy
openapi: 3.0.3
info:
title: Polymarket Perps HTTP API
version: 1.0.0
description: HTTP API for Polymarket perpetual trading system.
license:
name: Apache 2.0
url: https://www.apache.org/licenses/LICENSE-2.0.html
servers:
- url: https://api.perpetuals.polymarket.com
description: Production Perps HTTP API
security: []
paths:
/v1/account/proxy:
delete:
summary: Delete Proxy
description: |
Delete a proxy by address.
Requires EOA signature, see [EOA signing](/http/signing#1-eoa-signing).
operationId: deleteProxy
requestBody:
description: Delete proxy request.
content:
application/json:
schema:
$ref: '#/components/schemas/DeleteProxyRequest'
examples:
deleteProxy:
summary: Delete a proxy
value:
op:
type: deleteProxy
args:
proxy: '0x70997970C51812dc3A010C7d01b50e0d17dc79C8'
sig: >-
0x9a0b1c2d3e4f5a6b7c8d9e0f1a2b3c4d5e6f7a8b9c0d1e2f3a4b5c6d7e8f9a0b1c2d3e4f5a6b7c8d9e0f1a2b3c4d5e6f7a8b9c0d1e2f3a4b5c6d7e8f9a1c
salt: 888888888
ts: 1767000020000
responses:
'200':
description: Delete proxy response.
content:
application/json:
schema:
$ref: '#/components/schemas/GenericAccepted'
'400':
$ref: '#/components/responses/Error400Response'
'422':
$ref: '#/components/responses/Error422Response'
'429':
$ref: '#/components/responses/Error429Response'
'500':
$ref: '#/components/responses/Error500Response'
security: []
components:
schemas:
DeleteProxyRequest:
allOf:
- type: object
required:
- op
properties:
op:
$ref: '#/components/schemas/OpDeleteProxy'
- $ref: '#/components/schemas/BaseOp'
GenericAccepted:
type: object
required:
- status
properties:
status:
type: string
enum:
- ok
OpDeleteProxy:
type: object
required:
- type
- args
properties:
type:
type: string
enum:
- deleteProxy
args:
type: object
required:
- proxy
properties:
proxy:
$ref: '#/components/schemas/proxy'
BaseOp:
type: object
required:
- sig
- salt
- ts
properties:
sig:
$ref: '#/components/schemas/sig'
salt:
$ref: '#/components/schemas/salt'
ts:
$ref: '#/components/schemas/ts'
Error400:
title: Error400
type: object
required:
- status
- error
properties:
status:
type: string
enum:
- err
error:
$ref: '#/components/schemas/error'
GenericRejected:
type: object
required:
- status
- error
properties:
status:
type: string
enum:
- err
error:
$ref: '#/components/schemas/error'
Error429:
title: Error429
type: object
required:
- status
- error
properties:
status:
type: string
enum:
- err
error:
$ref: '#/components/schemas/error'
Error500:
title: Error500
type: object
required:
- status
- error
properties:
status:
type: string
enum:
- err
error:
$ref: '#/components/schemas/error'
proxy:
type: string
description: Proxy address in hex format
example: '0x70997970C51812dc3A010C7d01b50e0d17dc79C8'
sig:
type: string
description: Signature in hex format
example: 0x1234567890...
salt:
type: integer
description: Salt
example: 1234567890
ts:
type: integer
description: >-
Request timestamp. Unix milliseconds for most operations; Unix seconds
for withdrawals (must match the on-chain EIP-712 struct verified against
block.timestamp).
example: 1767225600000
error:
type: string
description: >-
Error identifier. For domain rejections and transport errors
(`401`/`404`/`429`/`500`) this is a stable, machine-readable snake_case
identifier that is part of the API contract and safe to branch on, e.g.
`insufficient_margin`, `insufficient_balance`, `order_not_found`,
`reduce_only_invalid`, `unauthorized`, `not_found`. For `400` it is a
human-readable validation detail whose wording may change. See the Error
handling guide for the domain identifiers. (Post-only / Fill-or-Kill
outcomes are order statuses such as `post_only_rejected`, not
rejections.)
example: insufficient_margin
responses:
Error400Response:
description: |
Bad request — the request was malformed or failed validation (bad query
parameters, unparseable body, invalid signature, or a domain pre-check).
The `error` field is a human-readable validation detail.
content:
application/json:
schema:
$ref: '#/components/schemas/Error400'
Error422Response:
description: |
Unprocessable Entity — the request was well-formed but a domain rule
rejected it on its merits (insufficient balance, invalid leverage,
proxy already exists, …). The body is the discriminated rejection
(`status: err`) with the engine error identifier in `error`.
content:
application/json:
schema:
$ref: '#/components/schemas/GenericRejected'
Error429Response:
description: >
Too Many Requests. `error` distinguishes the limit that was hit:
`ip_rate_limited` (per-IP token bucket), `action_rate_limited`
(per-account
action rate), or `open_orders_limit` (resting open-order cap).
headers:
Retry-After:
description: >
Whole seconds to wait before retrying. Present only on token-bucket
rate-limit rejections (`ip_rate_limited` and `action_rate_limited`);
a
conservative estimate of when enough capacity will have refilled to
admit the request. Absent on `open_orders_limit`, which is a
capacity
limit, not a rate limit — waiting does not free order slots; cancel
resting orders or wait for fills instead.
schema:
type: integer
example: 2
content:
application/json:
schema:
$ref: '#/components/schemas/Error429'
Error500Response:
description: |
Internal server error. `error` is `internal_error`.
content:
application/json:
schema:
$ref: '#/components/schemas/Error500'
````
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,108 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
> Use this file to discover all available pages before exploring further.
# Get event tags
## OpenAPI
````yaml /api-spec/gamma-openapi.yaml get /events/{id}/tags
openapi: 3.0.3
info:
title: Markets API
version: 1.0.0
description: REST API specification for public endpoints used by the Markets service.
servers:
- url: https://gamma-api.polymarket.com
description: Polymarket Gamma API Production Server
security: []
tags:
- name: Gamma Status
description: Gamma API status and health check
- name: Sports
description: Sports-related endpoints including teams and game data
- name: Tags
description: Tag management and related tag operations
- name: Events
description: Event management and event-related operations
- name: Markets
description: Market data and market-related operations
- name: Comments
description: Comment system and user interactions
- name: Series
description: Series management and related operations
- name: Profiles
description: User profile management
- name: Search
description: Search functionality across different entity types
paths:
/events/{id}/tags:
get:
tags:
- Events
- Tags
summary: Get event tags
operationId: getEventTags
parameters:
- $ref: '#/components/parameters/pathId'
responses:
'200':
description: Tags attached to the event
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Tag'
'404':
description: Not found
components:
parameters:
pathId:
name: id
in: path
required: true
schema:
type: integer
schemas:
Tag:
type: object
properties:
id:
type: string
label:
type: string
nullable: true
slug:
type: string
nullable: true
forceShow:
type: boolean
nullable: true
publishedAt:
type: string
nullable: true
createdBy:
type: integer
nullable: true
updatedBy:
type: integer
nullable: true
createdAt:
type: string
format: date-time
nullable: true
updatedAt:
type: string
format: date-time
nullable: true
forceHide:
type: boolean
nullable: true
isCarousel:
type: boolean
nullable: true
````
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,233 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
> Use this file to discover all available pages before exploring further.
# Geographic Restrictions
> Check geographic restrictions before placing orders on the Polymarket API
Polymarket restricts order placement from certain geographic locations due to regulatory requirements and compliance with international sanctions. Before placing orders, builders should verify the location.
<Warning>
Orders submitted from blocked regions will be rejected. Implement geoblock
checks in your application to provide users with appropriate feedback before
they attempt to trade.
</Warning>
***
## Geoblock Endpoint
Check the geographic eligibility of the requesting IP address:
```bash theme={null}
GET https://polymarket.com/api/geoblock
```
<Note>This endpoint is on `polymarket.com`, not the API servers.</Note>
### Response
```json theme={null}
{
"blocked": true,
"ip": "203.0.113.42",
"country": "US",
"region": "NY"
}
```
| Field | Type | Description |
| --------- | ------- | ----------------------------------------------- |
| `blocked` | boolean | Whether the user is blocked from placing orders |
| `ip` | string | Detected IP address |
| `country` | string | ISO 3166-1 alpha-2 country code |
| `region` | string | Region/state code |
***
## Restricted Jurisdictions
Restrictions fall into three groups. **Block completely** means no new orders and no closing of existing positions. **Close-only** means users can close existing positions but cannot open new ones. Each group notes whether it applies on the frontend, the API, or both. Codes are ISO 3166-1 alpha-2 for countries and ISO 3166-2 for sub-national regions.
### OFAC-Sanctioned Jurisdictions (Block Completely)
Blocked on both the frontend and the API. No new orders, and existing positions cannot be closed.
| Jurisdiction | Code |
| ----------------- | ----- |
| Iran | IR |
| Syria | SY |
| Cuba | CU |
| North Korea | KP |
| Ukraine — Crimea | UA-43 |
| Ukraine — Donetsk | UA-14 |
| Ukraine — Luhansk | UA-09 |
### Regulatory-Restricted Jurisdictions (Close-Only on Frontend and API)
Users can close existing positions but cannot open new ones, on both the frontend and the API.
| Jurisdiction | Code |
| ------------------------------------ | ----- |
| Australia | AU |
| Belarus | BY |
| Belgium | BE |
| Burundi | BI |
| Brazil | BR |
| Canada — British Columbia | CA-BC |
| Canada — Ontario | CA-ON |
| Canada — Alberta | CA-AB |
| Canada — Quebec | CA-QC |
| Central African Republic | CF |
| Congo (Kinshasa) | CD |
| Ethiopia | ET |
| France | FR |
| Germany | DE |
| Iraq | IQ |
| Italy | IT |
| Lebanon | LB |
| Libya | LY |
| Myanmar | MM |
| Nicaragua | NI |
| North Korea | KP |
| Poland | PL |
| Russia | RU |
| Singapore | SG |
| Somalia | SO |
| Slovakia | SK |
| South Sudan | SS |
| Sudan | SD |
| Taiwan | TW |
| Thailand | TH |
| United Kingdom | GB |
| United States | US |
| United States Minor Outlying Islands | UM |
| Venezuela | VE |
| Yemen | YE |
| Zimbabwe | ZW |
### Regulatory-Restricted Jurisdictions (Close-Only on Frontend)
Close-only on the Polymarket frontend; the API itself is not restricted.
| Jurisdiction | Code |
| ------------------- | ---- |
| Japan | JP |
| Netherlands | NL |
| Malta (Sports Only) | MT |
***
## Blocking Logic
The geoblocking system includes:
1. **OFAC-Sanctioned Countries**: Countries sanctioned by the U.S. Office of Foreign Assets Control (OFAC)
2. **Additional Regulatory Restrictions**: Countries added for specific regulatory compliance reasons
***
## Server Infrastructure
* **Primary Servers**: eu-west-2
* **Closest Non-Georestricted Region**: eu-west-1
<Tip>
**Direct co-location available.** Users who complete the [KYC/KYB
form](https://docs.google.com/forms/d/e/1FAIpQLSfY-3Dl3yxq8HKFjFad8YzKZmm0k3Gdg29HD6gL-K-AmI6KXw/viewform) can get access to co-locate
directly in `eu-west-2` for the lowest possible latency to Polymarket's
primary servers.
</Tip>
***
## Usage Examples
<Tabs>
<Tab title="TypeScript">
```typescript theme={null}
interface GeoblockResponse {
blocked: boolean;
ip: string;
country: string;
region: string;
}
async function checkGeoblock(): Promise<GeoblockResponse> {
const response = await fetch("https://polymarket.com/api/geoblock");
return response.json();
}
// Usage
const geo = await checkGeoblock();
if (geo.blocked) {
console.log(`Trading not available in ${geo.country}`);
} else {
console.log("Trading available");
}
```
</Tab>
<Tab title="Python">
```python theme={null}
import requests
def check_geoblock() -> dict:
response = requests.get("https://polymarket.com/api/geoblock")
return response.json()
# Usage
geo = check_geoblock()
if geo["blocked"]:
print(f"Trading not available in {geo['country']}")
else:
print("Trading available")
```
</Tab>
<Tab title="Rust">
```rust theme={null}
use polymarket_client_sdk_v2::clob::{Client, Config};
let client = Client::new("https://clob.polymarket.com", Config::default())?;
let geo = client.check_geoblock().await?;
if geo.blocked {
println!("Trading not available in {}", geo.country);
} else {
println!("Trading available");
}
```
</Tab>
</Tabs>
***
## Why These Restrictions
Geographic restrictions are implemented to ensure compliance with:
* International sanctions and embargoes
* Local financial regulations
* Gambling and prediction market laws
* Anti-money laundering (AML) requirements
* Know Your Customer (KYC) regulations
If you believe you are incorrectly restricted or have questions about geographic availability, please contact [Polymarket Support](https://polymarket.com/support).
***
## Next Steps
<CardGroup cols={2}>
<Card title="Authentication" icon="key" href="/api-reference/authentication">
Learn how to authenticate trading requests.
</Card>
<Card title="Place Orders" icon="plus" href="/trading/quickstart">
Start placing orders (from eligible regions).
</Card>
</CardGroup>
@@ -0,0 +1,242 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
> Use this file to discover all available pages before exploring further.
# Get Account Limits
> Get the authenticated account's effective rate-limit allowances for its current
volume-based tier: order-action rate, open-order cap, and the display-only
messages-per-minute figure. `open_orders` reflects the account's current live
open-order count; the rate-usage counters (`actions_per_minute`,
`actions_burst`, and `reset`) are not tracked here and are reported as 0.
<Badge color="gray" size="md">Request Weight: **2**</Badge>
## OpenAPI
````yaml /api-spec/perps-openapi.json get /v1/account/limits
openapi: 3.0.3
info:
title: Polymarket Perps HTTP API
version: 1.0.0
description: HTTP API for Polymarket perpetual trading system.
license:
name: Apache 2.0
url: https://www.apache.org/licenses/LICENSE-2.0.html
servers:
- url: https://api.perpetuals.polymarket.com
description: Production Perps HTTP API
security: []
paths:
/v1/account/limits:
get:
summary: Get Account Limits
description: >
Get the authenticated account's effective rate-limit allowances for its
current
volume-based tier: order-action rate, open-order cap, and the
display-only
messages-per-minute figure. `open_orders` reflects the account's current
live
open-order count; the rate-usage counters (`actions_per_minute`,
`actions_burst`, and `reset`) are not tracked here and are reported as
0.
operationId: getAccountLimits
responses:
'200':
description: Account limits response.
content:
application/json:
schema:
$ref: '#/components/schemas/AccountLimits'
'401':
$ref: '#/components/responses/Error401Response'
'429':
$ref: '#/components/responses/Error429Response'
'500':
$ref: '#/components/responses/Error500Response'
security:
- polymarket_proxy: []
polymarket_secret: []
components:
schemas:
AccountLimits:
type: object
required:
- actions_per_minute
- actions_per_minute_limit
- actions_burst
- actions_burst_limit
- open_orders
- open_orders_limit
- reset
- messages_per_minute
properties:
actions_per_minute:
$ref: '#/components/schemas/actions_per_minute'
actions_per_minute_limit:
$ref: '#/components/schemas/actions_per_minute_limit'
actions_burst:
$ref: '#/components/schemas/actions_burst'
actions_burst_limit:
$ref: '#/components/schemas/actions_burst_limit'
open_orders:
$ref: '#/components/schemas/open_orders'
open_orders_limit:
$ref: '#/components/schemas/open_orders_limit'
reset:
$ref: '#/components/schemas/rate_reset'
messages_per_minute:
$ref: '#/components/schemas/messages_per_minute'
actions_per_minute:
type: integer
description: Order action tokens used by the account in the current minute
example: 23
actions_per_minute_limit:
type: integer
description: Maximum order action tokens per account per minute
example: 300
actions_burst:
type: integer
description: Additional account action allowance remaining
actions_burst_limit:
type: integer
description: Additional account action allowance limit
open_orders:
type: integer
description: Current number of open orders
example: 42
open_orders_limit:
type: integer
description: Maximum number of open orders per account
example: 1000
rate_reset:
type: integer
description: Timestamp in milliseconds when the current interval resets
example: 1767225660000
messages_per_minute:
type: integer
description: >-
Display-only per-minute action/message allowance, equal to
actions_per_minute_limit. Not separately configured or enforced.
example: 300
Error401:
title: Error401
type: object
required:
- status
- error
properties:
status:
type: string
enum:
- err
error:
$ref: '#/components/schemas/error'
Error429:
title: Error429
type: object
required:
- status
- error
properties:
status:
type: string
enum:
- err
error:
$ref: '#/components/schemas/error'
Error500:
title: Error500
type: object
required:
- status
- error
properties:
status:
type: string
enum:
- err
error:
$ref: '#/components/schemas/error'
error:
type: string
description: >-
Error identifier. For domain rejections and transport errors
(`401`/`404`/`429`/`500`) this is a stable, machine-readable snake_case
identifier that is part of the API contract and safe to branch on, e.g.
`insufficient_margin`, `insufficient_balance`, `order_not_found`,
`reduce_only_invalid`, `unauthorized`, `not_found`. For `400` it is a
human-readable validation detail whose wording may change. See the Error
handling guide for the domain identifiers. (Post-only / Fill-or-Kill
outcomes are order statuses such as `post_only_rejected`, not
rejections.)
example: insufficient_margin
responses:
Error401Response:
description: >
Unauthorized — missing or invalid `POLYMARKET-PROXY` /
`POLYMARKET-SECRET`
credentials. `error` is `unauthorized`.
content:
application/json:
schema:
$ref: '#/components/schemas/Error401'
Error429Response:
description: >
Too Many Requests. `error` distinguishes the limit that was hit:
`ip_rate_limited` (per-IP token bucket), `action_rate_limited`
(per-account
action rate), or `open_orders_limit` (resting open-order cap).
headers:
Retry-After:
description: >
Whole seconds to wait before retrying. Present only on token-bucket
rate-limit rejections (`ip_rate_limited` and `action_rate_limited`);
a
conservative estimate of when enough capacity will have refilled to
admit the request. Absent on `open_orders_limit`, which is a
capacity
limit, not a rate limit — waiting does not free order slots; cancel
resting orders or wait for fills instead.
schema:
type: integer
example: 2
content:
application/json:
schema:
$ref: '#/components/schemas/Error429'
Error500Response:
description: |
Internal server error. `error` is `internal_error`.
content:
application/json:
schema:
$ref: '#/components/schemas/Error500'
securitySchemes:
polymarket_proxy:
type: apiKey
name: POLYMARKET-PROXY
in: header
description: Proxy address
polymarket_secret:
type: apiKey
name: POLYMARKET-SECRET
in: header
description: Correponding proxy secret
````
@@ -0,0 +1,207 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
> Use this file to discover all available pages before exploring further.
# Get Account Referral
> Get the authenticated account's invite code, parent referral code, direct
referral count, and fee share rate.
<Badge color="gray" size="md">Request Weight: **1**</Badge>
## OpenAPI
````yaml /api-spec/perps-openapi.json get /v1/account/referral
openapi: 3.0.3
info:
title: Polymarket Perps HTTP API
version: 1.0.0
description: HTTP API for Polymarket perpetual trading system.
license:
name: Apache 2.0
url: https://www.apache.org/licenses/LICENSE-2.0.html
servers:
- url: https://api.perpetuals.polymarket.com
description: Production Perps HTTP API
security: []
paths:
/v1/account/referral:
get:
summary: Get Account Referral
description: >
Get the authenticated account's invite code, parent referral code,
direct
referral count, and fee share rate.
operationId: getAccountReferral
responses:
'200':
description: Account referral response.
content:
application/json:
schema:
$ref: '#/components/schemas/AccountReferral'
'401':
$ref: '#/components/responses/Error401Response'
'429':
$ref: '#/components/responses/Error429Response'
'500':
$ref: '#/components/responses/Error500Response'
security:
- polymarket_proxy: []
polymarket_secret: []
components:
schemas:
AccountReferral:
type: object
required:
- code
- children_count
- referrals_left
- fee_share_rate
properties:
code:
$ref: '#/components/schemas/code'
parent:
$ref: '#/components/schemas/code'
description: >-
Parent referral code, omitted when the account has no parent
referral.
children_count:
$ref: '#/components/schemas/children_count'
referrals_left:
$ref: '#/components/schemas/referrals_left'
fee_share_rate:
$ref: '#/components/schemas/fee_share_rate'
code:
type: string
description: Referral or invite code
example: ABC123
children_count:
type: integer
description: Number of directly referred child accounts
example: 12
referrals_left:
type: integer
description: Number of additional referrals remaining for this account's invite code
example: 11
fee_share_rate:
type: string
description: Referral fee share rate. Defaults to 0.2.
example: '0.2'
Error401:
title: Error401
type: object
required:
- status
- error
properties:
status:
type: string
enum:
- err
error:
$ref: '#/components/schemas/error'
Error429:
title: Error429
type: object
required:
- status
- error
properties:
status:
type: string
enum:
- err
error:
$ref: '#/components/schemas/error'
Error500:
title: Error500
type: object
required:
- status
- error
properties:
status:
type: string
enum:
- err
error:
$ref: '#/components/schemas/error'
error:
type: string
description: >-
Error identifier. For domain rejections and transport errors
(`401`/`404`/`429`/`500`) this is a stable, machine-readable snake_case
identifier that is part of the API contract and safe to branch on, e.g.
`insufficient_margin`, `insufficient_balance`, `order_not_found`,
`reduce_only_invalid`, `unauthorized`, `not_found`. For `400` it is a
human-readable validation detail whose wording may change. See the Error
handling guide for the domain identifiers. (Post-only / Fill-or-Kill
outcomes are order statuses such as `post_only_rejected`, not
rejections.)
example: insufficient_margin
responses:
Error401Response:
description: >
Unauthorized — missing or invalid `POLYMARKET-PROXY` /
`POLYMARKET-SECRET`
credentials. `error` is `unauthorized`.
content:
application/json:
schema:
$ref: '#/components/schemas/Error401'
Error429Response:
description: >
Too Many Requests. `error` distinguishes the limit that was hit:
`ip_rate_limited` (per-IP token bucket), `action_rate_limited`
(per-account
action rate), or `open_orders_limit` (resting open-order cap).
headers:
Retry-After:
description: >
Whole seconds to wait before retrying. Present only on token-bucket
rate-limit rejections (`ip_rate_limited` and `action_rate_limited`);
a
conservative estimate of when enough capacity will have refilled to
admit the request. Absent on `open_orders_limit`, which is a
capacity
limit, not a rate limit — waiting does not free order slots; cancel
resting orders or wait for fills instead.
schema:
type: integer
example: 2
content:
application/json:
schema:
$ref: '#/components/schemas/Error429'
Error500Response:
description: |
Internal server error. `error` is `internal_error`.
content:
application/json:
schema:
$ref: '#/components/schemas/Error500'
securitySchemes:
polymarket_proxy:
type: apiKey
name: POLYMARKET-PROXY
in: header
description: Proxy address
polymarket_secret:
type: apiKey
name: POLYMARKET-SECRET
in: header
description: Correponding proxy secret
````
@@ -0,0 +1,333 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
> Use this file to discover all available pages before exploring further.
# Get Account Rewards
> Get per-instrument daily liquidity reward shares for the authenticated account.
Reward periods run from 12:00 UTC to 12:00 UTC and are labeled by their UTC end date.
OI rewards pay 6% APR on the account's full daily average gross OI across all
instruments when the combined daily average gross OI of its rewards entity is
at least $1M. Accounts without an entity mapping qualify independently.
The first reward period starts at 2026-05-08 12:00 UTC. If no date range is provided,
the latest computed reward period is returned.
<Badge color="gray" size="md">Request Weight: **2**</Badge>
## OpenAPI
````yaml /api-spec/perps-openapi.json get /v1/account/rewards
openapi: 3.0.3
info:
title: Polymarket Perps HTTP API
version: 1.0.0
description: HTTP API for Polymarket perpetual trading system.
license:
name: Apache 2.0
url: https://www.apache.org/licenses/LICENSE-2.0.html
servers:
- url: https://api.perpetuals.polymarket.com
description: Production Perps HTTP API
security: []
paths:
/v1/account/rewards:
get:
summary: Get Account Rewards
description: >
Get per-instrument daily liquidity reward shares for the authenticated
account.
Reward periods run from 12:00 UTC to 12:00 UTC and are labeled by their
UTC end date.
OI rewards pay 6% APR on the account's full daily average gross OI
across all
instruments when the combined daily average gross OI of its rewards
entity is
at least $1M. Accounts without an entity mapping qualify independently.
The first reward period starts at 2026-05-08 12:00 UTC. If no date range
is provided,
the latest computed reward period is returned.
operationId: getAccountRewards
parameters:
- name: date
in: query
required: false
schema:
$ref: '#/components/schemas/date'
- name: start_date
in: query
required: false
schema:
$ref: '#/components/schemas/start_date'
- name: end_date
in: query
required: false
schema:
$ref: '#/components/schemas/end_date'
- name: limit
in: query
required: false
schema:
$ref: '#/components/schemas/limit'
responses:
'200':
description: Account rewards response.
content:
application/json:
schema:
$ref: '#/components/schemas/AccountRewards'
'400':
$ref: '#/components/responses/Error400Response'
'401':
$ref: '#/components/responses/Error401Response'
'429':
$ref: '#/components/responses/Error429Response'
'500':
$ref: '#/components/responses/Error500Response'
security:
- polymarket_proxy: []
polymarket_secret: []
components:
schemas:
date:
type: string
description: UTC reward period end date in YYYY-MM-DD format
example: '2026-05-10'
start_date:
type: string
description: Inclusive UTC start date in YYYY-MM-DD format
example: '2026-05-01'
end_date:
type: string
description: Inclusive UTC end date in YYYY-MM-DD format
example: '2026-05-10'
limit:
type: integer
description: Maximum number of entries to return
example: 100
AccountRewards:
type: object
required:
- data
- more
properties:
data:
type: array
items:
$ref: '#/components/schemas/AccountReward'
more:
$ref: '#/components/schemas/more'
AccountReward:
type: object
required:
- date
- maker_share_7d
- reward_distributed
- breakdown
properties:
date:
$ref: '#/components/schemas/date'
maker_share_7d:
$ref: '#/components/schemas/maker_share_7d'
reward_distributed:
$ref: '#/components/schemas/reward_distributed'
breakdown:
type: array
items:
$ref: '#/components/schemas/AccountRewardInstrument'
oi_rewards:
$ref: '#/components/schemas/AccountRewardOi'
more:
type: boolean
description: More data available
Error400:
title: Error400
type: object
required:
- status
- error
properties:
status:
type: string
enum:
- err
error:
$ref: '#/components/schemas/error'
Error401:
title: Error401
type: object
required:
- status
- error
properties:
status:
type: string
enum:
- err
error:
$ref: '#/components/schemas/error'
Error429:
title: Error429
type: object
required:
- status
- error
properties:
status:
type: string
enum:
- err
error:
$ref: '#/components/schemas/error'
Error500:
title: Error500
type: object
required:
- status
- error
properties:
status:
type: string
enum:
- err
error:
$ref: '#/components/schemas/error'
maker_share_7d:
type: string
description: Rolling 7-day account maker volume divided by total exchange volume
example: '0.35'
reward_distributed:
type: boolean
description: Whether rewards for this period have been marked as distributed
example: true
AccountRewardInstrument:
type: object
required:
- instrument_id
- reward_pool
- reward_amount
properties:
instrument_id:
$ref: '#/components/schemas/instrument_id'
reward_pool:
$ref: '#/components/schemas/reward_pool'
reward_amount:
$ref: '#/components/schemas/reward_amount'
AccountRewardOi:
type: object
required:
- account_oi
- reward_amount
properties:
account_oi:
$ref: '#/components/schemas/account_oi'
reward_amount:
$ref: '#/components/schemas/reward_amount'
error:
type: string
description: >-
Error identifier. For domain rejections and transport errors
(`401`/`404`/`429`/`500`) this is a stable, machine-readable snake_case
identifier that is part of the API contract and safe to branch on, e.g.
`insufficient_margin`, `insufficient_balance`, `order_not_found`,
`reduce_only_invalid`, `unauthorized`, `not_found`. For `400` it is a
human-readable validation detail whose wording may change. See the Error
handling guide for the domain identifiers. (Post-only / Fill-or-Kill
outcomes are order statuses such as `post_only_rejected`, not
rejections.)
example: insufficient_margin
instrument_id:
type: integer
description: Instrument ID
reward_pool:
type: string
description: Configured reward pool for the instrument
example: '1000'
reward_amount:
type: string
description: Reward amount attributed to this reward row
example: '127.50344'
account_oi:
type: string
description: >-
Daily average gross open-interest notional for this account across all
instruments
example: '3200000'
responses:
Error400Response:
description: |
Bad request — the request was malformed or failed validation (bad query
parameters, unparseable body, invalid signature, or a domain pre-check).
The `error` field is a human-readable validation detail.
content:
application/json:
schema:
$ref: '#/components/schemas/Error400'
Error401Response:
description: >
Unauthorized — missing or invalid `POLYMARKET-PROXY` /
`POLYMARKET-SECRET`
credentials. `error` is `unauthorized`.
content:
application/json:
schema:
$ref: '#/components/schemas/Error401'
Error429Response:
description: >
Too Many Requests. `error` distinguishes the limit that was hit:
`ip_rate_limited` (per-IP token bucket), `action_rate_limited`
(per-account
action rate), or `open_orders_limit` (resting open-order cap).
headers:
Retry-After:
description: >
Whole seconds to wait before retrying. Present only on token-bucket
rate-limit rejections (`ip_rate_limited` and `action_rate_limited`);
a
conservative estimate of when enough capacity will have refilled to
admit the request. Absent on `open_orders_limit`, which is a
capacity
limit, not a rate limit — waiting does not free order slots; cancel
resting orders or wait for fills instead.
schema:
type: integer
example: 2
content:
application/json:
schema:
$ref: '#/components/schemas/Error429'
Error500Response:
description: |
Internal server error. `error` is `internal_error`.
content:
application/json:
schema:
$ref: '#/components/schemas/Error500'
securitySchemes:
polymarket_proxy:
type: apiKey
name: POLYMARKET-PROXY
in: header
description: Proxy address
polymarket_secret:
type: apiKey
name: POLYMARKET-SECRET
in: header
description: Correponding proxy secret
````
@@ -0,0 +1,223 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
> Use this file to discover all available pages before exploring further.
# Get Account Stats
> Get the authenticated account's 7-day trading stats (taker volume, maker volume,
account maker share, and entity maker share when applicable).
Stats are cached by UTC day and may be stale by up to 24 hours.
<Badge color="gray" size="md">Request Weight: **2**</Badge>
## OpenAPI
````yaml /api-spec/perps-openapi.json get /v1/account/stats
openapi: 3.0.3
info:
title: Polymarket Perps HTTP API
version: 1.0.0
description: HTTP API for Polymarket perpetual trading system.
license:
name: Apache 2.0
url: https://www.apache.org/licenses/LICENSE-2.0.html
servers:
- url: https://api.perpetuals.polymarket.com
description: Production Perps HTTP API
security: []
paths:
/v1/account/stats:
get:
summary: Get Account Stats
description: >
Get the authenticated account's 7-day trading stats (taker volume, maker
volume,
account maker share, and entity maker share when applicable).
Stats are cached by UTC day and may be stale by up to 24 hours.
operationId: getAccountStats
responses:
'200':
description: Account stats response.
content:
application/json:
schema:
$ref: '#/components/schemas/AccountStats'
'401':
$ref: '#/components/responses/Error401Response'
'429':
$ref: '#/components/responses/Error429Response'
'500':
$ref: '#/components/responses/Error500Response'
security:
- polymarket_proxy: []
polymarket_secret: []
components:
schemas:
AccountStats:
type: object
required:
- volume_7d
- taker_volume_7d
- maker_volume_7d
- account_maker_share_7d
properties:
volume_7d:
$ref: '#/components/schemas/volume_7d'
taker_volume_7d:
$ref: '#/components/schemas/taker_volume_7d'
maker_volume_7d:
$ref: '#/components/schemas/maker_volume_7d'
account_maker_share_7d:
$ref: '#/components/schemas/account_maker_share_7d'
entity_maker_share_7d:
$ref: '#/components/schemas/entity_maker_share_7d'
entity_id:
$ref: '#/components/schemas/entity_id'
entity_name:
$ref: '#/components/schemas/entity_name'
volume_7d:
type: string
description: Rolling 7-day perpetual trading volume in USD
example: '5000000'
taker_volume_7d:
type: string
description: Rolling 7-day perpetual taker volume in USD
example: '3500000'
maker_volume_7d:
type: string
description: Rolling 7-day perpetual maker volume in USD
example: '1500000'
account_maker_share_7d:
type: string
description: Rolling 7-day account maker volume divided by total exchange volume
example: '0.35'
entity_maker_share_7d:
type: string
description: Rolling 7-day entity maker volume divided by total exchange volume
example: '0.35'
entity_id:
type: integer
description: Liquidity rewards entity ID
example: 42
entity_name:
type: string
description: Liquidity rewards entity name
example: desk
Error401:
title: Error401
type: object
required:
- status
- error
properties:
status:
type: string
enum:
- err
error:
$ref: '#/components/schemas/error'
Error429:
title: Error429
type: object
required:
- status
- error
properties:
status:
type: string
enum:
- err
error:
$ref: '#/components/schemas/error'
Error500:
title: Error500
type: object
required:
- status
- error
properties:
status:
type: string
enum:
- err
error:
$ref: '#/components/schemas/error'
error:
type: string
description: >-
Error identifier. For domain rejections and transport errors
(`401`/`404`/`429`/`500`) this is a stable, machine-readable snake_case
identifier that is part of the API contract and safe to branch on, e.g.
`insufficient_margin`, `insufficient_balance`, `order_not_found`,
`reduce_only_invalid`, `unauthorized`, `not_found`. For `400` it is a
human-readable validation detail whose wording may change. See the Error
handling guide for the domain identifiers. (Post-only / Fill-or-Kill
outcomes are order statuses such as `post_only_rejected`, not
rejections.)
example: insufficient_margin
responses:
Error401Response:
description: >
Unauthorized — missing or invalid `POLYMARKET-PROXY` /
`POLYMARKET-SECRET`
credentials. `error` is `unauthorized`.
content:
application/json:
schema:
$ref: '#/components/schemas/Error401'
Error429Response:
description: >
Too Many Requests. `error` distinguishes the limit that was hit:
`ip_rate_limited` (per-IP token bucket), `action_rate_limited`
(per-account
action rate), or `open_orders_limit` (resting open-order cap).
headers:
Retry-After:
description: >
Whole seconds to wait before retrying. Present only on token-bucket
rate-limit rejections (`ip_rate_limited` and `action_rate_limited`);
a
conservative estimate of when enough capacity will have refilled to
admit the request. Absent on `open_orders_limit`, which is a
capacity
limit, not a rate limit — waiting does not free order slots; cancel
resting orders or wait for fills instead.
schema:
type: integer
example: 2
content:
application/json:
schema:
$ref: '#/components/schemas/Error429'
Error500Response:
description: |
Internal server error. `error` is `internal_error`.
content:
application/json:
schema:
$ref: '#/components/schemas/Error500'
securitySchemes:
polymarket_proxy:
type: apiKey
name: POLYMARKET-PROXY
in: header
description: Proxy address
polymarket_secret:
type: apiKey
name: POLYMARKET-SECRET
in: header
description: Correponding proxy secret
````
@@ -0,0 +1,210 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
> Use this file to discover all available pages before exploring further.
# Get Auto-Cancel Status
> Get the current auto-cancel dead-man-switch status for the authenticated
account, including the armed deadline, today's trigger count, and when
the daily counter resets.
<Badge color="gray" size="md">Request Weight: **1**</Badge>
## OpenAPI
````yaml /api-spec/perps-openapi.json get /v1/account/auto-cancel
openapi: 3.0.3
info:
title: Polymarket Perps HTTP API
version: 1.0.0
description: HTTP API for Polymarket perpetual trading system.
license:
name: Apache 2.0
url: https://www.apache.org/licenses/LICENSE-2.0.html
servers:
- url: https://api.perpetuals.polymarket.com
description: Production Perps HTTP API
security: []
paths:
/v1/account/auto-cancel:
get:
summary: Get Auto-Cancel Status
description: |
Get the current auto-cancel dead-man-switch status for the authenticated
account, including the armed deadline, today's trigger count, and when
the daily counter resets.
operationId: getAutoCancel
responses:
'200':
description: Auto-cancel status response.
content:
application/json:
schema:
$ref: '#/components/schemas/AutoCancelStatus'
'401':
$ref: '#/components/responses/Error401Response'
'429':
$ref: '#/components/responses/Error429Response'
'500':
$ref: '#/components/responses/Error500Response'
security:
- polymarket_proxy: []
polymarket_secret: []
components:
schemas:
AutoCancelStatus:
type: object
required:
- deadline
- triggered
- daily_limit
- next_reset
properties:
deadline:
$ref: '#/components/schemas/auto_cancel_deadline'
triggered:
$ref: '#/components/schemas/auto_cancel_triggered'
daily_limit:
$ref: '#/components/schemas/auto_cancel_daily_limit'
next_reset:
$ref: '#/components/schemas/auto_cancel_next_reset'
auto_cancel_deadline:
type: integer
description: |
Unix-ms deadline for the per-account auto-cancel dead-man-switch.
Zero means no schedule is armed. When the deadline elapses, every
open order on the account is cancelled and the schedule clears.
example: 1767000045000
auto_cancel_triggered:
type: integer
description: |
Number of times auto-cancel has fired for this account during the
current UTC day. Resets to zero at 00:00 UTC.
example: 0
auto_cancel_daily_limit:
type: integer
description: |
Maximum number of auto-cancel triggers allowed per UTC day.
example: 10
auto_cancel_next_reset:
type: integer
description: |
Unix-ms timestamp of the next UTC midnight when the daily trigger
count resets to zero.
example: 1767052800000
Error401:
title: Error401
type: object
required:
- status
- error
properties:
status:
type: string
enum:
- err
error:
$ref: '#/components/schemas/error'
Error429:
title: Error429
type: object
required:
- status
- error
properties:
status:
type: string
enum:
- err
error:
$ref: '#/components/schemas/error'
Error500:
title: Error500
type: object
required:
- status
- error
properties:
status:
type: string
enum:
- err
error:
$ref: '#/components/schemas/error'
error:
type: string
description: >-
Error identifier. For domain rejections and transport errors
(`401`/`404`/`429`/`500`) this is a stable, machine-readable snake_case
identifier that is part of the API contract and safe to branch on, e.g.
`insufficient_margin`, `insufficient_balance`, `order_not_found`,
`reduce_only_invalid`, `unauthorized`, `not_found`. For `400` it is a
human-readable validation detail whose wording may change. See the Error
handling guide for the domain identifiers. (Post-only / Fill-or-Kill
outcomes are order statuses such as `post_only_rejected`, not
rejections.)
example: insufficient_margin
responses:
Error401Response:
description: >
Unauthorized — missing or invalid `POLYMARKET-PROXY` /
`POLYMARKET-SECRET`
credentials. `error` is `unauthorized`.
content:
application/json:
schema:
$ref: '#/components/schemas/Error401'
Error429Response:
description: >
Too Many Requests. `error` distinguishes the limit that was hit:
`ip_rate_limited` (per-IP token bucket), `action_rate_limited`
(per-account
action rate), or `open_orders_limit` (resting open-order cap).
headers:
Retry-After:
description: >
Whole seconds to wait before retrying. Present only on token-bucket
rate-limit rejections (`ip_rate_limited` and `action_rate_limited`);
a
conservative estimate of when enough capacity will have refilled to
admit the request. Absent on `open_orders_limit`, which is a
capacity
limit, not a rate limit — waiting does not free order slots; cancel
resting orders or wait for fills instead.
schema:
type: integer
example: 2
content:
application/json:
schema:
$ref: '#/components/schemas/Error429'
Error500Response:
description: |
Internal server error. `error` is `internal_error`.
content:
application/json:
schema:
$ref: '#/components/schemas/Error500'
securitySchemes:
polymarket_proxy:
type: apiKey
name: POLYMARKET-PROXY
in: header
description: Proxy address
polymarket_secret:
type: apiKey
name: POLYMARKET-SECRET
in: header
description: Correponding proxy secret
````
@@ -0,0 +1,191 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
> Use this file to discover all available pages before exploring further.
# Get Balances
> Get asset balances for the authenticated account.
<Badge color="gray" size="md">Request Weight: **2**</Badge>
## OpenAPI
````yaml /api-spec/perps-openapi.json get /v1/account/balances
openapi: 3.0.3
info:
title: Polymarket Perps HTTP API
version: 1.0.0
description: HTTP API for Polymarket perpetual trading system.
license:
name: Apache 2.0
url: https://www.apache.org/licenses/LICENSE-2.0.html
servers:
- url: https://api.perpetuals.polymarket.com
description: Production Perps HTTP API
security: []
paths:
/v1/account/balances:
get:
summary: Get Balances
description: Get asset balances for the authenticated account.
operationId: getBalances
responses:
'200':
description: Balances response.
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Balance'
'401':
$ref: '#/components/responses/Error401Response'
'429':
$ref: '#/components/responses/Error429Response'
'500':
$ref: '#/components/responses/Error500Response'
security:
- polymarket_proxy: []
polymarket_secret: []
components:
schemas:
Balance:
type: object
required:
- asset
- balance
- value
properties:
asset:
$ref: '#/components/schemas/asset'
balance:
$ref: '#/components/schemas/balance'
value:
$ref: '#/components/schemas/value'
asset:
type: string
description: Asset name
example: USDC
balance:
type: string
description: Total balance
example: '10000.00'
value:
type: string
description: USD value
example: '10000.00'
Error401:
title: Error401
type: object
required:
- status
- error
properties:
status:
type: string
enum:
- err
error:
$ref: '#/components/schemas/error'
Error429:
title: Error429
type: object
required:
- status
- error
properties:
status:
type: string
enum:
- err
error:
$ref: '#/components/schemas/error'
Error500:
title: Error500
type: object
required:
- status
- error
properties:
status:
type: string
enum:
- err
error:
$ref: '#/components/schemas/error'
error:
type: string
description: >-
Error identifier. For domain rejections and transport errors
(`401`/`404`/`429`/`500`) this is a stable, machine-readable snake_case
identifier that is part of the API contract and safe to branch on, e.g.
`insufficient_margin`, `insufficient_balance`, `order_not_found`,
`reduce_only_invalid`, `unauthorized`, `not_found`. For `400` it is a
human-readable validation detail whose wording may change. See the Error
handling guide for the domain identifiers. (Post-only / Fill-or-Kill
outcomes are order statuses such as `post_only_rejected`, not
rejections.)
example: insufficient_margin
responses:
Error401Response:
description: >
Unauthorized — missing or invalid `POLYMARKET-PROXY` /
`POLYMARKET-SECRET`
credentials. `error` is `unauthorized`.
content:
application/json:
schema:
$ref: '#/components/schemas/Error401'
Error429Response:
description: >
Too Many Requests. `error` distinguishes the limit that was hit:
`ip_rate_limited` (per-IP token bucket), `action_rate_limited`
(per-account
action rate), or `open_orders_limit` (resting open-order cap).
headers:
Retry-After:
description: >
Whole seconds to wait before retrying. Present only on token-bucket
rate-limit rejections (`ip_rate_limited` and `action_rate_limited`);
a
conservative estimate of when enough capacity will have refilled to
admit the request. Absent on `open_orders_limit`, which is a
capacity
limit, not a rate limit — waiting does not free order slots; cancel
resting orders or wait for fills instead.
schema:
type: integer
example: 2
content:
application/json:
schema:
$ref: '#/components/schemas/Error429'
Error500Response:
description: |
Internal server error. `error` is `internal_error`.
content:
application/json:
schema:
$ref: '#/components/schemas/Error500'
securitySchemes:
polymarket_proxy:
type: apiKey
name: POLYMARKET-PROXY
in: header
description: Proxy address
polymarket_secret:
type: apiKey
name: POLYMARKET-SECRET
in: header
description: Correponding proxy secret
````
@@ -0,0 +1,211 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
> Use this file to discover all available pages before exploring further.
# Get BBO
> Get best bid and offer for all instruments.
<Badge color="gray" size="md">Request Weight: **2**</Badge>
## OpenAPI
````yaml /api-spec/perps-openapi.json get /v1/info/bbo
openapi: 3.0.3
info:
title: Polymarket Perps HTTP API
version: 1.0.0
description: HTTP API for Polymarket perpetual trading system.
license:
name: Apache 2.0
url: https://www.apache.org/licenses/LICENSE-2.0.html
servers:
- url: https://api.perpetuals.polymarket.com
description: Production Perps HTTP API
security: []
paths:
/v1/info/bbo:
get:
summary: Get BBO
description: Get best bid and offer for all instruments.
operationId: getBBO
parameters:
- name: instrument_id
in: query
required: false
schema:
$ref: '#/components/schemas/instrument_id'
responses:
'200':
description: BBO response.
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/BBO'
'400':
$ref: '#/components/responses/Error400Response'
'429':
$ref: '#/components/responses/Error429Response'
'500':
$ref: '#/components/responses/Error500Response'
security: []
components:
schemas:
instrument_id:
type: integer
description: Instrument ID
BBO:
title: BBO
type: object
required:
- instrument_id
- bid_price
- bid_quantity
- ask_price
- ask_quantity
- timestamp
properties:
instrument_id:
$ref: '#/components/schemas/iid'
bid_price:
$ref: '#/components/schemas/best_bid_price'
bid_quantity:
$ref: '#/components/schemas/best_bid_quantity'
ask_price:
$ref: '#/components/schemas/best_ask_price'
ask_quantity:
$ref: '#/components/schemas/best_ask_quantity'
timestamp:
$ref: '#/components/schemas/ts'
iid:
type: integer
description: Instrument ID
example: 1
best_bid_price:
type: string
description: Best bid price
example: '99.50'
best_bid_quantity:
type: string
description: Best bid quantity
example: '10.00'
best_ask_price:
type: string
description: Best ask price
example: '100.50'
best_ask_quantity:
type: string
description: Best ask quantity
example: '10.00'
ts:
type: integer
description: >-
Request timestamp. Unix milliseconds for most operations; Unix seconds
for withdrawals (must match the on-chain EIP-712 struct verified against
block.timestamp).
example: 1767225600000
Error400:
title: Error400
type: object
required:
- status
- error
properties:
status:
type: string
enum:
- err
error:
$ref: '#/components/schemas/error'
Error429:
title: Error429
type: object
required:
- status
- error
properties:
status:
type: string
enum:
- err
error:
$ref: '#/components/schemas/error'
Error500:
title: Error500
type: object
required:
- status
- error
properties:
status:
type: string
enum:
- err
error:
$ref: '#/components/schemas/error'
error:
type: string
description: >-
Error identifier. For domain rejections and transport errors
(`401`/`404`/`429`/`500`) this is a stable, machine-readable snake_case
identifier that is part of the API contract and safe to branch on, e.g.
`insufficient_margin`, `insufficient_balance`, `order_not_found`,
`reduce_only_invalid`, `unauthorized`, `not_found`. For `400` it is a
human-readable validation detail whose wording may change. See the Error
handling guide for the domain identifiers. (Post-only / Fill-or-Kill
outcomes are order statuses such as `post_only_rejected`, not
rejections.)
example: insufficient_margin
responses:
Error400Response:
description: |
Bad request — the request was malformed or failed validation (bad query
parameters, unparseable body, invalid signature, or a domain pre-check).
The `error` field is a human-readable validation detail.
content:
application/json:
schema:
$ref: '#/components/schemas/Error400'
Error429Response:
description: >
Too Many Requests. `error` distinguishes the limit that was hit:
`ip_rate_limited` (per-IP token bucket), `action_rate_limited`
(per-account
action rate), or `open_orders_limit` (resting open-order cap).
headers:
Retry-After:
description: >
Whole seconds to wait before retrying. Present only on token-bucket
rate-limit rejections (`ip_rate_limited` and `action_rate_limited`);
a
conservative estimate of when enough capacity will have refilled to
admit the request. Absent on `open_orders_limit`, which is a
capacity
limit, not a rate limit — waiting does not free order slots; cancel
resting orders or wait for fills instead.
schema:
type: integer
example: 2
content:
application/json:
schema:
$ref: '#/components/schemas/Error429'
Error500Response:
description: |
Internal server error. `error` is `internal_error`.
content:
application/json:
schema:
$ref: '#/components/schemas/Error500'
````
@@ -0,0 +1,233 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
> Use this file to discover all available pages before exploring further.
# Get Book
> Get book for an instrument.
<Badge color="gray" size="md">Request Weight:</Badge>
<br />
<Badge color="gray" size="md">Depth 10: **2**</Badge>
<br />
<Badge color="gray" size="md">Depth 100: **5**</Badge>
<br />
<Badge color="gray" size="md">Depth 500: **10**</Badge>
<br />
<Badge color="gray" size="md">Depth 1000: **20**</Badge>
## OpenAPI
````yaml /api-spec/perps-openapi.json get /v1/info/book
openapi: 3.0.3
info:
title: Polymarket Perps HTTP API
version: 1.0.0
description: HTTP API for Polymarket perpetual trading system.
license:
name: Apache 2.0
url: https://www.apache.org/licenses/LICENSE-2.0.html
servers:
- url: https://api.perpetuals.polymarket.com
description: Production Perps HTTP API
security: []
paths:
/v1/info/book:
get:
summary: Get Book
description: Get book for an instrument.
operationId: getBook
parameters:
- name: instrument_id
in: query
required: true
schema:
$ref: '#/components/schemas/instrument_id'
- name: depth
in: query
required: false
schema:
$ref: '#/components/schemas/depth'
responses:
'200':
description: Book response.
content:
application/json:
schema:
$ref: '#/components/schemas/Book'
'400':
$ref: '#/components/responses/Error400Response'
'429':
$ref: '#/components/responses/Error429Response'
'500':
$ref: '#/components/responses/Error500Response'
security: []
components:
schemas:
instrument_id:
type: integer
description: Instrument ID
depth:
type: integer
description: Number of book levels to return
enum:
- 10
- 100
- 500
- 1000
default: 100
Book:
type: object
required:
- instrument_id
- bids
- asks
- timestamp
- sequence
properties:
instrument_id:
$ref: '#/components/schemas/instrument_id'
bids:
type: array
items:
$ref: '#/components/schemas/level'
description: Bid levels
asks:
type: array
items:
$ref: '#/components/schemas/level'
description: Ask levels
timestamp:
$ref: '#/components/schemas/timestamp'
sequence:
$ref: '#/components/schemas/sequence'
level:
type: array
items:
type: string
maxItems: 2
description: |
- `"100.00"` - Price
- `"10.00"` - Quantity
example:
- '100.00'
- '10.00'
timestamp:
type: integer
description: Timestamp in milliseconds
example: 1767225600000
sequence:
type: integer
description: Sequence number
example: 1234567890
Error400:
title: Error400
type: object
required:
- status
- error
properties:
status:
type: string
enum:
- err
error:
$ref: '#/components/schemas/error'
Error429:
title: Error429
type: object
required:
- status
- error
properties:
status:
type: string
enum:
- err
error:
$ref: '#/components/schemas/error'
Error500:
title: Error500
type: object
required:
- status
- error
properties:
status:
type: string
enum:
- err
error:
$ref: '#/components/schemas/error'
error:
type: string
description: >-
Error identifier. For domain rejections and transport errors
(`401`/`404`/`429`/`500`) this is a stable, machine-readable snake_case
identifier that is part of the API contract and safe to branch on, e.g.
`insufficient_margin`, `insufficient_balance`, `order_not_found`,
`reduce_only_invalid`, `unauthorized`, `not_found`. For `400` it is a
human-readable validation detail whose wording may change. See the Error
handling guide for the domain identifiers. (Post-only / Fill-or-Kill
outcomes are order statuses such as `post_only_rejected`, not
rejections.)
example: insufficient_margin
responses:
Error400Response:
description: |
Bad request — the request was malformed or failed validation (bad query
parameters, unparseable body, invalid signature, or a domain pre-check).
The `error` field is a human-readable validation detail.
content:
application/json:
schema:
$ref: '#/components/schemas/Error400'
Error429Response:
description: >
Too Many Requests. `error` distinguishes the limit that was hit:
`ip_rate_limited` (per-IP token bucket), `action_rate_limited`
(per-account
action rate), or `open_orders_limit` (resting open-order cap).
headers:
Retry-After:
description: >
Whole seconds to wait before retrying. Present only on token-bucket
rate-limit rejections (`ip_rate_limited` and `action_rate_limited`);
a
conservative estimate of when enough capacity will have refilled to
admit the request. Absent on `open_orders_limit`, which is a
capacity
limit, not a rate limit — waiting does not free order slots; cancel
resting orders or wait for fills instead.
schema:
type: integer
example: 2
content:
application/json:
schema:
$ref: '#/components/schemas/Error429'
Error500Response:
description: |
Internal server error. `error` is `internal_error`.
content:
application/json:
schema:
$ref: '#/components/schemas/Error500'
````
@@ -0,0 +1,169 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
> Use this file to discover all available pages before exploring further.
# Get Collateral Assets
> Get a list of collateral assets.
<Badge color="gray" size="md">Request Weight: **2**</Badge>
## OpenAPI
````yaml /api-spec/perps-openapi.json get /v1/info/assets
openapi: 3.0.3
info:
title: Polymarket Perps HTTP API
version: 1.0.0
description: HTTP API for Polymarket perpetual trading system.
license:
name: Apache 2.0
url: https://www.apache.org/licenses/LICENSE-2.0.html
servers:
- url: https://api.perpetuals.polymarket.com
description: Production Perps HTTP API
security: []
paths:
/v1/info/assets:
get:
summary: Get Collateral Assets
description: |
Get a list of collateral assets.
operationId: getAssets
responses:
'200':
description: Assets response.
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Asset'
'429':
$ref: '#/components/responses/Error429Response'
'500':
$ref: '#/components/responses/Error500Response'
security: []
components:
schemas:
Asset:
type: object
required:
- asset
- address
- decimals
- collateral_ratio
- withdrawal_fee
properties:
asset:
$ref: '#/components/schemas/asset'
address:
$ref: '#/components/schemas/address'
decimals:
$ref: '#/components/schemas/decimals'
collateral_ratio:
$ref: '#/components/schemas/collateral_ratio'
withdrawal_fee:
$ref: '#/components/schemas/withdrawal_fee'
asset:
type: string
description: Asset name
example: USDC
address:
type: string
description: Address
example: '0x1234567890abcdef1234567890abcdef12345678'
decimals:
type: integer
description: Asset decimals
example: 6
collateral_ratio:
type: string
description: Collateral ratio
example: '1.00'
withdrawal_fee:
type: string
description: Withdrawal transaction fee in decimalized asset units
example: '5.00'
Error429:
title: Error429
type: object
required:
- status
- error
properties:
status:
type: string
enum:
- err
error:
$ref: '#/components/schemas/error'
Error500:
title: Error500
type: object
required:
- status
- error
properties:
status:
type: string
enum:
- err
error:
$ref: '#/components/schemas/error'
error:
type: string
description: >-
Error identifier. For domain rejections and transport errors
(`401`/`404`/`429`/`500`) this is a stable, machine-readable snake_case
identifier that is part of the API contract and safe to branch on, e.g.
`insufficient_margin`, `insufficient_balance`, `order_not_found`,
`reduce_only_invalid`, `unauthorized`, `not_found`. For `400` it is a
human-readable validation detail whose wording may change. See the Error
handling guide for the domain identifiers. (Post-only / Fill-or-Kill
outcomes are order statuses such as `post_only_rejected`, not
rejections.)
example: insufficient_margin
responses:
Error429Response:
description: >
Too Many Requests. `error` distinguishes the limit that was hit:
`ip_rate_limited` (per-IP token bucket), `action_rate_limited`
(per-account
action rate), or `open_orders_limit` (resting open-order cap).
headers:
Retry-After:
description: >
Whole seconds to wait before retrying. Present only on token-bucket
rate-limit rejections (`ip_rate_limited` and `action_rate_limited`);
a
conservative estimate of when enough capacity will have refilled to
admit the request. Absent on `open_orders_limit`, which is a
capacity
limit, not a rate limit — waiting does not free order slots; cancel
resting orders or wait for fills instead.
schema:
type: integer
example: 2
content:
application/json:
schema:
$ref: '#/components/schemas/Error429'
Error500Response:
description: |
Internal server error. `error` is `internal_error`.
content:
application/json:
schema:
$ref: '#/components/schemas/Error500'
````
@@ -0,0 +1,230 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
> Use this file to discover all available pages before exploring further.
# Get Credentials
> Get the account ID, address, and proxy keys for the authenticated account.
<Badge color="gray" size="md">Request Weight: **2**</Badge>
## OpenAPI
````yaml /api-spec/perps-openapi.json get /v1/account/credentials
openapi: 3.0.3
info:
title: Polymarket Perps HTTP API
version: 1.0.0
description: HTTP API for Polymarket perpetual trading system.
license:
name: Apache 2.0
url: https://www.apache.org/licenses/LICENSE-2.0.html
servers:
- url: https://api.perpetuals.polymarket.com
description: Production Perps HTTP API
security: []
paths:
/v1/account/credentials:
get:
summary: Get Credentials
description: >-
Get the account ID, address, and proxy keys for the authenticated
account.
operationId: getCredentials
responses:
'200':
description: Credentials response.
content:
application/json:
schema:
$ref: '#/components/schemas/Credentials'
'400':
$ref: '#/components/responses/Error400Response'
'401':
$ref: '#/components/responses/Error401Response'
'429':
$ref: '#/components/responses/Error429Response'
'500':
$ref: '#/components/responses/Error500Response'
security:
- polymarket_proxy: []
polymarket_secret: []
components:
schemas:
Credentials:
type: object
required:
- address
- keys
properties:
address:
$ref: '#/components/schemas/address'
keys:
type: array
items:
$ref: '#/components/schemas/Key'
address:
type: string
description: Address
example: '0x1234567890abcdef1234567890abcdef12345678'
Key:
type: object
required:
- proxy
- expiry
properties:
proxy:
$ref: '#/components/schemas/proxy'
label:
$ref: '#/components/schemas/label'
expiry:
$ref: '#/components/schemas/expiry'
Error400:
title: Error400
type: object
required:
- status
- error
properties:
status:
type: string
enum:
- err
error:
$ref: '#/components/schemas/error'
Error401:
title: Error401
type: object
required:
- status
- error
properties:
status:
type: string
enum:
- err
error:
$ref: '#/components/schemas/error'
Error429:
title: Error429
type: object
required:
- status
- error
properties:
status:
type: string
enum:
- err
error:
$ref: '#/components/schemas/error'
Error500:
title: Error500
type: object
required:
- status
- error
properties:
status:
type: string
enum:
- err
error:
$ref: '#/components/schemas/error'
proxy:
type: string
description: Proxy address in hex format
example: '0x70997970C51812dc3A010C7d01b50e0d17dc79C8'
label:
type: string
description: Human-readable label for a proxy key or internal transfer
example: trading-bot
expiry:
type: integer
description: Expiry timestamp in milliseconds
example: 1767225600000
error:
type: string
description: >-
Error identifier. For domain rejections and transport errors
(`401`/`404`/`429`/`500`) this is a stable, machine-readable snake_case
identifier that is part of the API contract and safe to branch on, e.g.
`insufficient_margin`, `insufficient_balance`, `order_not_found`,
`reduce_only_invalid`, `unauthorized`, `not_found`. For `400` it is a
human-readable validation detail whose wording may change. See the Error
handling guide for the domain identifiers. (Post-only / Fill-or-Kill
outcomes are order statuses such as `post_only_rejected`, not
rejections.)
example: insufficient_margin
responses:
Error400Response:
description: |
Bad request — the request was malformed or failed validation (bad query
parameters, unparseable body, invalid signature, or a domain pre-check).
The `error` field is a human-readable validation detail.
content:
application/json:
schema:
$ref: '#/components/schemas/Error400'
Error401Response:
description: >
Unauthorized — missing or invalid `POLYMARKET-PROXY` /
`POLYMARKET-SECRET`
credentials. `error` is `unauthorized`.
content:
application/json:
schema:
$ref: '#/components/schemas/Error401'
Error429Response:
description: >
Too Many Requests. `error` distinguishes the limit that was hit:
`ip_rate_limited` (per-IP token bucket), `action_rate_limited`
(per-account
action rate), or `open_orders_limit` (resting open-order cap).
headers:
Retry-After:
description: >
Whole seconds to wait before retrying. Present only on token-bucket
rate-limit rejections (`ip_rate_limited` and `action_rate_limited`);
a
conservative estimate of when enough capacity will have refilled to
admit the request. Absent on `open_orders_limit`, which is a
capacity
limit, not a rate limit — waiting does not free order slots; cancel
resting orders or wait for fills instead.
schema:
type: integer
example: 2
content:
application/json:
schema:
$ref: '#/components/schemas/Error429'
Error500Response:
description: |
Internal server error. `error` is `internal_error`.
content:
application/json:
schema:
$ref: '#/components/schemas/Error500'
securitySchemes:
polymarket_proxy:
type: apiKey
name: POLYMARKET-PROXY
in: header
description: Proxy address
polymarket_secret:
type: apiKey
name: POLYMARKET-SECRET
in: header
description: Correponding proxy secret
````
@@ -0,0 +1,318 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
> Use this file to discover all available pages before exploring further.
# Get Deposits
> Get deposit history for the authenticated account.
If no end time is provided, the current time will be used.
Maximum of 100 entries returned per request.
<Badge color="gray" size="md">Request Weight: **10**</Badge>
## OpenAPI
````yaml /api-spec/perps-openapi.json get /v1/account/deposits
openapi: 3.0.3
info:
title: Polymarket Perps HTTP API
version: 1.0.0
description: HTTP API for Polymarket perpetual trading system.
license:
name: Apache 2.0
url: https://www.apache.org/licenses/LICENSE-2.0.html
servers:
- url: https://api.perpetuals.polymarket.com
description: Production Perps HTTP API
security: []
paths:
/v1/account/deposits:
get:
summary: Get Deposits
description: |
Get deposit history for the authenticated account.
If no end time is provided, the current time will be used.
Maximum of 100 entries returned per request.
operationId: getDeposits
parameters:
- name: deposit_status
in: query
required: false
schema:
$ref: '#/components/schemas/deposit_status'
- name: hash
in: query
required: false
schema:
$ref: '#/components/schemas/hash'
- name: start_timestamp
in: query
required: false
schema:
$ref: '#/components/schemas/start_timestamp'
- name: end_timestamp
in: query
required: false
schema:
$ref: '#/components/schemas/end_timestamp'
responses:
'200':
description: Deposit history response.
content:
application/json:
schema:
$ref: '#/components/schemas/Deposits'
'400':
$ref: '#/components/responses/Error400Response'
'401':
$ref: '#/components/responses/Error401Response'
'429':
$ref: '#/components/responses/Error429Response'
'500':
$ref: '#/components/responses/Error500Response'
security:
- polymarket_proxy: []
polymarket_secret: []
components:
schemas:
deposit_status:
type: string
description: Deposit status
enum:
- pending
- confirmed
- removed
hash:
type: string
description: On-chain transaction hash, "0x" if not yet mined
default: 0x
example: '0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef'
start_timestamp:
type: integer
description: Start timestamp in milliseconds
example: 1767225600000
end_timestamp:
type: integer
description: End timestamp in milliseconds
example: 1767229200000
Deposits:
type: object
required:
- data
- more
properties:
data:
type: array
items:
$ref: '#/components/schemas/Deposit'
more:
$ref: '#/components/schemas/more'
Deposit:
type: object
required:
- hash
- asset
- amount
- status
- from
- to
- confirmations
- required_confirmations
- created_timestamp
properties:
hash:
$ref: '#/components/schemas/hash'
asset:
$ref: '#/components/schemas/asset'
amount:
$ref: '#/components/schemas/amount'
from:
$ref: '#/components/schemas/from'
to:
$ref: '#/components/schemas/to'
status:
$ref: '#/components/schemas/deposit_status'
confirmations:
$ref: '#/components/schemas/confirmations'
required_confirmations:
$ref: '#/components/schemas/required_confirmations'
created_timestamp:
$ref: '#/components/schemas/created_timestamp'
confirmed_timestamp:
$ref: '#/components/schemas/confirmed_timestamp'
more:
type: boolean
description: More data available
Error400:
title: Error400
type: object
required:
- status
- error
properties:
status:
type: string
enum:
- err
error:
$ref: '#/components/schemas/error'
Error401:
title: Error401
type: object
required:
- status
- error
properties:
status:
type: string
enum:
- err
error:
$ref: '#/components/schemas/error'
Error429:
title: Error429
type: object
required:
- status
- error
properties:
status:
type: string
enum:
- err
error:
$ref: '#/components/schemas/error'
Error500:
title: Error500
type: object
required:
- status
- error
properties:
status:
type: string
enum:
- err
error:
$ref: '#/components/schemas/error'
asset:
type: string
description: Asset name
example: USDC
amount:
type: string
description: >-
Raw token amount including decimals. For withdrawals this matches the
uint256 amount in the EIP-712 signature (e.g. "100000000" for 100 USDC
with 6 decimals).
example: '100000000'
from:
type: string
description: Sender address in hex format
example: '0x1234567890abcdef1234567890abcdef12345678'
to:
type: string
description: Destination address in hex format
example: '0x1234567890abcdef1234567890abcdef12345678'
confirmations:
type: integer
description: Number of block confirmations
example: 12
required_confirmations:
type: integer
description: Required number of block confirmations
example: 12
created_timestamp:
type: integer
description: Creation timestamp in milliseconds
example: 1767225600000
confirmed_timestamp:
type: integer
description: Confirmation timestamp in milliseconds
example: 1767225600000
error:
type: string
description: >-
Error identifier. For domain rejections and transport errors
(`401`/`404`/`429`/`500`) this is a stable, machine-readable snake_case
identifier that is part of the API contract and safe to branch on, e.g.
`insufficient_margin`, `insufficient_balance`, `order_not_found`,
`reduce_only_invalid`, `unauthorized`, `not_found`. For `400` it is a
human-readable validation detail whose wording may change. See the Error
handling guide for the domain identifiers. (Post-only / Fill-or-Kill
outcomes are order statuses such as `post_only_rejected`, not
rejections.)
example: insufficient_margin
responses:
Error400Response:
description: |
Bad request — the request was malformed or failed validation (bad query
parameters, unparseable body, invalid signature, or a domain pre-check).
The `error` field is a human-readable validation detail.
content:
application/json:
schema:
$ref: '#/components/schemas/Error400'
Error401Response:
description: >
Unauthorized — missing or invalid `POLYMARKET-PROXY` /
`POLYMARKET-SECRET`
credentials. `error` is `unauthorized`.
content:
application/json:
schema:
$ref: '#/components/schemas/Error401'
Error429Response:
description: >
Too Many Requests. `error` distinguishes the limit that was hit:
`ip_rate_limited` (per-IP token bucket), `action_rate_limited`
(per-account
action rate), or `open_orders_limit` (resting open-order cap).
headers:
Retry-After:
description: >
Whole seconds to wait before retrying. Present only on token-bucket
rate-limit rejections (`ip_rate_limited` and `action_rate_limited`);
a
conservative estimate of when enough capacity will have refilled to
admit the request. Absent on `open_orders_limit`, which is a
capacity
limit, not a rate limit — waiting does not free order slots; cancel
resting orders or wait for fills instead.
schema:
type: integer
example: 2
content:
application/json:
schema:
$ref: '#/components/schemas/Error429'
Error500Response:
description: |
Internal server error. `error` is `internal_error`.
content:
application/json:
schema:
$ref: '#/components/schemas/Error500'
securitySchemes:
polymarket_proxy:
type: apiKey
name: POLYMARKET-PROXY
in: header
description: Proxy address
polymarket_secret:
type: apiKey
name: POLYMARKET-SECRET
in: header
description: Correponding proxy secret
````
@@ -0,0 +1,255 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
> Use this file to discover all available pages before exploring further.
# Get Equity
> Get equity history for the authenticated account.
If no end time is provided, the current time will be used.
Maximum of 1000 entries returned per request.
<Badge color="gray" size="md">Request Weight: **10**</Badge>
## OpenAPI
````yaml /api-spec/perps-openapi.json get /v1/account/equity
openapi: 3.0.3
info:
title: Polymarket Perps HTTP API
version: 1.0.0
description: HTTP API for Polymarket perpetual trading system.
license:
name: Apache 2.0
url: https://www.apache.org/licenses/LICENSE-2.0.html
servers:
- url: https://api.perpetuals.polymarket.com
description: Production Perps HTTP API
security: []
paths:
/v1/account/equity:
get:
summary: Get Equity
description: |
Get equity history for the authenticated account.
If no end time is provided, the current time will be used.
Maximum of 1000 entries returned per request.
operationId: getEquityHistory
parameters:
- name: interval
in: query
required: true
schema:
$ref: '#/components/schemas/interval'
- name: start_timestamp
in: query
required: true
schema:
$ref: '#/components/schemas/start_timestamp'
- name: end_timestamp
in: query
required: false
schema:
$ref: '#/components/schemas/end_timestamp'
responses:
'200':
description: Equity history response.
content:
application/json:
schema:
$ref: '#/components/schemas/EquityHistory'
'400':
$ref: '#/components/responses/Error400Response'
'401':
$ref: '#/components/responses/Error401Response'
'429':
$ref: '#/components/responses/Error429Response'
'500':
$ref: '#/components/responses/Error500Response'
security:
- polymarket_proxy: []
polymarket_secret: []
components:
schemas:
interval:
type: string
description: Kline interval
enum:
- 1s
- 1m
- 5m
- 15m
- 30m
- 1h
- 4h
- 6h
- 12h
- 1d
- 1w
start_timestamp:
type: integer
description: Start timestamp in milliseconds
example: 1767225600000
end_timestamp:
type: integer
description: End timestamp in milliseconds
example: 1767229200000
EquityHistory:
type: object
required:
- data
- more
properties:
data:
type: array
description: |
- `1767225600000` - Timestamp
- `"10000.00"` - Equity
items:
type: array
example:
- 1767225600000
- '10000.00'
maxItems: 1000
more:
$ref: '#/components/schemas/more'
more:
type: boolean
description: More data available
Error400:
title: Error400
type: object
required:
- status
- error
properties:
status:
type: string
enum:
- err
error:
$ref: '#/components/schemas/error'
Error401:
title: Error401
type: object
required:
- status
- error
properties:
status:
type: string
enum:
- err
error:
$ref: '#/components/schemas/error'
Error429:
title: Error429
type: object
required:
- status
- error
properties:
status:
type: string
enum:
- err
error:
$ref: '#/components/schemas/error'
Error500:
title: Error500
type: object
required:
- status
- error
properties:
status:
type: string
enum:
- err
error:
$ref: '#/components/schemas/error'
error:
type: string
description: >-
Error identifier. For domain rejections and transport errors
(`401`/`404`/`429`/`500`) this is a stable, machine-readable snake_case
identifier that is part of the API contract and safe to branch on, e.g.
`insufficient_margin`, `insufficient_balance`, `order_not_found`,
`reduce_only_invalid`, `unauthorized`, `not_found`. For `400` it is a
human-readable validation detail whose wording may change. See the Error
handling guide for the domain identifiers. (Post-only / Fill-or-Kill
outcomes are order statuses such as `post_only_rejected`, not
rejections.)
example: insufficient_margin
responses:
Error400Response:
description: |
Bad request — the request was malformed or failed validation (bad query
parameters, unparseable body, invalid signature, or a domain pre-check).
The `error` field is a human-readable validation detail.
content:
application/json:
schema:
$ref: '#/components/schemas/Error400'
Error401Response:
description: >
Unauthorized — missing or invalid `POLYMARKET-PROXY` /
`POLYMARKET-SECRET`
credentials. `error` is `unauthorized`.
content:
application/json:
schema:
$ref: '#/components/schemas/Error401'
Error429Response:
description: >
Too Many Requests. `error` distinguishes the limit that was hit:
`ip_rate_limited` (per-IP token bucket), `action_rate_limited`
(per-account
action rate), or `open_orders_limit` (resting open-order cap).
headers:
Retry-After:
description: >
Whole seconds to wait before retrying. Present only on token-bucket
rate-limit rejections (`ip_rate_limited` and `action_rate_limited`);
a
conservative estimate of when enough capacity will have refilled to
admit the request. Absent on `open_orders_limit`, which is a
capacity
limit, not a rate limit — waiting does not free order slots; cancel
resting orders or wait for fills instead.
schema:
type: integer
example: 2
content:
application/json:
schema:
$ref: '#/components/schemas/Error429'
Error500Response:
description: |
Internal server error. `error` is `internal_error`.
content:
application/json:
schema:
$ref: '#/components/schemas/Error500'
securitySchemes:
polymarket_proxy:
type: apiKey
name: POLYMARKET-PROXY
in: header
description: Proxy address
polymarket_secret:
type: apiKey
name: POLYMARKET-SECRET
in: header
description: Correponding proxy secret
````
@@ -0,0 +1,161 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
> Use this file to discover all available pages before exploring further.
# Get Exchange Info
> Get exchange information.
<Badge color="gray" size="md">Request Weight: **2**</Badge>
## OpenAPI
````yaml /api-spec/perps-openapi.json get /v1/info/exchange
openapi: 3.0.3
info:
title: Polymarket Perps HTTP API
version: 1.0.0
description: HTTP API for Polymarket perpetual trading system.
license:
name: Apache 2.0
url: https://www.apache.org/licenses/LICENSE-2.0.html
servers:
- url: https://api.perpetuals.polymarket.com
description: Production Perps HTTP API
security: []
paths:
/v1/info/exchange:
get:
summary: Get Exchange Info
description: |
Get exchange information.
operationId: getExchange
responses:
'200':
description: Successful exchange information response.
content:
application/json:
schema:
$ref: '#/components/schemas/Exchange'
'429':
$ref: '#/components/responses/Error429Response'
'500':
$ref: '#/components/responses/Error500Response'
security: []
components:
schemas:
Exchange:
type: object
required:
- name
- version
- chain_id
- contract
properties:
name:
$ref: '#/components/schemas/name'
version:
$ref: '#/components/schemas/version'
chain_id:
$ref: '#/components/schemas/chain_id'
contract:
$ref: '#/components/schemas/contract'
name:
type: string
description: Exchange name used in the EIP-712 domain.
example: Polymarket
version:
type: string
description: Exchange version used in the EIP-712 domain.
example: '1'
chain_id:
type: integer
format: uint32
description: Chain ID of the network the exchange is deployed on.
example: 137
contract:
type: string
description: Verifying contract address or the EIP-712 domain.
example: '0x1234567890abcdef1234567890abcdef12345678'
Error429:
title: Error429
type: object
required:
- status
- error
properties:
status:
type: string
enum:
- err
error:
$ref: '#/components/schemas/error'
Error500:
title: Error500
type: object
required:
- status
- error
properties:
status:
type: string
enum:
- err
error:
$ref: '#/components/schemas/error'
error:
type: string
description: >-
Error identifier. For domain rejections and transport errors
(`401`/`404`/`429`/`500`) this is a stable, machine-readable snake_case
identifier that is part of the API contract and safe to branch on, e.g.
`insufficient_margin`, `insufficient_balance`, `order_not_found`,
`reduce_only_invalid`, `unauthorized`, `not_found`. For `400` it is a
human-readable validation detail whose wording may change. See the Error
handling guide for the domain identifiers. (Post-only / Fill-or-Kill
outcomes are order statuses such as `post_only_rejected`, not
rejections.)
example: insufficient_margin
responses:
Error429Response:
description: >
Too Many Requests. `error` distinguishes the limit that was hit:
`ip_rate_limited` (per-IP token bucket), `action_rate_limited`
(per-account
action rate), or `open_orders_limit` (resting open-order cap).
headers:
Retry-After:
description: >
Whole seconds to wait before retrying. Present only on token-bucket
rate-limit rejections (`ip_rate_limited` and `action_rate_limited`);
a
conservative estimate of when enough capacity will have refilled to
admit the request. Absent on `open_orders_limit`, which is a
capacity
limit, not a rate limit — waiting does not free order slots; cancel
resting orders or wait for fills instead.
schema:
type: integer
example: 2
content:
application/json:
schema:
$ref: '#/components/schemas/Error429'
Error500Response:
description: |
Internal server error. `error` is `internal_error`.
content:
application/json:
schema:
$ref: '#/components/schemas/Error500'
````
@@ -0,0 +1,179 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
> Use this file to discover all available pages before exploring further.
# Get Fees
> Get the default fee schedule for each instrument type and category. Rates returned are the $0-tier defaults; the account's actual rate on each fill depends on its trailing 30-day volume tier.
<Badge color="gray" size="md">Request Weight: **2**</Badge>
## OpenAPI
````yaml /api-spec/perps-openapi.json get /v1/info/fees
openapi: 3.0.3
info:
title: Polymarket Perps HTTP API
version: 1.0.0
description: HTTP API for Polymarket perpetual trading system.
license:
name: Apache 2.0
url: https://www.apache.org/licenses/LICENSE-2.0.html
servers:
- url: https://api.perpetuals.polymarket.com
description: Production Perps HTTP API
security: []
paths:
/v1/info/fees:
get:
summary: Get Fees
description: >-
Get the default fee schedule for each instrument type and category.
Rates returned are the $0-tier defaults; the account's actual rate on
each fill depends on its trailing 30-day volume tier.
operationId: getInfoFees
responses:
'200':
description: Fee schedule response.
content:
application/json:
schema:
$ref: '#/components/schemas/FeesInfo'
'429':
$ref: '#/components/responses/Error429Response'
'500':
$ref: '#/components/responses/Error500Response'
security: []
components:
schemas:
FeesInfo:
type: object
required:
- fee_schedule
properties:
fee_schedule:
type: array
items:
$ref: '#/components/schemas/FeeScheduleEntry'
FeeScheduleEntry:
type: object
required:
- instrument_type
- category
- taker_fee_rate
- maker_fee_rate
properties:
instrument_type:
$ref: '#/components/schemas/instrument_type'
category:
$ref: '#/components/schemas/category'
taker_fee_rate:
$ref: '#/components/schemas/taker_fee_rate'
maker_fee_rate:
$ref: '#/components/schemas/maker_fee_rate'
Error429:
title: Error429
type: object
required:
- status
- error
properties:
status:
type: string
enum:
- err
error:
$ref: '#/components/schemas/error'
Error500:
title: Error500
type: object
required:
- status
- error
properties:
status:
type: string
enum:
- err
error:
$ref: '#/components/schemas/error'
instrument_type:
type: string
description: Instrument type
enum:
- perpetual
category:
type: string
description: Instrument category
enum:
- equity
- commodity
- index
- crypto
taker_fee_rate:
type: string
description: >-
Default taker fee rate for the $0 volume tier. Actual rate scales down
with the account's trailing 30-day volume tier.
example: '0.0004'
maker_fee_rate:
type: string
description: >-
Default maker fee rate for the $0 volume tier. Positive at lower tiers,
zero at the $500M tier, and a rebate (negative) at the top tier.
example: '0.000125'
error:
type: string
description: >-
Error identifier. For domain rejections and transport errors
(`401`/`404`/`429`/`500`) this is a stable, machine-readable snake_case
identifier that is part of the API contract and safe to branch on, e.g.
`insufficient_margin`, `insufficient_balance`, `order_not_found`,
`reduce_only_invalid`, `unauthorized`, `not_found`. For `400` it is a
human-readable validation detail whose wording may change. See the Error
handling guide for the domain identifiers. (Post-only / Fill-or-Kill
outcomes are order statuses such as `post_only_rejected`, not
rejections.)
example: insufficient_margin
responses:
Error429Response:
description: >
Too Many Requests. `error` distinguishes the limit that was hit:
`ip_rate_limited` (per-IP token bucket), `action_rate_limited`
(per-account
action rate), or `open_orders_limit` (resting open-order cap).
headers:
Retry-After:
description: >
Whole seconds to wait before retrying. Present only on token-bucket
rate-limit rejections (`ip_rate_limited` and `action_rate_limited`);
a
conservative estimate of when enough capacity will have refilled to
admit the request. Absent on `open_orders_limit`, which is a
capacity
limit, not a rate limit — waiting does not free order slots; cancel
resting orders or wait for fills instead.
schema:
type: integer
example: 2
content:
application/json:
schema:
$ref: '#/components/schemas/Error429'
Error500Response:
description: |
Internal server error. `error` is `internal_error`.
content:
application/json:
schema:
$ref: '#/components/schemas/Error500'
````
@@ -0,0 +1,342 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
> Use this file to discover all available pages before exploring further.
# Get Fills
> Get fill history for the authenticated account.
If no end time is provided, the current time will be used.
Maximum of 100 entries returned per request.
<Badge color="gray" size="md">Request Weight: **10**</Badge>
## OpenAPI
````yaml /api-spec/perps-openapi.json get /v1/account/fills
openapi: 3.0.3
info:
title: Polymarket Perps HTTP API
version: 1.0.0
description: HTTP API for Polymarket perpetual trading system.
license:
name: Apache 2.0
url: https://www.apache.org/licenses/LICENSE-2.0.html
servers:
- url: https://api.perpetuals.polymarket.com
description: Production Perps HTTP API
security: []
paths:
/v1/account/fills:
get:
summary: Get Fills
description: |
Get fill history for the authenticated account.
If no end time is provided, the current time will be used.
Maximum of 100 entries returned per request.
operationId: getFills
parameters:
- name: start_timestamp
in: query
required: false
schema:
$ref: '#/components/schemas/start_timestamp'
- name: end_timestamp
in: query
required: false
schema:
$ref: '#/components/schemas/end_timestamp'
responses:
'200':
description: Fills response.
content:
application/json:
schema:
$ref: '#/components/schemas/AccountTrades'
'400':
$ref: '#/components/responses/Error400Response'
'401':
$ref: '#/components/responses/Error401Response'
'429':
$ref: '#/components/responses/Error429Response'
'500':
$ref: '#/components/responses/Error500Response'
security:
- polymarket_proxy: []
polymarket_secret: []
components:
schemas:
start_timestamp:
type: integer
description: Start timestamp in milliseconds
example: 1767225600000
end_timestamp:
type: integer
description: End timestamp in milliseconds
example: 1767229200000
AccountTrades:
type: object
required:
- data
- more
properties:
data:
type: array
items:
$ref: '#/components/schemas/AccountTradeData'
description: Account's trade history
more:
$ref: '#/components/schemas/more'
AccountTradeData:
type: object
required:
- trade_id
- order_id
- instrument_id
- side
- price
- quantity
- taker
- fee
- fee_asset
- previous_size
- previous_entry_price
- pnl
- timestamp
- liquidation
- hash
properties:
trade_id:
$ref: '#/components/schemas/tid'
order_id:
$ref: '#/components/schemas/oid'
instrument_id:
$ref: '#/components/schemas/iid'
side:
$ref: '#/components/schemas/side'
price:
$ref: '#/components/schemas/p'
quantity:
$ref: '#/components/schemas/qty'
taker:
$ref: '#/components/schemas/taker'
fee:
$ref: '#/components/schemas/fee'
fee_asset:
$ref: '#/components/schemas/fea'
previous_size:
$ref: '#/components/schemas/psz'
previous_entry_price:
$ref: '#/components/schemas/pep'
pnl:
$ref: '#/components/schemas/pnl'
liquidation:
$ref: '#/components/schemas/liq'
timestamp:
$ref: '#/components/schemas/ts'
hash:
$ref: '#/components/schemas/hash'
more:
type: boolean
description: More data available
Error400:
title: Error400
type: object
required:
- status
- error
properties:
status:
type: string
enum:
- err
error:
$ref: '#/components/schemas/error'
Error401:
title: Error401
type: object
required:
- status
- error
properties:
status:
type: string
enum:
- err
error:
$ref: '#/components/schemas/error'
Error429:
title: Error429
type: object
required:
- status
- error
properties:
status:
type: string
enum:
- err
error:
$ref: '#/components/schemas/error'
Error500:
title: Error500
type: object
required:
- status
- error
properties:
status:
type: string
enum:
- err
error:
$ref: '#/components/schemas/error'
tid:
type: integer
description: Trade ID
example: 1
oid:
type: integer
description: Order ID
example: 1234567890
iid:
type: integer
description: Instrument ID
example: 1
side:
type: string
description: Side
enum:
- long
- short
p:
type: string
description: Price
example: '100.00'
qty:
type: string
description: Quantity in no. of contracts
example: '10.00'
taker:
type: boolean
description: Whether this side was the taker
fee:
type: string
description: Fee amount for this trade side
example: '1.25'
fea:
type: string
description: Fee asset name
example: USDC
psz:
type: string
description: Position size before the fill
example: '26.86'
pep:
type: string
description: Position entry price before the fill
example: '100.00'
pnl:
type: string
description: PnL in USD
example: '100.00'
liq:
type: boolean
description: Whether the fill was a liquidation
ts:
type: integer
description: >-
Request timestamp. Unix milliseconds for most operations; Unix seconds
for withdrawals (must match the on-chain EIP-712 struct verified against
block.timestamp).
example: 1767225600000
hash:
type: string
description: On-chain transaction hash, "0x" if not yet mined
default: 0x
example: '0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef'
error:
type: string
description: >-
Error identifier. For domain rejections and transport errors
(`401`/`404`/`429`/`500`) this is a stable, machine-readable snake_case
identifier that is part of the API contract and safe to branch on, e.g.
`insufficient_margin`, `insufficient_balance`, `order_not_found`,
`reduce_only_invalid`, `unauthorized`, `not_found`. For `400` it is a
human-readable validation detail whose wording may change. See the Error
handling guide for the domain identifiers. (Post-only / Fill-or-Kill
outcomes are order statuses such as `post_only_rejected`, not
rejections.)
example: insufficient_margin
responses:
Error400Response:
description: |
Bad request — the request was malformed or failed validation (bad query
parameters, unparseable body, invalid signature, or a domain pre-check).
The `error` field is a human-readable validation detail.
content:
application/json:
schema:
$ref: '#/components/schemas/Error400'
Error401Response:
description: >
Unauthorized — missing or invalid `POLYMARKET-PROXY` /
`POLYMARKET-SECRET`
credentials. `error` is `unauthorized`.
content:
application/json:
schema:
$ref: '#/components/schemas/Error401'
Error429Response:
description: >
Too Many Requests. `error` distinguishes the limit that was hit:
`ip_rate_limited` (per-IP token bucket), `action_rate_limited`
(per-account
action rate), or `open_orders_limit` (resting open-order cap).
headers:
Retry-After:
description: >
Whole seconds to wait before retrying. Present only on token-bucket
rate-limit rejections (`ip_rate_limited` and `action_rate_limited`);
a
conservative estimate of when enough capacity will have refilled to
admit the request. Absent on `open_orders_limit`, which is a
capacity
limit, not a rate limit — waiting does not free order slots; cancel
resting orders or wait for fills instead.
schema:
type: integer
example: 2
content:
application/json:
schema:
$ref: '#/components/schemas/Error429'
Error500Response:
description: |
Internal server error. `error` is `internal_error`.
content:
application/json:
schema:
$ref: '#/components/schemas/Error500'
securitySchemes:
polymarket_proxy:
type: apiKey
name: POLYMARKET-PROXY
in: header
description: Proxy address
polymarket_secret:
type: apiKey
name: POLYMARKET-SECRET
in: header
description: Correponding proxy secret
````
@@ -0,0 +1,287 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
> Use this file to discover all available pages before exploring further.
# Get Funding Charges
> Get funding payment history for the authenticated account.
If no end time is provided, the current time will be used.
Maximum of 100 entries returned per request.
<Badge color="gray" size="md">Request Weight: **10**</Badge>
## OpenAPI
````yaml /api-spec/perps-openapi.json get /v1/account/funding
openapi: 3.0.3
info:
title: Polymarket Perps HTTP API
version: 1.0.0
description: HTTP API for Polymarket perpetual trading system.
license:
name: Apache 2.0
url: https://www.apache.org/licenses/LICENSE-2.0.html
servers:
- url: https://api.perpetuals.polymarket.com
description: Production Perps HTTP API
security: []
paths:
/v1/account/funding:
get:
summary: Get Funding Charges
description: |
Get funding payment history for the authenticated account.
If no end time is provided, the current time will be used.
Maximum of 100 entries returned per request.
operationId: getAccountFunding
parameters:
- name: instrument_id
in: query
required: false
schema:
$ref: '#/components/schemas/instrument_id'
- name: start_timestamp
in: query
required: false
schema:
$ref: '#/components/schemas/start_timestamp'
- name: end_timestamp
in: query
required: false
schema:
$ref: '#/components/schemas/end_timestamp'
responses:
'200':
description: Account funding history response.
content:
application/json:
schema:
$ref: '#/components/schemas/AccountFundingHistory'
'400':
$ref: '#/components/responses/Error400Response'
'401':
$ref: '#/components/responses/Error401Response'
'429':
$ref: '#/components/responses/Error429Response'
'500':
$ref: '#/components/responses/Error500Response'
security:
- polymarket_proxy: []
polymarket_secret: []
components:
schemas:
instrument_id:
type: integer
description: Instrument ID
start_timestamp:
type: integer
description: Start timestamp in milliseconds
example: 1767225600000
end_timestamp:
type: integer
description: End timestamp in milliseconds
example: 1767229200000
AccountFundingHistory:
type: object
required:
- data
- more
properties:
data:
type: array
items:
$ref: '#/components/schemas/AccountFundingData'
more:
$ref: '#/components/schemas/more'
AccountFundingData:
type: object
required:
- instrument_id
- size
- funding_rate
- funding_asset
- funding
- timestamp
properties:
instrument_id:
$ref: '#/components/schemas/iid'
size:
$ref: '#/components/schemas/sz'
funding_rate:
$ref: '#/components/schemas/fr'
funding_asset:
$ref: '#/components/schemas/fua'
funding:
$ref: '#/components/schemas/fund'
timestamp:
$ref: '#/components/schemas/ts'
more:
type: boolean
description: More data available
Error400:
title: Error400
type: object
required:
- status
- error
properties:
status:
type: string
enum:
- err
error:
$ref: '#/components/schemas/error'
Error401:
title: Error401
type: object
required:
- status
- error
properties:
status:
type: string
enum:
- err
error:
$ref: '#/components/schemas/error'
Error429:
title: Error429
type: object
required:
- status
- error
properties:
status:
type: string
enum:
- err
error:
$ref: '#/components/schemas/error'
Error500:
title: Error500
type: object
required:
- status
- error
properties:
status:
type: string
enum:
- err
error:
$ref: '#/components/schemas/error'
iid:
type: integer
description: Instrument ID
example: 1
sz:
type: string
description: >-
Signed position size in no. of contracts (positive = long, negative =
short)
example: '10.00'
fr:
type: string
description: Funding rate
example: '0.0001'
fua:
type: string
description: Funding asset name
example: USDC
fund:
type: string
description: Funding paid in USD
example: '1.00'
ts:
type: integer
description: >-
Request timestamp. Unix milliseconds for most operations; Unix seconds
for withdrawals (must match the on-chain EIP-712 struct verified against
block.timestamp).
example: 1767225600000
error:
type: string
description: >-
Error identifier. For domain rejections and transport errors
(`401`/`404`/`429`/`500`) this is a stable, machine-readable snake_case
identifier that is part of the API contract and safe to branch on, e.g.
`insufficient_margin`, `insufficient_balance`, `order_not_found`,
`reduce_only_invalid`, `unauthorized`, `not_found`. For `400` it is a
human-readable validation detail whose wording may change. See the Error
handling guide for the domain identifiers. (Post-only / Fill-or-Kill
outcomes are order statuses such as `post_only_rejected`, not
rejections.)
example: insufficient_margin
responses:
Error400Response:
description: |
Bad request — the request was malformed or failed validation (bad query
parameters, unparseable body, invalid signature, or a domain pre-check).
The `error` field is a human-readable validation detail.
content:
application/json:
schema:
$ref: '#/components/schemas/Error400'
Error401Response:
description: >
Unauthorized — missing or invalid `POLYMARKET-PROXY` /
`POLYMARKET-SECRET`
credentials. `error` is `unauthorized`.
content:
application/json:
schema:
$ref: '#/components/schemas/Error401'
Error429Response:
description: >
Too Many Requests. `error` distinguishes the limit that was hit:
`ip_rate_limited` (per-IP token bucket), `action_rate_limited`
(per-account
action rate), or `open_orders_limit` (resting open-order cap).
headers:
Retry-After:
description: >
Whole seconds to wait before retrying. Present only on token-bucket
rate-limit rejections (`ip_rate_limited` and `action_rate_limited`);
a
conservative estimate of when enough capacity will have refilled to
admit the request. Absent on `open_orders_limit`, which is a
capacity
limit, not a rate limit — waiting does not free order slots; cancel
resting orders or wait for fills instead.
schema:
type: integer
example: 2
content:
application/json:
schema:
$ref: '#/components/schemas/Error429'
Error500Response:
description: |
Internal server error. `error` is `internal_error`.
content:
application/json:
schema:
$ref: '#/components/schemas/Error500'
securitySchemes:
polymarket_proxy:
type: apiKey
name: POLYMARKET-PROXY
in: header
description: Proxy address
polymarket_secret:
type: apiKey
name: POLYMARKET-SECRET
in: header
description: Correponding proxy secret
````
@@ -0,0 +1,217 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
> Use this file to discover all available pages before exploring further.
# Get Historical Funding
> Get public funding rate history for an instrument.
Maximum of 100 entries returned per request.
<Badge color="gray" size="md">Request Weight: **10**</Badge>
## OpenAPI
````yaml /api-spec/perps-openapi.json get /v1/info/funding
openapi: 3.0.3
info:
title: Polymarket Perps HTTP API
version: 1.0.0
description: HTTP API for Polymarket perpetual trading system.
license:
name: Apache 2.0
url: https://www.apache.org/licenses/LICENSE-2.0.html
servers:
- url: https://api.perpetuals.polymarket.com
description: Production Perps HTTP API
security: []
paths:
/v1/info/funding:
get:
summary: Get Historical Funding
description: |
Get public funding rate history for an instrument.
Maximum of 100 entries returned per request.
operationId: getFundingHistory
parameters:
- name: instrument_id
in: query
required: true
schema:
$ref: '#/components/schemas/instrument_id'
- name: start_timestamp
in: query
required: false
schema:
$ref: '#/components/schemas/start_timestamp'
- name: end_timestamp
in: query
required: false
schema:
$ref: '#/components/schemas/end_timestamp'
responses:
'200':
description: Funding rate history response.
content:
application/json:
schema:
$ref: '#/components/schemas/FundingHistory'
'400':
$ref: '#/components/responses/Error400Response'
'429':
$ref: '#/components/responses/Error429Response'
'500':
$ref: '#/components/responses/Error500Response'
security: []
components:
schemas:
instrument_id:
type: integer
description: Instrument ID
start_timestamp:
type: integer
description: Start timestamp in milliseconds
example: 1767225600000
end_timestamp:
type: integer
description: End timestamp in milliseconds
example: 1767229200000
FundingHistory:
type: object
required:
- data
- more
properties:
data:
type: array
items:
$ref: '#/components/schemas/FundingRate'
more:
$ref: '#/components/schemas/more'
FundingRate:
type: object
required:
- funding_rate
- timestamp
properties:
funding_rate:
$ref: '#/components/schemas/fr'
timestamp:
$ref: '#/components/schemas/ts'
more:
type: boolean
description: More data available
Error400:
title: Error400
type: object
required:
- status
- error
properties:
status:
type: string
enum:
- err
error:
$ref: '#/components/schemas/error'
Error429:
title: Error429
type: object
required:
- status
- error
properties:
status:
type: string
enum:
- err
error:
$ref: '#/components/schemas/error'
Error500:
title: Error500
type: object
required:
- status
- error
properties:
status:
type: string
enum:
- err
error:
$ref: '#/components/schemas/error'
fr:
type: string
description: Funding rate
example: '0.0001'
ts:
type: integer
description: >-
Request timestamp. Unix milliseconds for most operations; Unix seconds
for withdrawals (must match the on-chain EIP-712 struct verified against
block.timestamp).
example: 1767225600000
error:
type: string
description: >-
Error identifier. For domain rejections and transport errors
(`401`/`404`/`429`/`500`) this is a stable, machine-readable snake_case
identifier that is part of the API contract and safe to branch on, e.g.
`insufficient_margin`, `insufficient_balance`, `order_not_found`,
`reduce_only_invalid`, `unauthorized`, `not_found`. For `400` it is a
human-readable validation detail whose wording may change. See the Error
handling guide for the domain identifiers. (Post-only / Fill-or-Kill
outcomes are order statuses such as `post_only_rejected`, not
rejections.)
example: insufficient_margin
responses:
Error400Response:
description: |
Bad request — the request was malformed or failed validation (bad query
parameters, unparseable body, invalid signature, or a domain pre-check).
The `error` field is a human-readable validation detail.
content:
application/json:
schema:
$ref: '#/components/schemas/Error400'
Error429Response:
description: >
Too Many Requests. `error` distinguishes the limit that was hit:
`ip_rate_limited` (per-IP token bucket), `action_rate_limited`
(per-account
action rate), or `open_orders_limit` (resting open-order cap).
headers:
Retry-After:
description: >
Whole seconds to wait before retrying. Present only on token-bucket
rate-limit rejections (`ip_rate_limited` and `action_rate_limited`);
a
conservative estimate of when enough capacity will have refilled to
admit the request. Absent on `open_orders_limit`, which is a
capacity
limit, not a rate limit — waiting does not free order slots; cancel
resting orders or wait for fills instead.
schema:
type: integer
example: 2
content:
application/json:
schema:
$ref: '#/components/schemas/Error429'
Error500Response:
description: |
Internal server error. `error` is `internal_error`.
content:
application/json:
schema:
$ref: '#/components/schemas/Error500'
````
@@ -0,0 +1,233 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
> Use this file to discover all available pages before exploring further.
# Get Index
> Get index price and the list of constituents for an asset.
<Badge color="gray" size="md">Request Weight: **2**</Badge>
## OpenAPI
````yaml /api-spec/perps-openapi.json get /v1/info/index
openapi: 3.0.3
info:
title: Polymarket Perps HTTP API
version: 1.0.0
description: HTTP API for Polymarket perpetual trading system.
license:
name: Apache 2.0
url: https://www.apache.org/licenses/LICENSE-2.0.html
servers:
- url: https://api.perpetuals.polymarket.com
description: Production Perps HTTP API
security: []
paths:
/v1/info/index:
get:
summary: Get Index
description: Get index price and the list of constituents for an asset.
operationId: getIndex
parameters:
- name: asset
in: query
required: true
schema:
$ref: '#/components/schemas/asset'
responses:
'200':
description: Index constituents response.
content:
application/json:
schema:
$ref: '#/components/schemas/Index'
examples:
index:
summary: Index constituents
value:
asset: NVDA
index_price: '160.00'
constituents:
- source: chainlink
symbol: NVDA/USD
weight: '1.0'
price: '160.00'
ts: 1767225600000
'400':
$ref: '#/components/responses/Error400Response'
'429':
$ref: '#/components/responses/Error429Response'
'500':
$ref: '#/components/responses/Error500Response'
security: []
components:
schemas:
asset:
type: string
description: Asset name
example: USDC
Index:
type: object
required:
- asset
- index_price
- constituents
- ts
properties:
asset:
$ref: '#/components/schemas/asset'
index_price:
$ref: '#/components/schemas/index_price'
constituents:
type: array
items:
$ref: '#/components/schemas/IndexConstituent'
ts:
$ref: '#/components/schemas/ts'
index_price:
type: string
description: Index price
example: '100.00'
IndexConstituent:
type: object
required:
- source
- symbol
- weight
- price
properties:
source:
$ref: '#/components/schemas/source'
symbol:
$ref: '#/components/schemas/symbol'
weight:
$ref: '#/components/schemas/weight'
price:
$ref: '#/components/schemas/price'
ts:
type: integer
description: >-
Request timestamp. Unix milliseconds for most operations; Unix seconds
for withdrawals (must match the on-chain EIP-712 struct verified against
block.timestamp).
example: 1767225600000
Error400:
title: Error400
type: object
required:
- status
- error
properties:
status:
type: string
enum:
- err
error:
$ref: '#/components/schemas/error'
Error429:
title: Error429
type: object
required:
- status
- error
properties:
status:
type: string
enum:
- err
error:
$ref: '#/components/schemas/error'
Error500:
title: Error500
type: object
required:
- status
- error
properties:
status:
type: string
enum:
- err
error:
$ref: '#/components/schemas/error'
source:
type: string
description: Source name
example: chainlink
symbol:
type: string
description: Instrument symbol
example: NVDA-USDC
weight:
type: string
description: Index constituent weight
example: '0.25'
price:
type: string
description: Price
example: '100.00'
error:
type: string
description: >-
Error identifier. For domain rejections and transport errors
(`401`/`404`/`429`/`500`) this is a stable, machine-readable snake_case
identifier that is part of the API contract and safe to branch on, e.g.
`insufficient_margin`, `insufficient_balance`, `order_not_found`,
`reduce_only_invalid`, `unauthorized`, `not_found`. For `400` it is a
human-readable validation detail whose wording may change. See the Error
handling guide for the domain identifiers. (Post-only / Fill-or-Kill
outcomes are order statuses such as `post_only_rejected`, not
rejections.)
example: insufficient_margin
responses:
Error400Response:
description: |
Bad request — the request was malformed or failed validation (bad query
parameters, unparseable body, invalid signature, or a domain pre-check).
The `error` field is a human-readable validation detail.
content:
application/json:
schema:
$ref: '#/components/schemas/Error400'
Error429Response:
description: >
Too Many Requests. `error` distinguishes the limit that was hit:
`ip_rate_limited` (per-IP token bucket), `action_rate_limited`
(per-account
action rate), or `open_orders_limit` (resting open-order cap).
headers:
Retry-After:
description: >
Whole seconds to wait before retrying. Present only on token-bucket
rate-limit rejections (`ip_rate_limited` and `action_rate_limited`);
a
conservative estimate of when enough capacity will have refilled to
admit the request. Absent on `open_orders_limit`, which is a
capacity
limit, not a rate limit — waiting does not free order slots; cancel
resting orders or wait for fills instead.
schema:
type: integer
example: 2
content:
application/json:
schema:
$ref: '#/components/schemas/Error429'
Error500Response:
description: |
Internal server error. `error` is `internal_error`.
content:
application/json:
schema:
$ref: '#/components/schemas/Error500'
````
@@ -0,0 +1,226 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
> Use this file to discover all available pages before exploring further.
# Get Instrument Config
> Get per-instrument configuration (leverage and margin mode) for the authenticated account.
<Badge color="gray" size="md">Request Weight: **2**</Badge>
## OpenAPI
````yaml /api-spec/perps-openapi.json get /v1/account/config
openapi: 3.0.3
info:
title: Polymarket Perps HTTP API
version: 1.0.0
description: HTTP API for Polymarket perpetual trading system.
license:
name: Apache 2.0
url: https://www.apache.org/licenses/LICENSE-2.0.html
servers:
- url: https://api.perpetuals.polymarket.com
description: Production Perps HTTP API
security: []
paths:
/v1/account/config:
get:
summary: Get Instrument Config
description: >-
Get per-instrument configuration (leverage and margin mode) for the
authenticated account.
operationId: getConfig
parameters:
- name: instrument_id
in: query
required: false
schema:
$ref: '#/components/schemas/instrument_id'
responses:
'200':
description: Instrument config response.
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/AccountConfig'
'400':
$ref: '#/components/responses/Error400Response'
'401':
$ref: '#/components/responses/Error401Response'
'429':
$ref: '#/components/responses/Error429Response'
'500':
$ref: '#/components/responses/Error500Response'
security:
- polymarket_proxy: []
polymarket_secret: []
components:
schemas:
instrument_id:
type: integer
description: Instrument ID
AccountConfig:
description: Account configuration.
type: object
required:
- instrument_id
- leverage
- cross
properties:
instrument_id:
$ref: '#/components/schemas/iid'
leverage:
$ref: '#/components/schemas/lev'
cross:
$ref: '#/components/schemas/cross'
iid:
type: integer
description: Instrument ID
example: 1
lev:
type: integer
description: Leverage
example: 10
cross:
type: boolean
description: Whether to use cross margin mode
Error400:
title: Error400
type: object
required:
- status
- error
properties:
status:
type: string
enum:
- err
error:
$ref: '#/components/schemas/error'
Error401:
title: Error401
type: object
required:
- status
- error
properties:
status:
type: string
enum:
- err
error:
$ref: '#/components/schemas/error'
Error429:
title: Error429
type: object
required:
- status
- error
properties:
status:
type: string
enum:
- err
error:
$ref: '#/components/schemas/error'
Error500:
title: Error500
type: object
required:
- status
- error
properties:
status:
type: string
enum:
- err
error:
$ref: '#/components/schemas/error'
error:
type: string
description: >-
Error identifier. For domain rejections and transport errors
(`401`/`404`/`429`/`500`) this is a stable, machine-readable snake_case
identifier that is part of the API contract and safe to branch on, e.g.
`insufficient_margin`, `insufficient_balance`, `order_not_found`,
`reduce_only_invalid`, `unauthorized`, `not_found`. For `400` it is a
human-readable validation detail whose wording may change. See the Error
handling guide for the domain identifiers. (Post-only / Fill-or-Kill
outcomes are order statuses such as `post_only_rejected`, not
rejections.)
example: insufficient_margin
responses:
Error400Response:
description: |
Bad request — the request was malformed or failed validation (bad query
parameters, unparseable body, invalid signature, or a domain pre-check).
The `error` field is a human-readable validation detail.
content:
application/json:
schema:
$ref: '#/components/schemas/Error400'
Error401Response:
description: >
Unauthorized — missing or invalid `POLYMARKET-PROXY` /
`POLYMARKET-SECRET`
credentials. `error` is `unauthorized`.
content:
application/json:
schema:
$ref: '#/components/schemas/Error401'
Error429Response:
description: >
Too Many Requests. `error` distinguishes the limit that was hit:
`ip_rate_limited` (per-IP token bucket), `action_rate_limited`
(per-account
action rate), or `open_orders_limit` (resting open-order cap).
headers:
Retry-After:
description: >
Whole seconds to wait before retrying. Present only on token-bucket
rate-limit rejections (`ip_rate_limited` and `action_rate_limited`);
a
conservative estimate of when enough capacity will have refilled to
admit the request. Absent on `open_orders_limit`, which is a
capacity
limit, not a rate limit — waiting does not free order slots; cancel
resting orders or wait for fills instead.
schema:
type: integer
example: 2
content:
application/json:
schema:
$ref: '#/components/schemas/Error429'
Error500Response:
description: |
Internal server error. `error` is `internal_error`.
content:
application/json:
schema:
$ref: '#/components/schemas/Error500'
securitySchemes:
polymarket_proxy:
type: apiKey
name: POLYMARKET-PROXY
in: header
description: Proxy address
polymarket_secret:
type: apiKey
name: POLYMARKET-SECRET
in: header
description: Correponding proxy secret
````
@@ -0,0 +1,310 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
> Use this file to discover all available pages before exploring further.
# Get Instruments
> Get all instruments.
<Badge color="gray" size="md">Request Weight: **2**</Badge>
## OpenAPI
````yaml /api-spec/perps-openapi.json get /v1/info/instruments
openapi: 3.0.3
info:
title: Polymarket Perps HTTP API
version: 1.0.0
description: HTTP API for Polymarket perpetual trading system.
license:
name: Apache 2.0
url: https://www.apache.org/licenses/LICENSE-2.0.html
servers:
- url: https://api.perpetuals.polymarket.com
description: Production Perps HTTP API
security: []
paths:
/v1/info/instruments:
get:
summary: Get Instruments
description: Get all instruments.
operationId: getInstruments
parameters:
- name: instrument_id
in: query
required: false
schema:
$ref: '#/components/schemas/instrument_id'
- name: instrument_type
in: query
required: false
schema:
$ref: '#/components/schemas/instrument_type'
- name: category
in: query
required: false
schema:
$ref: '#/components/schemas/category'
responses:
'200':
description: Instruments response.
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Instrument'
'400':
$ref: '#/components/responses/Error400Response'
'429':
$ref: '#/components/responses/Error429Response'
'500':
$ref: '#/components/responses/Error500Response'
security: []
components:
schemas:
instrument_id:
type: integer
description: Instrument ID
instrument_type:
type: string
description: Instrument type
enum:
- perpetual
category:
type: string
description: Instrument category
enum:
- equity
- commodity
- index
- crypto
Instrument:
type: object
required:
- instrument_id
- instrument_type
- category
- symbol
- base_asset
- quote_asset
- funding_interval
- quantity_decimals
- price_decimals
- price_bounds
- liquidation_fee
- max_order_count
- min_notional
- max_market_notional
- max_limit_notional
- max_leverage
- risk_tiers
properties:
instrument_id:
$ref: '#/components/schemas/instrument_id'
instrument_type:
$ref: '#/components/schemas/instrument_type'
category:
$ref: '#/components/schemas/category'
symbol:
$ref: '#/components/schemas/symbol'
base_asset:
$ref: '#/components/schemas/base_asset'
quote_asset:
$ref: '#/components/schemas/quote_asset'
funding_interval:
$ref: '#/components/schemas/funding_interval'
quantity_decimals:
$ref: '#/components/schemas/quantity_decimals'
price_decimals:
$ref: '#/components/schemas/price_decimals'
price_bounds:
$ref: '#/components/schemas/price_bounds'
liquidation_fee:
$ref: '#/components/schemas/liquidation_fee'
max_order_count:
$ref: '#/components/schemas/max_order_count'
min_notional:
$ref: '#/components/schemas/min_notional'
max_market_notional:
$ref: '#/components/schemas/max_market_notional'
max_limit_notional:
$ref: '#/components/schemas/max_limit_notional'
max_leverage:
$ref: '#/components/schemas/max_leverage'
risk_tiers:
type: array
items:
$ref: '#/components/schemas/RiskTier'
symbol:
type: string
description: Instrument symbol
example: NVDA-USDC
base_asset:
type: string
description: Base asset name
example: NVDA
quote_asset:
type: string
description: Quote asset name
example: USDC
funding_interval:
type: string
description: Funding interval
example: 1h
quantity_decimals:
type: integer
description: Number of decimal places for quantity.
example: 2
price_decimals:
type: integer
description: >-
Number of decimal places for price. Non-integer prices have a maximum of
5 significant figures; integer prices are allowed regardless of
significant figures.
example: 2
price_bounds:
type: string
description: Price bounds percentage
example: '0.05'
liquidation_fee:
type: string
description: Liquidation fee rate
example: '0.025'
max_order_count:
type: integer
description: Maximum open order count
example: 200
min_notional:
type: string
description: Minimum notional value in USD
example: '1.00'
max_market_notional:
type: string
description: Maximum market order notional value in USD
example: '1000000.00'
max_limit_notional:
type: string
description: Maximum limit order notional value in USD
example: '10000000.00'
max_leverage:
type: integer
description: Maximum leverage
example: 20
RiskTier:
type: object
required:
- lower_bound
- max_leverage
properties:
lower_bound:
$ref: '#/components/schemas/lower_bound'
max_leverage:
$ref: '#/components/schemas/max_leverage'
Error400:
title: Error400
type: object
required:
- status
- error
properties:
status:
type: string
enum:
- err
error:
$ref: '#/components/schemas/error'
Error429:
title: Error429
type: object
required:
- status
- error
properties:
status:
type: string
enum:
- err
error:
$ref: '#/components/schemas/error'
Error500:
title: Error500
type: object
required:
- status
- error
properties:
status:
type: string
enum:
- err
error:
$ref: '#/components/schemas/error'
lower_bound:
type: string
description: Position size lower bound
example: '0'
error:
type: string
description: >-
Error identifier. For domain rejections and transport errors
(`401`/`404`/`429`/`500`) this is a stable, machine-readable snake_case
identifier that is part of the API contract and safe to branch on, e.g.
`insufficient_margin`, `insufficient_balance`, `order_not_found`,
`reduce_only_invalid`, `unauthorized`, `not_found`. For `400` it is a
human-readable validation detail whose wording may change. See the Error
handling guide for the domain identifiers. (Post-only / Fill-or-Kill
outcomes are order statuses such as `post_only_rejected`, not
rejections.)
example: insufficient_margin
responses:
Error400Response:
description: |
Bad request — the request was malformed or failed validation (bad query
parameters, unparseable body, invalid signature, or a domain pre-check).
The `error` field is a human-readable validation detail.
content:
application/json:
schema:
$ref: '#/components/schemas/Error400'
Error429Response:
description: >
Too Many Requests. `error` distinguishes the limit that was hit:
`ip_rate_limited` (per-IP token bucket), `action_rate_limited`
(per-account
action rate), or `open_orders_limit` (resting open-order cap).
headers:
Retry-After:
description: >
Whole seconds to wait before retrying. Present only on token-bucket
rate-limit rejections (`ip_rate_limited` and `action_rate_limited`);
a
conservative estimate of when enough capacity will have refilled to
admit the request. Absent on `open_orders_limit`, which is a
capacity
limit, not a rate limit — waiting does not free order slots; cancel
resting orders or wait for fills instead.
schema:
type: integer
example: 2
content:
application/json:
schema:
$ref: '#/components/schemas/Error429'
Error500Response:
description: |
Internal server error. `error` is `internal_error`.
content:
application/json:
schema:
$ref: '#/components/schemas/Error500'
````
@@ -0,0 +1,282 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
> Use this file to discover all available pages before exploring further.
# Get Internal Transfers
> Get settled internal transfer history for the authenticated account.
Returns both inbound and outbound transfers.
<Badge color="gray" size="md">Request Weight: **10**</Badge>
## OpenAPI
````yaml /api-spec/perps-openapi.json get /v1/account/internal-transfers
openapi: 3.0.3
info:
title: Polymarket Perps HTTP API
version: 1.0.0
description: HTTP API for Polymarket perpetual trading system.
license:
name: Apache 2.0
url: https://www.apache.org/licenses/LICENSE-2.0.html
servers:
- url: https://api.perpetuals.polymarket.com
description: Production Perps HTTP API
security: []
paths:
/v1/account/internal-transfers:
get:
summary: Get Internal Transfers
description: |
Get settled internal transfer history for the authenticated account.
Returns both inbound and outbound transfers.
operationId: getInternalTransfers
parameters:
- name: start_timestamp
in: query
required: false
schema:
$ref: '#/components/schemas/start_timestamp'
- name: end_timestamp
in: query
required: false
schema:
$ref: '#/components/schemas/end_timestamp'
responses:
'200':
description: Internal transfer history response.
content:
application/json:
schema:
$ref: '#/components/schemas/InternalTransfers'
'400':
$ref: '#/components/responses/Error400Response'
'401':
$ref: '#/components/responses/Error401Response'
'429':
$ref: '#/components/responses/Error429Response'
'500':
$ref: '#/components/responses/Error500Response'
security:
- polymarket_proxy: []
polymarket_secret: []
components:
schemas:
start_timestamp:
type: integer
description: Start timestamp in milliseconds
example: 1767225600000
end_timestamp:
type: integer
description: End timestamp in milliseconds
example: 1767229200000
InternalTransfers:
type: object
required:
- data
- more
properties:
data:
type: array
items:
$ref: '#/components/schemas/InternalTransfer'
more:
$ref: '#/components/schemas/more'
InternalTransfer:
type: object
required:
- transfer_id
- asset
- amount
- direction
- counterparty
- created_timestamp
properties:
transfer_id:
$ref: '#/components/schemas/transfer_id'
asset:
$ref: '#/components/schemas/asset'
amount:
$ref: '#/components/schemas/amount'
direction:
$ref: '#/components/schemas/direction'
counterparty:
$ref: '#/components/schemas/counterparty'
label:
$ref: '#/components/schemas/label'
created_timestamp:
$ref: '#/components/schemas/created_timestamp'
more:
type: boolean
description: More data available
Error400:
title: Error400
type: object
required:
- status
- error
properties:
status:
type: string
enum:
- err
error:
$ref: '#/components/schemas/error'
Error401:
title: Error401
type: object
required:
- status
- error
properties:
status:
type: string
enum:
- err
error:
$ref: '#/components/schemas/error'
Error429:
title: Error429
type: object
required:
- status
- error
properties:
status:
type: string
enum:
- err
error:
$ref: '#/components/schemas/error'
Error500:
title: Error500
type: object
required:
- status
- error
properties:
status:
type: string
enum:
- err
error:
$ref: '#/components/schemas/error'
transfer_id:
type: integer
description: Internal transfer ID
asset:
type: string
description: Asset name
example: USDC
amount:
type: string
description: >-
Raw token amount including decimals. For withdrawals this matches the
uint256 amount in the EIP-712 signature (e.g. "100000000" for 100 USDC
with 6 decimals).
example: '100000000'
direction:
type: string
description: Transfer direction relative to the authenticated account
enum:
- in
- out
counterparty:
type: string
description: Counterparty account address in hex format
example: '0x1234567890abcdef1234567890abcdef12345678'
label:
type: string
description: Human-readable label for a proxy key or internal transfer
example: trading-bot
created_timestamp:
type: integer
description: Creation timestamp in milliseconds
example: 1767225600000
error:
type: string
description: >-
Error identifier. For domain rejections and transport errors
(`401`/`404`/`429`/`500`) this is a stable, machine-readable snake_case
identifier that is part of the API contract and safe to branch on, e.g.
`insufficient_margin`, `insufficient_balance`, `order_not_found`,
`reduce_only_invalid`, `unauthorized`, `not_found`. For `400` it is a
human-readable validation detail whose wording may change. See the Error
handling guide for the domain identifiers. (Post-only / Fill-or-Kill
outcomes are order statuses such as `post_only_rejected`, not
rejections.)
example: insufficient_margin
responses:
Error400Response:
description: |
Bad request — the request was malformed or failed validation (bad query
parameters, unparseable body, invalid signature, or a domain pre-check).
The `error` field is a human-readable validation detail.
content:
application/json:
schema:
$ref: '#/components/schemas/Error400'
Error401Response:
description: >
Unauthorized — missing or invalid `POLYMARKET-PROXY` /
`POLYMARKET-SECRET`
credentials. `error` is `unauthorized`.
content:
application/json:
schema:
$ref: '#/components/schemas/Error401'
Error429Response:
description: >
Too Many Requests. `error` distinguishes the limit that was hit:
`ip_rate_limited` (per-IP token bucket), `action_rate_limited`
(per-account
action rate), or `open_orders_limit` (resting open-order cap).
headers:
Retry-After:
description: >
Whole seconds to wait before retrying. Present only on token-bucket
rate-limit rejections (`ip_rate_limited` and `action_rate_limited`);
a
conservative estimate of when enough capacity will have refilled to
admit the request. Absent on `open_orders_limit`, which is a
capacity
limit, not a rate limit — waiting does not free order slots; cancel
resting orders or wait for fills instead.
schema:
type: integer
example: 2
content:
application/json:
schema:
$ref: '#/components/schemas/Error429'
Error500Response:
description: |
Internal server error. `error` is `internal_error`.
content:
application/json:
schema:
$ref: '#/components/schemas/Error500'
securitySchemes:
polymarket_proxy:
type: apiKey
name: POLYMARKET-PROXY
in: header
description: Proxy address
polymarket_secret:
type: apiKey
name: POLYMARKET-SECRET
in: header
description: Correponding proxy secret
````
@@ -0,0 +1,237 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
> Use this file to discover all available pages before exploring further.
# Get Klines
> Get klines for an instrument.
If no end time is provided, the current time will be used.
Maximum of 1000 entries returned per request.
<Badge color="gray" size="md">Request Weight: **5**</Badge>
## OpenAPI
````yaml /api-spec/perps-openapi.json get /v1/info/klines
openapi: 3.0.3
info:
title: Polymarket Perps HTTP API
version: 1.0.0
description: HTTP API for Polymarket perpetual trading system.
license:
name: Apache 2.0
url: https://www.apache.org/licenses/LICENSE-2.0.html
servers:
- url: https://api.perpetuals.polymarket.com
description: Production Perps HTTP API
security: []
paths:
/v1/info/klines:
get:
summary: Get Klines
description: |
Get klines for an instrument.
If no end time is provided, the current time will be used.
Maximum of 1000 entries returned per request.
operationId: getKlines
parameters:
- name: instrument_id
in: query
required: true
schema:
$ref: '#/components/schemas/instrument_id'
- name: interval
in: query
required: true
schema:
$ref: '#/components/schemas/interval'
- name: start_timestamp
in: query
required: true
schema:
$ref: '#/components/schemas/start_timestamp'
- name: end_timestamp
in: query
required: false
schema:
$ref: '#/components/schemas/end_timestamp'
responses:
'200':
description: Klines response.
content:
application/json:
schema:
$ref: '#/components/schemas/KlinesResponse'
'400':
$ref: '#/components/responses/Error400Response'
'429':
$ref: '#/components/responses/Error429Response'
'500':
$ref: '#/components/responses/Error500Response'
security: []
components:
schemas:
instrument_id:
type: integer
description: Instrument ID
interval:
type: string
description: Kline interval
enum:
- 1s
- 1m
- 5m
- 15m
- 30m
- 1h
- 4h
- 6h
- 12h
- 1d
- 1w
start_timestamp:
type: integer
description: Start timestamp in milliseconds
example: 1767225600000
end_timestamp:
type: integer
description: End timestamp in milliseconds
example: 1767229200000
KlinesResponse:
type: object
required:
- data
- more
properties:
data:
type: array
items:
$ref: '#/components/schemas/kline'
maxItems: 1000
more:
$ref: '#/components/schemas/more'
kline:
type: array
description: |
- `1767225600000` - Open time
- `"100.00"` - Open price
- `"105.00"` - High price
- `"99.00"` - Low price
- `"102.00"` - Close price
- `"500.00"` - Volume (base unit)
- `42` - Number of trades
example:
- 1767225600000
- '100.00'
- '105.00'
- '99.00'
- '102.00'
- '500.00'
- 42
more:
type: boolean
description: More data available
Error400:
title: Error400
type: object
required:
- status
- error
properties:
status:
type: string
enum:
- err
error:
$ref: '#/components/schemas/error'
Error429:
title: Error429
type: object
required:
- status
- error
properties:
status:
type: string
enum:
- err
error:
$ref: '#/components/schemas/error'
Error500:
title: Error500
type: object
required:
- status
- error
properties:
status:
type: string
enum:
- err
error:
$ref: '#/components/schemas/error'
error:
type: string
description: >-
Error identifier. For domain rejections and transport errors
(`401`/`404`/`429`/`500`) this is a stable, machine-readable snake_case
identifier that is part of the API contract and safe to branch on, e.g.
`insufficient_margin`, `insufficient_balance`, `order_not_found`,
`reduce_only_invalid`, `unauthorized`, `not_found`. For `400` it is a
human-readable validation detail whose wording may change. See the Error
handling guide for the domain identifiers. (Post-only / Fill-or-Kill
outcomes are order statuses such as `post_only_rejected`, not
rejections.)
example: insufficient_margin
responses:
Error400Response:
description: |
Bad request — the request was malformed or failed validation (bad query
parameters, unparseable body, invalid signature, or a domain pre-check).
The `error` field is a human-readable validation detail.
content:
application/json:
schema:
$ref: '#/components/schemas/Error400'
Error429Response:
description: >
Too Many Requests. `error` distinguishes the limit that was hit:
`ip_rate_limited` (per-IP token bucket), `action_rate_limited`
(per-account
action rate), or `open_orders_limit` (resting open-order cap).
headers:
Retry-After:
description: >
Whole seconds to wait before retrying. Present only on token-bucket
rate-limit rejections (`ip_rate_limited` and `action_rate_limited`);
a
conservative estimate of when enough capacity will have refilled to
admit the request. Absent on `open_orders_limit`, which is a
capacity
limit, not a rate limit — waiting does not free order slots; cancel
resting orders or wait for fills instead.
schema:
type: integer
example: 2
content:
application/json:
schema:
$ref: '#/components/schemas/Error429'
Error500Response:
description: |
Internal server error. `error` is `internal_error`.
content:
application/json:
schema:
$ref: '#/components/schemas/Error500'
````
@@ -0,0 +1,188 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
> Use this file to discover all available pages before exploring further.
# Get Limit Tiers
> Get the list of account limit tiers. Action and open-order fields are enforced per account; legacy request-rate fields are not used for gateway request enforcement.
<Badge color="gray" size="md">Request Weight: **2**</Badge>
## OpenAPI
````yaml /api-spec/perps-openapi.json get /v1/info/limit-tiers
openapi: 3.0.3
info:
title: Polymarket Perps HTTP API
version: 1.0.0
description: HTTP API for Polymarket perpetual trading system.
license:
name: Apache 2.0
url: https://www.apache.org/licenses/LICENSE-2.0.html
servers:
- url: https://api.perpetuals.polymarket.com
description: Production Perps HTTP API
security: []
paths:
/v1/info/limit-tiers:
get:
summary: Get Limit Tiers
description: >-
Get the list of account limit tiers. Action and open-order fields are
enforced per account; legacy request-rate fields are not used for
gateway request enforcement.
operationId: getLimitTiers
responses:
'200':
description: Limit tiers response.
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/LimitTier'
'429':
$ref: '#/components/responses/Error429Response'
'500':
$ref: '#/components/responses/Error500Response'
security: []
components:
schemas:
LimitTier:
type: object
required:
- min_volume_14d
- rate_per_minute_limit
- rate_burst_limit
- actions_per_minute_limit
- actions_burst_limit
- open_orders_limit
- messages_per_minute
properties:
min_volume_14d:
$ref: '#/components/schemas/min_volume'
rate_per_minute_limit:
$ref: '#/components/schemas/rate_per_minute_limit'
rate_burst_limit:
$ref: '#/components/schemas/rate_burst_limit'
actions_per_minute_limit:
$ref: '#/components/schemas/actions_per_minute_limit'
actions_burst_limit:
$ref: '#/components/schemas/actions_burst_limit'
open_orders_limit:
$ref: '#/components/schemas/open_orders_limit'
messages_per_minute:
$ref: '#/components/schemas/messages_per_minute'
min_volume:
type: string
description: Minimum volume threshold for this tier
example: '0'
rate_per_minute_limit:
type: integer
description: >-
Maximum IP request weight per minute. In limit tiers, this is a legacy
field and is not used for gateway enforcement.
example: 1200
rate_burst_limit:
type: integer
description: >-
Legacy limit-tier request-rate field. It is not used for gateway
enforcement.
actions_per_minute_limit:
type: integer
description: Maximum order action tokens per account per minute
example: 300
actions_burst_limit:
type: integer
description: Additional account action allowance limit
open_orders_limit:
type: integer
description: Maximum number of open orders per account
example: 1000
messages_per_minute:
type: integer
description: >-
Display-only per-minute action/message allowance, equal to
actions_per_minute_limit. Not separately configured or enforced.
example: 300
Error429:
title: Error429
type: object
required:
- status
- error
properties:
status:
type: string
enum:
- err
error:
$ref: '#/components/schemas/error'
Error500:
title: Error500
type: object
required:
- status
- error
properties:
status:
type: string
enum:
- err
error:
$ref: '#/components/schemas/error'
error:
type: string
description: >-
Error identifier. For domain rejections and transport errors
(`401`/`404`/`429`/`500`) this is a stable, machine-readable snake_case
identifier that is part of the API contract and safe to branch on, e.g.
`insufficient_margin`, `insufficient_balance`, `order_not_found`,
`reduce_only_invalid`, `unauthorized`, `not_found`. For `400` it is a
human-readable validation detail whose wording may change. See the Error
handling guide for the domain identifiers. (Post-only / Fill-or-Kill
outcomes are order statuses such as `post_only_rejected`, not
rejections.)
example: insufficient_margin
responses:
Error429Response:
description: >
Too Many Requests. `error` distinguishes the limit that was hit:
`ip_rate_limited` (per-IP token bucket), `action_rate_limited`
(per-account
action rate), or `open_orders_limit` (resting open-order cap).
headers:
Retry-After:
description: >
Whole seconds to wait before retrying. Present only on token-bucket
rate-limit rejections (`ip_rate_limited` and `action_rate_limited`);
a
conservative estimate of when enough capacity will have refilled to
admit the request. Absent on `open_orders_limit`, which is a
capacity
limit, not a rate limit — waiting does not free order slots; cancel
resting orders or wait for fills instead.
schema:
type: integer
example: 2
content:
application/json:
schema:
$ref: '#/components/schemas/Error429'
Error500Response:
description: |
Internal server error. `error` is `internal_error`.
content:
application/json:
schema:
$ref: '#/components/schemas/Error500'
````
@@ -0,0 +1,382 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
> Use this file to discover all available pages before exploring further.
# Get Open Orders
> Get open orders for the authenticated account.
<Badge color="gray" size="md">Request Weight:</Badge>
<br />
<Badge color="gray" size="md">With instrument ID: **1**</Badge>
<br />
<Badge color="gray" size="md">Without instrument ID: **20**</Badge>
## OpenAPI
````yaml /api-spec/perps-openapi.json get /v1/account/open-orders
openapi: 3.0.3
info:
title: Polymarket Perps HTTP API
version: 1.0.0
description: HTTP API for Polymarket perpetual trading system.
license:
name: Apache 2.0
url: https://www.apache.org/licenses/LICENSE-2.0.html
servers:
- url: https://api.perpetuals.polymarket.com
description: Production Perps HTTP API
security: []
paths:
/v1/account/open-orders:
get:
summary: Get Open Orders
description: Get open orders for the authenticated account.
operationId: getOpenOrders
parameters:
- name: instrument_id
in: query
required: false
schema:
$ref: '#/components/schemas/iid'
responses:
'200':
description: Orders response.
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/OrderData'
'400':
$ref: '#/components/responses/Error400Response'
'401':
$ref: '#/components/responses/Error401Response'
'429':
$ref: '#/components/responses/Error429Response'
'500':
$ref: '#/components/responses/Error500Response'
security:
- polymarket_proxy: []
polymarket_secret: []
components:
schemas:
iid:
type: integer
description: Instrument ID
example: 1
OrderData:
type: object
required:
- order_id
- instrument_id
- buy
- price
- quantity
- tif
- post_only
- ro
- status
- resting_quantity
- filled_quantity
- created_timestamp
- updated_timestamp
properties:
order_id:
$ref: '#/components/schemas/oid'
instrument_id:
$ref: '#/components/schemas/iid'
buy:
$ref: '#/components/schemas/buy'
price:
$ref: '#/components/schemas/p'
quantity:
$ref: '#/components/schemas/qty'
tif:
$ref: '#/components/schemas/tif'
post_only:
$ref: '#/components/schemas/po'
ro:
$ref: '#/components/schemas/ro'
resting_quantity:
$ref: '#/components/schemas/rest'
filled_quantity:
$ref: '#/components/schemas/fill'
status:
$ref: '#/components/schemas/st'
created_timestamp:
$ref: '#/components/schemas/cts'
updated_timestamp:
$ref: '#/components/schemas/uts'
client_order_id:
$ref: '#/components/schemas/coid'
tpsl:
$ref: '#/components/schemas/TpSlOrderFields'
description: >-
Conditional-order fields. Present only when the order is a TP/SL
conditional order — `null`/omitted for regular orders.
oid:
type: integer
description: Order ID
example: 1234567890
buy:
type: boolean
description: Is buy
example: true
p:
type: string
description: Price
example: '100.00'
qty:
type: string
description: Quantity in no. of contracts
example: '10.00'
tif:
type: string
description: Time in force
enum:
- gtc
- ioc
- fok
po:
type: boolean
description: Post only
default: false
example: false
ro:
type: boolean
description: Reduce only
example: false
default: false
rest:
type: string
description: Resting quantity
example: '9.00'
fill:
type: string
description: Filled quantity
example: '1.00'
st:
type: string
description: Order status
example: open
cts:
type: integer
description: Create timestamp in milliseconds
example: 1767225600000
uts:
type: integer
description: Update timestamp in milliseconds
example: 1767225600000
coid:
type: string
description: Client order ID
minLength: 32
maxLength: 32
pattern: ^[0-9a-f]{32}$
example: 550e8400e29b41d4a716446655440000
TpSlOrderFields:
type: object
description: TP/SL-specific fields surfaced alongside the regular order shape.
required:
- kind
- scope
- trp
properties:
kind:
$ref: '#/components/schemas/kind'
scope:
$ref: '#/components/schemas/tr_scope'
trp:
$ref: '#/components/schemas/trp'
parent_oid:
$ref: '#/components/schemas/parent_oid'
armed_qty:
$ref: '#/components/schemas/qty'
description: >-
Quantity armed at attach time (OCO) or `"0"` for position-based
(sized at trigger time).
slip_bps:
$ref: '#/components/schemas/slip_bps'
Error400:
title: Error400
type: object
required:
- status
- error
properties:
status:
type: string
enum:
- err
error:
$ref: '#/components/schemas/error'
Error401:
title: Error401
type: object
required:
- status
- error
properties:
status:
type: string
enum:
- err
error:
$ref: '#/components/schemas/error'
Error429:
title: Error429
type: object
required:
- status
- error
properties:
status:
type: string
enum:
- err
error:
$ref: '#/components/schemas/error'
Error500:
title: Error500
type: object
required:
- status
- error
properties:
status:
type: string
enum:
- err
error:
$ref: '#/components/schemas/error'
kind:
type: string
description: Conditional order type (TakeProfit / StopLoss)
enum:
- tp
- sl
tr_scope:
type: string
description: >
How the conditional order sizes itself.
- `order` - child of a parent entry (bracket / OCO ladder). Quantity is
required.
- `position` - attached to an open position. v1 always closes the full
position (`qty` must be `"0"`).
enum:
- order
- position
trp:
type: string
description: Trigger price
example: '110.00'
parent_oid:
type: integer
description: >-
Parent entry order id. Optional — omit it (do not send `0`) when the
parent is created in the same request (inline `CreateOrder.tpsl` or
`CreateTpSlArgs.parent`); the gateway auto-wires the child to it. Set it
only to attach an order-scoped leg to an existing resting order. Inline
`CreateOrder.tpsl` rejects a non-zero value; position-scoped legs carry
no parent.
example: 1234567890
slip_bps:
type: integer
minimum: 0
maximum: 10000
description: >-
Per-order market-trigger slippage cap in basis points. 0 = use the
per-instrument default. Clamped to the instrument cap.
example: 1000
error:
type: string
description: >-
Error identifier. For domain rejections and transport errors
(`401`/`404`/`429`/`500`) this is a stable, machine-readable snake_case
identifier that is part of the API contract and safe to branch on, e.g.
`insufficient_margin`, `insufficient_balance`, `order_not_found`,
`reduce_only_invalid`, `unauthorized`, `not_found`. For `400` it is a
human-readable validation detail whose wording may change. See the Error
handling guide for the domain identifiers. (Post-only / Fill-or-Kill
outcomes are order statuses such as `post_only_rejected`, not
rejections.)
example: insufficient_margin
responses:
Error400Response:
description: |
Bad request — the request was malformed or failed validation (bad query
parameters, unparseable body, invalid signature, or a domain pre-check).
The `error` field is a human-readable validation detail.
content:
application/json:
schema:
$ref: '#/components/schemas/Error400'
Error401Response:
description: >
Unauthorized — missing or invalid `POLYMARKET-PROXY` /
`POLYMARKET-SECRET`
credentials. `error` is `unauthorized`.
content:
application/json:
schema:
$ref: '#/components/schemas/Error401'
Error429Response:
description: >
Too Many Requests. `error` distinguishes the limit that was hit:
`ip_rate_limited` (per-IP token bucket), `action_rate_limited`
(per-account
action rate), or `open_orders_limit` (resting open-order cap).
headers:
Retry-After:
description: >
Whole seconds to wait before retrying. Present only on token-bucket
rate-limit rejections (`ip_rate_limited` and `action_rate_limited`);
a
conservative estimate of when enough capacity will have refilled to
admit the request. Absent on `open_orders_limit`, which is a
capacity
limit, not a rate limit — waiting does not free order slots; cancel
resting orders or wait for fills instead.
schema:
type: integer
example: 2
content:
application/json:
schema:
$ref: '#/components/schemas/Error429'
Error500Response:
description: |
Internal server error. `error` is `internal_error`.
content:
application/json:
schema:
$ref: '#/components/schemas/Error500'
securitySchemes:
polymarket_proxy:
type: apiKey
name: POLYMARKET-PROXY
in: header
description: Proxy address
polymarket_secret:
type: apiKey
name: POLYMARKET-SECRET
in: header
description: Correponding proxy secret
````
@@ -0,0 +1,427 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
> Use this file to discover all available pages before exploring further.
# Get Orders
> Get historical order snapshots for the authenticated account from the order history database.
Returns the latest known state for each matching order, including accepted, open, partial,
filled, and cancelled orders. For currently resting orders only, use Get Open Orders.
Maximum of 100 entries returned per request.
<Badge color="gray" size="md">Request Weight:</Badge>
<br />
<Badge color="gray" size="md">With order ID: **1**</Badge>
<br />
<Badge color="gray" size="md">Without order ID: **10**</Badge>
## OpenAPI
````yaml /api-spec/perps-openapi.json get /v1/account/orders
openapi: 3.0.3
info:
title: Polymarket Perps HTTP API
version: 1.0.0
description: HTTP API for Polymarket perpetual trading system.
license:
name: Apache 2.0
url: https://www.apache.org/licenses/LICENSE-2.0.html
servers:
- url: https://api.perpetuals.polymarket.com
description: Production Perps HTTP API
security: []
paths:
/v1/account/orders:
get:
summary: Get Orders
description: >
Get historical order snapshots for the authenticated account from the
order history database.
Returns the latest known state for each matching order, including
accepted, open, partial,
filled, and cancelled orders. For currently resting orders only, use Get
Open Orders.
Maximum of 100 entries returned per request.
operationId: getOrders
parameters:
- name: order_id
in: query
required: false
schema:
$ref: '#/components/schemas/order_id'
- name: client_order_id
in: query
required: false
schema:
$ref: '#/components/schemas/coid'
- name: instrument_id
in: query
required: false
schema:
$ref: '#/components/schemas/iid'
- name: start_timestamp
in: query
required: false
schema:
$ref: '#/components/schemas/start_timestamp'
- name: end_timestamp
in: query
required: false
schema:
$ref: '#/components/schemas/end_timestamp'
responses:
'200':
description: Orders response.
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/OrderData'
'400':
$ref: '#/components/responses/Error400Response'
'401':
$ref: '#/components/responses/Error401Response'
'429':
$ref: '#/components/responses/Error429Response'
'500':
$ref: '#/components/responses/Error500Response'
security:
- polymarket_proxy: []
polymarket_secret: []
components:
schemas:
order_id:
type: integer
description: Order ID
coid:
type: string
description: Client order ID
minLength: 32
maxLength: 32
pattern: ^[0-9a-f]{32}$
example: 550e8400e29b41d4a716446655440000
iid:
type: integer
description: Instrument ID
example: 1
start_timestamp:
type: integer
description: Start timestamp in milliseconds
example: 1767225600000
end_timestamp:
type: integer
description: End timestamp in milliseconds
example: 1767229200000
OrderData:
type: object
required:
- order_id
- instrument_id
- buy
- price
- quantity
- tif
- post_only
- ro
- status
- resting_quantity
- filled_quantity
- created_timestamp
- updated_timestamp
properties:
order_id:
$ref: '#/components/schemas/oid'
instrument_id:
$ref: '#/components/schemas/iid'
buy:
$ref: '#/components/schemas/buy'
price:
$ref: '#/components/schemas/p'
quantity:
$ref: '#/components/schemas/qty'
tif:
$ref: '#/components/schemas/tif'
post_only:
$ref: '#/components/schemas/po'
ro:
$ref: '#/components/schemas/ro'
resting_quantity:
$ref: '#/components/schemas/rest'
filled_quantity:
$ref: '#/components/schemas/fill'
status:
$ref: '#/components/schemas/st'
created_timestamp:
$ref: '#/components/schemas/cts'
updated_timestamp:
$ref: '#/components/schemas/uts'
client_order_id:
$ref: '#/components/schemas/coid'
tpsl:
$ref: '#/components/schemas/TpSlOrderFields'
description: >-
Conditional-order fields. Present only when the order is a TP/SL
conditional order — `null`/omitted for regular orders.
oid:
type: integer
description: Order ID
example: 1234567890
buy:
type: boolean
description: Is buy
example: true
p:
type: string
description: Price
example: '100.00'
qty:
type: string
description: Quantity in no. of contracts
example: '10.00'
tif:
type: string
description: Time in force
enum:
- gtc
- ioc
- fok
po:
type: boolean
description: Post only
default: false
example: false
ro:
type: boolean
description: Reduce only
example: false
default: false
rest:
type: string
description: Resting quantity
example: '9.00'
fill:
type: string
description: Filled quantity
example: '1.00'
st:
type: string
description: Order status
example: open
cts:
type: integer
description: Create timestamp in milliseconds
example: 1767225600000
uts:
type: integer
description: Update timestamp in milliseconds
example: 1767225600000
TpSlOrderFields:
type: object
description: TP/SL-specific fields surfaced alongside the regular order shape.
required:
- kind
- scope
- trp
properties:
kind:
$ref: '#/components/schemas/kind'
scope:
$ref: '#/components/schemas/tr_scope'
trp:
$ref: '#/components/schemas/trp'
parent_oid:
$ref: '#/components/schemas/parent_oid'
armed_qty:
$ref: '#/components/schemas/qty'
description: >-
Quantity armed at attach time (OCO) or `"0"` for position-based
(sized at trigger time).
slip_bps:
$ref: '#/components/schemas/slip_bps'
Error400:
title: Error400
type: object
required:
- status
- error
properties:
status:
type: string
enum:
- err
error:
$ref: '#/components/schemas/error'
Error401:
title: Error401
type: object
required:
- status
- error
properties:
status:
type: string
enum:
- err
error:
$ref: '#/components/schemas/error'
Error429:
title: Error429
type: object
required:
- status
- error
properties:
status:
type: string
enum:
- err
error:
$ref: '#/components/schemas/error'
Error500:
title: Error500
type: object
required:
- status
- error
properties:
status:
type: string
enum:
- err
error:
$ref: '#/components/schemas/error'
kind:
type: string
description: Conditional order type (TakeProfit / StopLoss)
enum:
- tp
- sl
tr_scope:
type: string
description: >
How the conditional order sizes itself.
- `order` - child of a parent entry (bracket / OCO ladder). Quantity is
required.
- `position` - attached to an open position. v1 always closes the full
position (`qty` must be `"0"`).
enum:
- order
- position
trp:
type: string
description: Trigger price
example: '110.00'
parent_oid:
type: integer
description: >-
Parent entry order id. Optional — omit it (do not send `0`) when the
parent is created in the same request (inline `CreateOrder.tpsl` or
`CreateTpSlArgs.parent`); the gateway auto-wires the child to it. Set it
only to attach an order-scoped leg to an existing resting order. Inline
`CreateOrder.tpsl` rejects a non-zero value; position-scoped legs carry
no parent.
example: 1234567890
slip_bps:
type: integer
minimum: 0
maximum: 10000
description: >-
Per-order market-trigger slippage cap in basis points. 0 = use the
per-instrument default. Clamped to the instrument cap.
example: 1000
error:
type: string
description: >-
Error identifier. For domain rejections and transport errors
(`401`/`404`/`429`/`500`) this is a stable, machine-readable snake_case
identifier that is part of the API contract and safe to branch on, e.g.
`insufficient_margin`, `insufficient_balance`, `order_not_found`,
`reduce_only_invalid`, `unauthorized`, `not_found`. For `400` it is a
human-readable validation detail whose wording may change. See the Error
handling guide for the domain identifiers. (Post-only / Fill-or-Kill
outcomes are order statuses such as `post_only_rejected`, not
rejections.)
example: insufficient_margin
responses:
Error400Response:
description: |
Bad request — the request was malformed or failed validation (bad query
parameters, unparseable body, invalid signature, or a domain pre-check).
The `error` field is a human-readable validation detail.
content:
application/json:
schema:
$ref: '#/components/schemas/Error400'
Error401Response:
description: >
Unauthorized — missing or invalid `POLYMARKET-PROXY` /
`POLYMARKET-SECRET`
credentials. `error` is `unauthorized`.
content:
application/json:
schema:
$ref: '#/components/schemas/Error401'
Error429Response:
description: >
Too Many Requests. `error` distinguishes the limit that was hit:
`ip_rate_limited` (per-IP token bucket), `action_rate_limited`
(per-account
action rate), or `open_orders_limit` (resting open-order cap).
headers:
Retry-After:
description: >
Whole seconds to wait before retrying. Present only on token-bucket
rate-limit rejections (`ip_rate_limited` and `action_rate_limited`);
a
conservative estimate of when enough capacity will have refilled to
admit the request. Absent on `open_orders_limit`, which is a
capacity
limit, not a rate limit — waiting does not free order slots; cancel
resting orders or wait for fills instead.
schema:
type: integer
example: 2
content:
application/json:
schema:
$ref: '#/components/schemas/Error429'
Error500Response:
description: |
Internal server error. `error` is `internal_error`.
content:
application/json:
schema:
$ref: '#/components/schemas/Error500'
securitySchemes:
polymarket_proxy:
type: apiKey
name: POLYMARKET-PROXY
in: header
description: Proxy address
polymarket_secret:
type: apiKey
name: POLYMARKET-SECRET
in: header
description: Correponding proxy secret
````
@@ -0,0 +1,248 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
> Use this file to discover all available pages before exploring further.
# Get PnL
> Get PnL history for the authenticated account.
If no end time is provided, the current time will be used.
Maximum of 1000 entries returned per request.
<Badge color="gray" size="md">Request Weight: **10**</Badge>
## OpenAPI
````yaml /api-spec/perps-openapi.json get /v1/account/pnl
openapi: 3.0.3
info:
title: Polymarket Perps HTTP API
version: 1.0.0
description: HTTP API for Polymarket perpetual trading system.
license:
name: Apache 2.0
url: https://www.apache.org/licenses/LICENSE-2.0.html
servers:
- url: https://api.perpetuals.polymarket.com
description: Production Perps HTTP API
security: []
paths:
/v1/account/pnl:
get:
summary: Get PnL
description: |
Get PnL history for the authenticated account.
If no end time is provided, the current time will be used.
Maximum of 1000 entries returned per request.
operationId: getPnlHistory
parameters:
- name: interval
in: query
required: true
schema:
$ref: '#/components/schemas/pnl_interval'
- name: start_timestamp
in: query
required: true
schema:
$ref: '#/components/schemas/start_timestamp'
- name: end_timestamp
in: query
required: false
schema:
$ref: '#/components/schemas/end_timestamp'
responses:
'200':
description: PnL history response.
content:
application/json:
schema:
$ref: '#/components/schemas/PnlHistory'
'400':
$ref: '#/components/responses/Error400Response'
'401':
$ref: '#/components/responses/Error401Response'
'429':
$ref: '#/components/responses/Error429Response'
'500':
$ref: '#/components/responses/Error500Response'
security:
- polymarket_proxy: []
polymarket_secret: []
components:
schemas:
pnl_interval:
type: string
description: PnL interval
enum:
- 1h
- 4h
- 1d
- 1w
start_timestamp:
type: integer
description: Start timestamp in milliseconds
example: 1767225600000
end_timestamp:
type: integer
description: End timestamp in milliseconds
example: 1767229200000
PnlHistory:
type: object
required:
- data
- more
properties:
data:
type: array
description: |
- `1767225600000` - Timestamp
- `"100.50"` - PnL
items:
type: array
example:
- 1767225600000
- '100.50'
maxItems: 1000
more:
$ref: '#/components/schemas/more'
more:
type: boolean
description: More data available
Error400:
title: Error400
type: object
required:
- status
- error
properties:
status:
type: string
enum:
- err
error:
$ref: '#/components/schemas/error'
Error401:
title: Error401
type: object
required:
- status
- error
properties:
status:
type: string
enum:
- err
error:
$ref: '#/components/schemas/error'
Error429:
title: Error429
type: object
required:
- status
- error
properties:
status:
type: string
enum:
- err
error:
$ref: '#/components/schemas/error'
Error500:
title: Error500
type: object
required:
- status
- error
properties:
status:
type: string
enum:
- err
error:
$ref: '#/components/schemas/error'
error:
type: string
description: >-
Error identifier. For domain rejections and transport errors
(`401`/`404`/`429`/`500`) this is a stable, machine-readable snake_case
identifier that is part of the API contract and safe to branch on, e.g.
`insufficient_margin`, `insufficient_balance`, `order_not_found`,
`reduce_only_invalid`, `unauthorized`, `not_found`. For `400` it is a
human-readable validation detail whose wording may change. See the Error
handling guide for the domain identifiers. (Post-only / Fill-or-Kill
outcomes are order statuses such as `post_only_rejected`, not
rejections.)
example: insufficient_margin
responses:
Error400Response:
description: |
Bad request — the request was malformed or failed validation (bad query
parameters, unparseable body, invalid signature, or a domain pre-check).
The `error` field is a human-readable validation detail.
content:
application/json:
schema:
$ref: '#/components/schemas/Error400'
Error401Response:
description: >
Unauthorized — missing or invalid `POLYMARKET-PROXY` /
`POLYMARKET-SECRET`
credentials. `error` is `unauthorized`.
content:
application/json:
schema:
$ref: '#/components/schemas/Error401'
Error429Response:
description: >
Too Many Requests. `error` distinguishes the limit that was hit:
`ip_rate_limited` (per-IP token bucket), `action_rate_limited`
(per-account
action rate), or `open_orders_limit` (resting open-order cap).
headers:
Retry-After:
description: >
Whole seconds to wait before retrying. Present only on token-bucket
rate-limit rejections (`ip_rate_limited` and `action_rate_limited`);
a
conservative estimate of when enough capacity will have refilled to
admit the request. Absent on `open_orders_limit`, which is a
capacity
limit, not a rate limit — waiting does not free order slots; cancel
resting orders or wait for fills instead.
schema:
type: integer
example: 2
content:
application/json:
schema:
$ref: '#/components/schemas/Error429'
Error500Response:
description: |
Internal server error. `error` is `internal_error`.
content:
application/json:
schema:
$ref: '#/components/schemas/Error500'
securitySchemes:
polymarket_proxy:
type: apiKey
name: POLYMARKET-PROXY
in: header
description: Proxy address
polymarket_secret:
type: apiKey
name: POLYMARKET-SECRET
in: header
description: Correponding proxy secret
````
@@ -0,0 +1,350 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
> Use this file to discover all available pages before exploring further.
# Get Portfolio
> Get current portfolio snapshot including open positions, margin summary, and withdrawable balance.
<Badge color="gray" size="md">Request Weight: **2**</Badge>
## OpenAPI
````yaml /api-spec/perps-openapi.json get /v1/account/portfolio
openapi: 3.0.3
info:
title: Polymarket Perps HTTP API
version: 1.0.0
description: HTTP API for Polymarket perpetual trading system.
license:
name: Apache 2.0
url: https://www.apache.org/licenses/LICENSE-2.0.html
servers:
- url: https://api.perpetuals.polymarket.com
description: Production Perps HTTP API
security: []
paths:
/v1/account/portfolio:
get:
summary: Get Portfolio
description: >
Get current portfolio snapshot including open positions, margin summary,
and withdrawable balance.
operationId: getPortfolio
responses:
'200':
description: Portfolio response.
content:
application/json:
schema:
$ref: '#/components/schemas/Portfolio'
'400':
$ref: '#/components/responses/Error400Response'
'401':
$ref: '#/components/responses/Error401Response'
'429':
$ref: '#/components/responses/Error429Response'
'500':
$ref: '#/components/responses/Error500Response'
security:
- polymarket_proxy: []
polymarket_secret: []
components:
schemas:
Portfolio:
type: object
required:
- positions
- margin
- withdrawable
- in_liquidation
- timestamp
properties:
positions:
type: array
items:
$ref: '#/components/schemas/PortfolioPosition'
margin:
$ref: '#/components/schemas/MarginSummary'
withdrawable:
$ref: '#/components/schemas/withdrawable'
in_liquidation:
$ref: '#/components/schemas/in_liquidation'
timestamp:
$ref: '#/components/schemas/update_timestamp'
PortfolioPosition:
type: object
required:
- instrument_id
- symbol
- size
- entry_price
- leverage
- cross
- initial_margin
- maintenance_margin
- position_value
- liquidation_price
- unrealized_pnl
- return_on_equity
- cumulative_funding
properties:
instrument_id:
$ref: '#/components/schemas/instrument_id'
symbol:
$ref: '#/components/schemas/symbol'
size:
$ref: '#/components/schemas/size'
entry_price:
$ref: '#/components/schemas/entry_price'
leverage:
$ref: '#/components/schemas/leverage'
cross:
$ref: '#/components/schemas/cross'
initial_margin:
$ref: '#/components/schemas/initial_margin'
maintenance_margin:
$ref: '#/components/schemas/maintenance_margin_amount'
position_value:
$ref: '#/components/schemas/position_value'
liquidation_price:
$ref: '#/components/schemas/liquidation_price'
unrealized_pnl:
$ref: '#/components/schemas/unrealized_pnl'
return_on_equity:
$ref: '#/components/schemas/return_on_equity'
cumulative_funding:
$ref: '#/components/schemas/cumulative_funding'
MarginSummary:
type: object
required:
- total_account_value
- total_initial_margin
- total_maintenance_margin
- total_position_value
properties:
total_account_value:
$ref: '#/components/schemas/total_account_value'
total_initial_margin:
$ref: '#/components/schemas/total_initial_margin'
total_maintenance_margin:
$ref: '#/components/schemas/total_maintenance_margin'
total_position_value:
$ref: '#/components/schemas/total_position_value'
withdrawable:
type: string
description: Withdrawable balance in USD
example: '13104.51'
in_liquidation:
type: boolean
description: Whether the account is currently under liquidation
update_timestamp:
type: integer
description: Update timestamp in milliseconds
example: 1767225600000
Error400:
title: Error400
type: object
required:
- status
- error
properties:
status:
type: string
enum:
- err
error:
$ref: '#/components/schemas/error'
Error401:
title: Error401
type: object
required:
- status
- error
properties:
status:
type: string
enum:
- err
error:
$ref: '#/components/schemas/error'
Error429:
title: Error429
type: object
required:
- status
- error
properties:
status:
type: string
enum:
- err
error:
$ref: '#/components/schemas/error'
Error500:
title: Error500
type: object
required:
- status
- error
properties:
status:
type: string
enum:
- err
error:
$ref: '#/components/schemas/error'
instrument_id:
type: integer
description: Instrument ID
symbol:
type: string
description: Instrument symbol
example: NVDA-USDC
size:
type: string
description: >-
Signed position size in no. of contracts (positive = long, negative =
short)
example: '10.00'
entry_price:
type: string
description: Average entry price
example: '2986.30'
leverage:
type: integer
description: Leverage
example: 10
cross:
type: boolean
description: Whether to use cross margin mode
initial_margin:
type: string
description: Initial margin in USD
example: '10.00'
maintenance_margin_amount:
type: string
description: Maintenance margin amount
example: '100.00'
position_value:
type: string
description: Notional position value in USD
example: '100.03'
liquidation_price:
type: string
description: Liquidation price
example: '2866.27'
unrealized_pnl:
type: string
description: Unrealized PnL in USD
example: '-0.01'
return_on_equity:
type: string
description: Return on equity as a decimal
example: '-0.0027'
cumulative_funding:
type: string
description: Cumulative funding paid/received in USD
example: '514.09'
total_account_value:
type: string
description: Total account value in USD (equity + unrealized PnL)
example: '13109.48'
total_initial_margin:
type: string
description: Total initial margin in use across all positions
example: '4.97'
total_maintenance_margin:
type: string
description: Total maintenance margin across all positions
example: '2.49'
total_position_value:
type: string
description: Total notional position value in USD
example: '100.03'
error:
type: string
description: >-
Error identifier. For domain rejections and transport errors
(`401`/`404`/`429`/`500`) this is a stable, machine-readable snake_case
identifier that is part of the API contract and safe to branch on, e.g.
`insufficient_margin`, `insufficient_balance`, `order_not_found`,
`reduce_only_invalid`, `unauthorized`, `not_found`. For `400` it is a
human-readable validation detail whose wording may change. See the Error
handling guide for the domain identifiers. (Post-only / Fill-or-Kill
outcomes are order statuses such as `post_only_rejected`, not
rejections.)
example: insufficient_margin
responses:
Error400Response:
description: |
Bad request — the request was malformed or failed validation (bad query
parameters, unparseable body, invalid signature, or a domain pre-check).
The `error` field is a human-readable validation detail.
content:
application/json:
schema:
$ref: '#/components/schemas/Error400'
Error401Response:
description: >
Unauthorized — missing or invalid `POLYMARKET-PROXY` /
`POLYMARKET-SECRET`
credentials. `error` is `unauthorized`.
content:
application/json:
schema:
$ref: '#/components/schemas/Error401'
Error429Response:
description: >
Too Many Requests. `error` distinguishes the limit that was hit:
`ip_rate_limited` (per-IP token bucket), `action_rate_limited`
(per-account
action rate), or `open_orders_limit` (resting open-order cap).
headers:
Retry-After:
description: >
Whole seconds to wait before retrying. Present only on token-bucket
rate-limit rejections (`ip_rate_limited` and `action_rate_limited`);
a
conservative estimate of when enough capacity will have refilled to
admit the request. Absent on `open_orders_limit`, which is a
capacity
limit, not a rate limit — waiting does not free order slots; cancel
resting orders or wait for fills instead.
schema:
type: integer
example: 2
content:
application/json:
schema:
$ref: '#/components/schemas/Error429'
Error500Response:
description: |
Internal server error. `error` is `internal_error`.
content:
application/json:
schema:
$ref: '#/components/schemas/Error500'
securitySchemes:
polymarket_proxy:
type: apiKey
name: POLYMARKET-PROXY
in: header
description: Proxy address
polymarket_secret:
type: apiKey
name: POLYMARKET-SECRET
in: header
description: Correponding proxy secret
````
@@ -0,0 +1,232 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
> Use this file to discover all available pages before exploring further.
# Get Public Portfolio
> Get public portfolio for an address including equity and open positions.
<Badge color="gray" size="md">Request Weight: **5**</Badge>
## OpenAPI
````yaml /api-spec/perps-openapi.json get /v1/info/portfolio
openapi: 3.0.3
info:
title: Polymarket Perps HTTP API
version: 1.0.0
description: HTTP API for Polymarket perpetual trading system.
license:
name: Apache 2.0
url: https://www.apache.org/licenses/LICENSE-2.0.html
servers:
- url: https://api.perpetuals.polymarket.com
description: Production Perps HTTP API
security: []
paths:
/v1/info/portfolio:
get:
summary: Get Public Portfolio
description: |
Get public portfolio for an address including equity and open positions.
operationId: getPublicPortfolio
parameters:
- name: address
in: query
required: true
schema:
$ref: '#/components/schemas/address'
responses:
'200':
description: Public portfolio response.
content:
application/json:
schema:
$ref: '#/components/schemas/PublicPortfolio'
'400':
$ref: '#/components/responses/Error400Response'
'429':
$ref: '#/components/responses/Error429Response'
'500':
$ref: '#/components/responses/Error500Response'
security: []
components:
schemas:
address:
type: string
description: Address
example: '0x1234567890abcdef1234567890abcdef12345678'
PublicPortfolio:
type: object
required:
- positions
- equity
- timestamp
properties:
positions:
type: array
items:
$ref: '#/components/schemas/PublicPortfolioPosition'
equity:
$ref: '#/components/schemas/equity'
timestamp:
$ref: '#/components/schemas/update_timestamp'
PublicPortfolioPosition:
type: object
required:
- instrument_id
- symbol
- size
- entry_price
- unrealized_pnl
- return_on_equity
properties:
instrument_id:
$ref: '#/components/schemas/instrument_id'
symbol:
$ref: '#/components/schemas/symbol'
size:
$ref: '#/components/schemas/size'
entry_price:
$ref: '#/components/schemas/entry_price'
unrealized_pnl:
$ref: '#/components/schemas/unrealized_pnl'
return_on_equity:
$ref: '#/components/schemas/return_on_equity'
equity:
type: string
description: Equity in USD
example: '10000.00'
update_timestamp:
type: integer
description: Update timestamp in milliseconds
example: 1767225600000
Error400:
title: Error400
type: object
required:
- status
- error
properties:
status:
type: string
enum:
- err
error:
$ref: '#/components/schemas/error'
Error429:
title: Error429
type: object
required:
- status
- error
properties:
status:
type: string
enum:
- err
error:
$ref: '#/components/schemas/error'
Error500:
title: Error500
type: object
required:
- status
- error
properties:
status:
type: string
enum:
- err
error:
$ref: '#/components/schemas/error'
instrument_id:
type: integer
description: Instrument ID
symbol:
type: string
description: Instrument symbol
example: NVDA-USDC
size:
type: string
description: >-
Signed position size in no. of contracts (positive = long, negative =
short)
example: '10.00'
entry_price:
type: string
description: Average entry price
example: '2986.30'
unrealized_pnl:
type: string
description: Unrealized PnL in USD
example: '-0.01'
return_on_equity:
type: string
description: Return on equity as a decimal
example: '-0.0027'
error:
type: string
description: >-
Error identifier. For domain rejections and transport errors
(`401`/`404`/`429`/`500`) this is a stable, machine-readable snake_case
identifier that is part of the API contract and safe to branch on, e.g.
`insufficient_margin`, `insufficient_balance`, `order_not_found`,
`reduce_only_invalid`, `unauthorized`, `not_found`. For `400` it is a
human-readable validation detail whose wording may change. See the Error
handling guide for the domain identifiers. (Post-only / Fill-or-Kill
outcomes are order statuses such as `post_only_rejected`, not
rejections.)
example: insufficient_margin
responses:
Error400Response:
description: |
Bad request — the request was malformed or failed validation (bad query
parameters, unparseable body, invalid signature, or a domain pre-check).
The `error` field is a human-readable validation detail.
content:
application/json:
schema:
$ref: '#/components/schemas/Error400'
Error429Response:
description: >
Too Many Requests. `error` distinguishes the limit that was hit:
`ip_rate_limited` (per-IP token bucket), `action_rate_limited`
(per-account
action rate), or `open_orders_limit` (resting open-order cap).
headers:
Retry-After:
description: >
Whole seconds to wait before retrying. Present only on token-bucket
rate-limit rejections (`ip_rate_limited` and `action_rate_limited`);
a
conservative estimate of when enough capacity will have refilled to
admit the request. Absent on `open_orders_limit`, which is a
capacity
limit, not a rate limit — waiting does not free order slots; cancel
resting orders or wait for fills instead.
schema:
type: integer
example: 2
content:
application/json:
schema:
$ref: '#/components/schemas/Error429'
Error500Response:
description: |
Internal server error. `error` is `internal_error`.
content:
application/json:
schema:
$ref: '#/components/schemas/Error500'
````
@@ -0,0 +1,256 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
> Use this file to discover all available pages before exploring further.
# Get Recent Trades
> Get public trades for an instrument.
Maximum of 100 entries returned per request.
<Badge color="gray" size="md">Request Weight: **10**</Badge>
## OpenAPI
````yaml /api-spec/perps-openapi.json get /v1/info/trades
openapi: 3.0.3
info:
title: Polymarket Perps HTTP API
version: 1.0.0
description: HTTP API for Polymarket perpetual trading system.
license:
name: Apache 2.0
url: https://www.apache.org/licenses/LICENSE-2.0.html
servers:
- url: https://api.perpetuals.polymarket.com
description: Production Perps HTTP API
security: []
paths:
/v1/info/trades:
get:
summary: Get Recent Trades
description: |
Get public trades for an instrument.
Maximum of 100 entries returned per request.
operationId: getTrades
parameters:
- name: instrument_id
in: query
required: true
schema:
$ref: '#/components/schemas/instrument_id'
- name: start_timestamp
in: query
required: false
schema:
$ref: '#/components/schemas/start_timestamp'
- name: end_timestamp
in: query
required: false
schema:
$ref: '#/components/schemas/end_timestamp'
responses:
'200':
description: Trades response.
content:
application/json:
schema:
$ref: '#/components/schemas/Trades'
'400':
$ref: '#/components/responses/Error400Response'
'429':
$ref: '#/components/responses/Error429Response'
'500':
$ref: '#/components/responses/Error500Response'
security: []
components:
schemas:
instrument_id:
type: integer
description: Instrument ID
start_timestamp:
type: integer
description: Start timestamp in milliseconds
example: 1767225600000
end_timestamp:
type: integer
description: End timestamp in milliseconds
example: 1767229200000
Trades:
type: object
required:
- data
- more
properties:
data:
type: array
items:
$ref: '#/components/schemas/TradeData'
description: Public trades for the instrument
more:
$ref: '#/components/schemas/more'
TradeData:
type: object
required:
- trade_id
- instrument_id
- side
- price
- quantity
- timestamp
- hash
properties:
trade_id:
$ref: '#/components/schemas/tid'
instrument_id:
$ref: '#/components/schemas/iid'
side:
$ref: '#/components/schemas/side'
price:
$ref: '#/components/schemas/p'
quantity:
$ref: '#/components/schemas/qty'
timestamp:
$ref: '#/components/schemas/ts'
hash:
$ref: '#/components/schemas/hash'
more:
type: boolean
description: More data available
Error400:
title: Error400
type: object
required:
- status
- error
properties:
status:
type: string
enum:
- err
error:
$ref: '#/components/schemas/error'
Error429:
title: Error429
type: object
required:
- status
- error
properties:
status:
type: string
enum:
- err
error:
$ref: '#/components/schemas/error'
Error500:
title: Error500
type: object
required:
- status
- error
properties:
status:
type: string
enum:
- err
error:
$ref: '#/components/schemas/error'
tid:
type: integer
description: Trade ID
example: 1
iid:
type: integer
description: Instrument ID
example: 1
side:
type: string
description: Side
enum:
- long
- short
p:
type: string
description: Price
example: '100.00'
qty:
type: string
description: Quantity in no. of contracts
example: '10.00'
ts:
type: integer
description: >-
Request timestamp. Unix milliseconds for most operations; Unix seconds
for withdrawals (must match the on-chain EIP-712 struct verified against
block.timestamp).
example: 1767225600000
hash:
type: string
description: On-chain transaction hash, "0x" if not yet mined
default: 0x
example: '0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef'
error:
type: string
description: >-
Error identifier. For domain rejections and transport errors
(`401`/`404`/`429`/`500`) this is a stable, machine-readable snake_case
identifier that is part of the API contract and safe to branch on, e.g.
`insufficient_margin`, `insufficient_balance`, `order_not_found`,
`reduce_only_invalid`, `unauthorized`, `not_found`. For `400` it is a
human-readable validation detail whose wording may change. See the Error
handling guide for the domain identifiers. (Post-only / Fill-or-Kill
outcomes are order statuses such as `post_only_rejected`, not
rejections.)
example: insufficient_margin
responses:
Error400Response:
description: |
Bad request — the request was malformed or failed validation (bad query
parameters, unparseable body, invalid signature, or a domain pre-check).
The `error` field is a human-readable validation detail.
content:
application/json:
schema:
$ref: '#/components/schemas/Error400'
Error429Response:
description: >
Too Many Requests. `error` distinguishes the limit that was hit:
`ip_rate_limited` (per-IP token bucket), `action_rate_limited`
(per-account
action rate), or `open_orders_limit` (resting open-order cap).
headers:
Retry-After:
description: >
Whole seconds to wait before retrying. Present only on token-bucket
rate-limit rejections (`ip_rate_limited` and `action_rate_limited`);
a
conservative estimate of when enough capacity will have refilled to
admit the request. Absent on `open_orders_limit`, which is a
capacity
limit, not a rate limit — waiting does not free order slots; cancel
resting orders or wait for fills instead.
schema:
type: integer
example: 2
content:
application/json:
schema:
$ref: '#/components/schemas/Error429'
Error500Response:
description: |
Internal server error. `error` is `internal_error`.
content:
application/json:
schema:
$ref: '#/components/schemas/Error500'
````
@@ -0,0 +1,139 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
> Use this file to discover all available pages before exploring further.
# Get Server Time
> Get server time.
<Badge color="gray" size="md">Request Weight: **1**</Badge>
## OpenAPI
````yaml /api-spec/perps-openapi.json get /v1/info/time
openapi: 3.0.3
info:
title: Polymarket Perps HTTP API
version: 1.0.0
description: HTTP API for Polymarket perpetual trading system.
license:
name: Apache 2.0
url: https://www.apache.org/licenses/LICENSE-2.0.html
servers:
- url: https://api.perpetuals.polymarket.com
description: Production Perps HTTP API
security: []
paths:
/v1/info/time:
get:
summary: Get Server Time
description: |
Get server time.
operationId: getTime
responses:
'200':
description: Successful time response.
content:
application/json:
schema:
$ref: '#/components/schemas/Time'
'429':
$ref: '#/components/responses/Error429Response'
'500':
$ref: '#/components/responses/Error500Response'
security: []
components:
schemas:
Time:
type: object
required:
- time
properties:
time:
$ref: '#/components/schemas/time'
time:
type: integer
description: Timestamp in milliseconds
example: 1767225600000
Error429:
title: Error429
type: object
required:
- status
- error
properties:
status:
type: string
enum:
- err
error:
$ref: '#/components/schemas/error'
Error500:
title: Error500
type: object
required:
- status
- error
properties:
status:
type: string
enum:
- err
error:
$ref: '#/components/schemas/error'
error:
type: string
description: >-
Error identifier. For domain rejections and transport errors
(`401`/`404`/`429`/`500`) this is a stable, machine-readable snake_case
identifier that is part of the API contract and safe to branch on, e.g.
`insufficient_margin`, `insufficient_balance`, `order_not_found`,
`reduce_only_invalid`, `unauthorized`, `not_found`. For `400` it is a
human-readable validation detail whose wording may change. See the Error
handling guide for the domain identifiers. (Post-only / Fill-or-Kill
outcomes are order statuses such as `post_only_rejected`, not
rejections.)
example: insufficient_margin
responses:
Error429Response:
description: >
Too Many Requests. `error` distinguishes the limit that was hit:
`ip_rate_limited` (per-IP token bucket), `action_rate_limited`
(per-account
action rate), or `open_orders_limit` (resting open-order cap).
headers:
Retry-After:
description: >
Whole seconds to wait before retrying. Present only on token-bucket
rate-limit rejections (`ip_rate_limited` and `action_rate_limited`);
a
conservative estimate of when enough capacity will have refilled to
admit the request. Absent on `open_orders_limit`, which is a
capacity
limit, not a rate limit — waiting does not free order slots; cancel
resting orders or wait for fills instead.
schema:
type: integer
example: 2
content:
application/json:
schema:
$ref: '#/components/schemas/Error429'
Error500Response:
description: |
Internal server error. `error` is `internal_error`.
content:
application/json:
schema:
$ref: '#/components/schemas/Error500'
````
@@ -0,0 +1,195 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
> Use this file to discover all available pages before exploring further.
# Get Statistics
> Get last 24-hour statistics for all instruments.
<Badge color="gray" size="md">Request Weight: **2**</Badge>
## OpenAPI
````yaml /api-spec/perps-openapi.json get /v1/info/statistics
openapi: 3.0.3
info:
title: Polymarket Perps HTTP API
version: 1.0.0
description: HTTP API for Polymarket perpetual trading system.
license:
name: Apache 2.0
url: https://www.apache.org/licenses/LICENSE-2.0.html
servers:
- url: https://api.perpetuals.polymarket.com
description: Production Perps HTTP API
security: []
paths:
/v1/info/statistics:
get:
summary: Get Statistics
description: Get last 24-hour statistics for all instruments.
operationId: getStatistics
parameters:
- name: instrument_id
in: query
required: false
schema:
$ref: '#/components/schemas/instrument_id'
responses:
'200':
description: Statistics response.
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Statistic'
'429':
$ref: '#/components/responses/Error429Response'
'500':
$ref: '#/components/responses/Error500Response'
security: []
components:
schemas:
instrument_id:
type: integer
description: Instrument ID
Statistic:
type: object
required:
- instrument_id
- symbol
- volume
- open_price
- klines
properties:
instrument_id:
$ref: '#/components/schemas/iid'
symbol:
$ref: '#/components/schemas/symbol'
volume:
$ref: '#/components/schemas/volume'
open_price:
$ref: '#/components/schemas/open_price'
klines:
$ref: '#/components/schemas/klines'
iid:
type: integer
description: Instrument ID
example: 1
symbol:
type: string
description: Instrument symbol
example: NVDA-USDC
volume:
type: string
description: 24-hour trading volume in contracts
example: '1000.00'
open_price:
type: string
description: Opening price from 24 hours ago
example: '100.50'
klines:
type: array
items:
$ref: '#/components/schemas/kline'
description: Last 24-hour kline data
Error429:
title: Error429
type: object
required:
- status
- error
properties:
status:
type: string
enum:
- err
error:
$ref: '#/components/schemas/error'
Error500:
title: Error500
type: object
required:
- status
- error
properties:
status:
type: string
enum:
- err
error:
$ref: '#/components/schemas/error'
kline:
type: array
description: |
- `1767225600000` - Open time
- `"100.00"` - Open price
- `"105.00"` - High price
- `"99.00"` - Low price
- `"102.00"` - Close price
- `"500.00"` - Volume (base unit)
- `42` - Number of trades
example:
- 1767225600000
- '100.00'
- '105.00'
- '99.00'
- '102.00'
- '500.00'
- 42
error:
type: string
description: >-
Error identifier. For domain rejections and transport errors
(`401`/`404`/`429`/`500`) this is a stable, machine-readable snake_case
identifier that is part of the API contract and safe to branch on, e.g.
`insufficient_margin`, `insufficient_balance`, `order_not_found`,
`reduce_only_invalid`, `unauthorized`, `not_found`. For `400` it is a
human-readable validation detail whose wording may change. See the Error
handling guide for the domain identifiers. (Post-only / Fill-or-Kill
outcomes are order statuses such as `post_only_rejected`, not
rejections.)
example: insufficient_margin
responses:
Error429Response:
description: >
Too Many Requests. `error` distinguishes the limit that was hit:
`ip_rate_limited` (per-IP token bucket), `action_rate_limited`
(per-account
action rate), or `open_orders_limit` (resting open-order cap).
headers:
Retry-After:
description: >
Whole seconds to wait before retrying. Present only on token-bucket
rate-limit rejections (`ip_rate_limited` and `action_rate_limited`);
a
conservative estimate of when enough capacity will have refilled to
admit the request. Absent on `open_orders_limit`, which is a
capacity
limit, not a rate limit — waiting does not free order slots; cancel
resting orders or wait for fills instead.
schema:
type: integer
example: 2
content:
application/json:
schema:
$ref: '#/components/schemas/Error429'
Error500Response:
description: |
Internal server error. `error` is `internal_error`.
content:
application/json:
schema:
$ref: '#/components/schemas/Error500'
````
@@ -0,0 +1,213 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
> Use this file to discover all available pages before exploring further.
# Get Tickers
> Get all instrument tickers with live market data.
<Badge color="gray" size="md">Request Weight: **2**</Badge>
## OpenAPI
````yaml /api-spec/perps-openapi.json get /v1/info/tickers
openapi: 3.0.3
info:
title: Polymarket Perps HTTP API
version: 1.0.0
description: HTTP API for Polymarket perpetual trading system.
license:
name: Apache 2.0
url: https://www.apache.org/licenses/LICENSE-2.0.html
servers:
- url: https://api.perpetuals.polymarket.com
description: Production Perps HTTP API
security: []
paths:
/v1/info/tickers:
get:
summary: Get Tickers
description: Get all instrument tickers with live market data.
operationId: getTickers
parameters:
- name: instrument_id
in: query
required: false
schema:
$ref: '#/components/schemas/instrument_id'
responses:
'200':
description: Tickers response.
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Ticker'
'429':
$ref: '#/components/responses/Error429Response'
'500':
$ref: '#/components/responses/Error500Response'
security: []
components:
schemas:
instrument_id:
type: integer
description: Instrument ID
Ticker:
allOf:
- $ref: '#/components/schemas/TickerData'
- type: object
required:
- timestamp
properties:
timestamp:
$ref: '#/components/schemas/timestamp'
TickerData:
type: object
required:
- instrument_id
- symbol
- index_price
- mark_price
- last_price
- mid_price
- open_interest
- funding_rate
- next_funding
properties:
instrument_id:
$ref: '#/components/schemas/instrument_id'
symbol:
$ref: '#/components/schemas/symbol'
index_price:
$ref: '#/components/schemas/index_price'
mark_price:
$ref: '#/components/schemas/mark_price'
last_price:
$ref: '#/components/schemas/last_price'
mid_price:
$ref: '#/components/schemas/mid_price'
open_interest:
$ref: '#/components/schemas/open_interest'
funding_rate:
$ref: '#/components/schemas/funding_rate'
next_funding:
$ref: '#/components/schemas/next_funding'
timestamp:
type: integer
description: Timestamp in milliseconds
example: 1767225600000
Error429:
title: Error429
type: object
required:
- status
- error
properties:
status:
type: string
enum:
- err
error:
$ref: '#/components/schemas/error'
Error500:
title: Error500
type: object
required:
- status
- error
properties:
status:
type: string
enum:
- err
error:
$ref: '#/components/schemas/error'
symbol:
type: string
description: Instrument symbol
example: NVDA-USDC
index_price:
type: string
description: Index price
example: '100.00'
mark_price:
type: string
description: Mark price
example: '100.00'
last_price:
type: string
description: Last traded price
example: '100.00'
mid_price:
type: string
description: Mid price
example: '100.00'
open_interest:
type: string
description: Open interest in number of contracts
example: '10.00'
funding_rate:
type: string
description: Funding rate
example: '0.0001'
next_funding:
type: integer
description: Next funding timestamp in milliseconds
example: 1767225600000
error:
type: string
description: >-
Error identifier. For domain rejections and transport errors
(`401`/`404`/`429`/`500`) this is a stable, machine-readable snake_case
identifier that is part of the API contract and safe to branch on, e.g.
`insufficient_margin`, `insufficient_balance`, `order_not_found`,
`reduce_only_invalid`, `unauthorized`, `not_found`. For `400` it is a
human-readable validation detail whose wording may change. See the Error
handling guide for the domain identifiers. (Post-only / Fill-or-Kill
outcomes are order statuses such as `post_only_rejected`, not
rejections.)
example: insufficient_margin
responses:
Error429Response:
description: >
Too Many Requests. `error` distinguishes the limit that was hit:
`ip_rate_limited` (per-IP token bucket), `action_rate_limited`
(per-account
action rate), or `open_orders_limit` (resting open-order cap).
headers:
Retry-After:
description: >
Whole seconds to wait before retrying. Present only on token-bucket
rate-limit rejections (`ip_rate_limited` and `action_rate_limited`);
a
conservative estimate of when enough capacity will have refilled to
admit the request. Absent on `open_orders_limit`, which is a
capacity
limit, not a rate limit — waiting does not free order slots; cancel
resting orders or wait for fills instead.
schema:
type: integer
example: 2
content:
application/json:
schema:
$ref: '#/components/schemas/Error429'
Error500Response:
description: |
Internal server error. `error` is `internal_error`.
content:
application/json:
schema:
$ref: '#/components/schemas/Error500'
````
@@ -0,0 +1,325 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
> Use this file to discover all available pages before exploring further.
# Get Withdrawals
> Get withdrawal history for the authenticated account.
If no end time is provided, the current time will be used.
Maximum of 100 entries returned per request.
<Badge color="gray" size="md">Request Weight: **10**</Badge>
## OpenAPI
````yaml /api-spec/perps-openapi.json get /v1/account/withdrawals
openapi: 3.0.3
info:
title: Polymarket Perps HTTP API
version: 1.0.0
description: HTTP API for Polymarket perpetual trading system.
license:
name: Apache 2.0
url: https://www.apache.org/licenses/LICENSE-2.0.html
servers:
- url: https://api.perpetuals.polymarket.com
description: Production Perps HTTP API
security: []
paths:
/v1/account/withdrawals:
get:
summary: Get Withdrawals
description: |
Get withdrawal history for the authenticated account.
If no end time is provided, the current time will be used.
Maximum of 100 entries returned per request.
operationId: getWithdrawals
parameters:
- name: withdrawal_status
in: query
required: false
schema:
$ref: '#/components/schemas/withdrawal_status'
- name: hash
in: query
required: false
schema:
$ref: '#/components/schemas/hash'
- name: start_timestamp
in: query
required: false
schema:
$ref: '#/components/schemas/start_timestamp'
- name: end_timestamp
in: query
required: false
schema:
$ref: '#/components/schemas/end_timestamp'
responses:
'200':
description: Withdrawal history response.
content:
application/json:
schema:
$ref: '#/components/schemas/Withdrawals'
'400':
$ref: '#/components/responses/Error400Response'
'401':
$ref: '#/components/responses/Error401Response'
'429':
$ref: '#/components/responses/Error429Response'
'500':
$ref: '#/components/responses/Error500Response'
security:
- polymarket_proxy: []
polymarket_secret: []
components:
schemas:
withdrawal_status:
type: string
description: Withdrawal status
enum:
- pending
- confirmed
- removed
- failed
hash:
type: string
description: On-chain transaction hash, "0x" if not yet mined
default: 0x
example: '0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef'
start_timestamp:
type: integer
description: Start timestamp in milliseconds
example: 1767225600000
end_timestamp:
type: integer
description: End timestamp in milliseconds
example: 1767229200000
Withdrawals:
type: object
required:
- data
- more
properties:
data:
type: array
items:
$ref: '#/components/schemas/Withdrawal'
more:
$ref: '#/components/schemas/more'
Withdrawal:
type: object
required:
- withdraw_id
- asset
- amount
- fee
- status
- to
- hash
- confirmations
- required_confirmations
- created_timestamp
properties:
withdraw_id:
$ref: '#/components/schemas/withdraw_id'
asset:
$ref: '#/components/schemas/asset'
amount:
$ref: '#/components/schemas/amount'
to:
$ref: '#/components/schemas/to'
fee:
$ref: '#/components/schemas/withdrawal_fee'
status:
$ref: '#/components/schemas/withdrawal_status'
hash:
$ref: '#/components/schemas/hash'
confirmations:
$ref: '#/components/schemas/confirmations'
required_confirmations:
$ref: '#/components/schemas/required_confirmations'
created_timestamp:
$ref: '#/components/schemas/created_timestamp'
confirmed_timestamp:
$ref: '#/components/schemas/confirmed_timestamp'
more:
type: boolean
description: More data available
Error400:
title: Error400
type: object
required:
- status
- error
properties:
status:
type: string
enum:
- err
error:
$ref: '#/components/schemas/error'
Error401:
title: Error401
type: object
required:
- status
- error
properties:
status:
type: string
enum:
- err
error:
$ref: '#/components/schemas/error'
Error429:
title: Error429
type: object
required:
- status
- error
properties:
status:
type: string
enum:
- err
error:
$ref: '#/components/schemas/error'
Error500:
title: Error500
type: object
required:
- status
- error
properties:
status:
type: string
enum:
- err
error:
$ref: '#/components/schemas/error'
withdraw_id:
type: integer
description: Withdraw ID
asset:
type: string
description: Asset name
example: USDC
amount:
type: string
description: >-
Raw token amount including decimals. For withdrawals this matches the
uint256 amount in the EIP-712 signature (e.g. "100000000" for 100 USDC
with 6 decimals).
example: '100000000'
to:
type: string
description: Destination address in hex format
example: '0x1234567890abcdef1234567890abcdef12345678'
withdrawal_fee:
type: string
description: Withdrawal transaction fee in decimalized asset units
example: '5.00'
confirmations:
type: integer
description: Number of block confirmations
example: 12
required_confirmations:
type: integer
description: Required number of block confirmations
example: 12
created_timestamp:
type: integer
description: Creation timestamp in milliseconds
example: 1767225600000
confirmed_timestamp:
type: integer
description: Confirmation timestamp in milliseconds
example: 1767225600000
error:
type: string
description: >-
Error identifier. For domain rejections and transport errors
(`401`/`404`/`429`/`500`) this is a stable, machine-readable snake_case
identifier that is part of the API contract and safe to branch on, e.g.
`insufficient_margin`, `insufficient_balance`, `order_not_found`,
`reduce_only_invalid`, `unauthorized`, `not_found`. For `400` it is a
human-readable validation detail whose wording may change. See the Error
handling guide for the domain identifiers. (Post-only / Fill-or-Kill
outcomes are order statuses such as `post_only_rejected`, not
rejections.)
example: insufficient_margin
responses:
Error400Response:
description: |
Bad request — the request was malformed or failed validation (bad query
parameters, unparseable body, invalid signature, or a domain pre-check).
The `error` field is a human-readable validation detail.
content:
application/json:
schema:
$ref: '#/components/schemas/Error400'
Error401Response:
description: >
Unauthorized — missing or invalid `POLYMARKET-PROXY` /
`POLYMARKET-SECRET`
credentials. `error` is `unauthorized`.
content:
application/json:
schema:
$ref: '#/components/schemas/Error401'
Error429Response:
description: >
Too Many Requests. `error` distinguishes the limit that was hit:
`ip_rate_limited` (per-IP token bucket), `action_rate_limited`
(per-account
action rate), or `open_orders_limit` (resting open-order cap).
headers:
Retry-After:
description: >
Whole seconds to wait before retrying. Present only on token-bucket
rate-limit rejections (`ip_rate_limited` and `action_rate_limited`);
a
conservative estimate of when enough capacity will have refilled to
admit the request. Absent on `open_orders_limit`, which is a
capacity
limit, not a rate limit — waiting does not free order slots; cancel
resting orders or wait for fills instead.
schema:
type: integer
example: 2
content:
application/json:
schema:
$ref: '#/components/schemas/Error429'
Error500Response:
description: |
Internal server error. `error` is `internal_error`.
content:
application/json:
schema:
$ref: '#/components/schemas/Error500'
securitySchemes:
polymarket_proxy:
type: apiKey
name: POLYMARKET-PROXY
in: header
description: Proxy address
polymarket_secret:
type: apiKey
name: POLYMARKET-SECRET
in: header
description: Correponding proxy secret
````
@@ -0,0 +1,304 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
> Use this file to discover all available pages before exploring further.
# Internal Transfer
> Submit a signed internal ledger transfer between two exchange accounts.
Requires proxy signature using the standard signed-op flow.
<Badge color="gray" size="md">Request Weight: **1**</Badge>
## OpenAPI
````yaml /api-spec/perps-openapi.json post /v1/account/internal-transfer
openapi: 3.0.3
info:
title: Polymarket Perps HTTP API
version: 1.0.0
description: HTTP API for Polymarket perpetual trading system.
license:
name: Apache 2.0
url: https://www.apache.org/licenses/LICENSE-2.0.html
servers:
- url: https://api.perpetuals.polymarket.com
description: Production Perps HTTP API
security: []
paths:
/v1/account/internal-transfer:
post:
summary: Internal Transfer
description: |
Submit a signed internal ledger transfer between two exchange accounts.
Requires proxy signature using the standard signed-op flow.
operationId: internalTransfer
requestBody:
description: Internal transfer request.
content:
application/json:
schema:
$ref: '#/components/schemas/InternalTransferRequest'
examples:
transfer:
summary: Transfer USDC to another account
value:
op:
type: internalTransfer
args:
account: '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266'
token: '0xaf88d065e77c8cc2239327c5edb3a432268e5831'
amount: '100.00'
to: '0x70997970C51812dc3A010C7d01b50e0d17dc79C8'
sig: >-
0x5a6b7c8d9e0f1a2b3c4d5e6f7a8b9c0d1e2f3a4b5c6d7e8f9a0b1c2d3e4f5a6b7c8d9e0f1a2b3c4d5e6f7a8b9c0d1e2f3a4b5c6d7e8f9a0b1c2d3e4f5a1c
salt: 555555555
ts: 1767000014000
label: ops-rebalance
responses:
'200':
description: The accepted transfer, carrying its `transfer_id`.
content:
application/json:
schema:
$ref: '#/components/schemas/InternalTransferAccepted'
'400':
$ref: '#/components/responses/Error400Response'
'422':
description: |
The transfer was rejected on its merits (e.g. insufficient balance,
transfer to self). The body carries `transfer_id` and `error`.
content:
application/json:
schema:
$ref: '#/components/schemas/InternalTransferRejected'
'429':
$ref: '#/components/responses/Error429Response'
'500':
$ref: '#/components/responses/Error500Response'
security: []
components:
schemas:
InternalTransferRequest:
allOf:
- type: object
required:
- op
properties:
op:
$ref: '#/components/schemas/OpInternalTransfer'
- $ref: '#/components/schemas/BaseOp'
- type: object
properties:
label:
$ref: '#/components/schemas/label'
InternalTransferAccepted:
type: object
required:
- status
- transfer_id
properties:
status:
type: string
enum:
- ok
transfer_id:
$ref: '#/components/schemas/transfer_id'
InternalTransferRejected:
type: object
required:
- status
- transfer_id
- error
properties:
status:
type: string
enum:
- err
transfer_id:
$ref: '#/components/schemas/transfer_id'
error:
$ref: '#/components/schemas/error'
OpInternalTransfer:
type: object
required:
- type
- args
properties:
type:
type: string
enum:
- internalTransfer
args:
type: object
required:
- account
- token
- amount
- to
properties:
account:
$ref: '#/components/schemas/account'
token:
$ref: '#/components/schemas/token'
amount:
$ref: '#/components/schemas/amount'
to:
$ref: '#/components/schemas/to'
BaseOp:
type: object
required:
- sig
- salt
- ts
properties:
sig:
$ref: '#/components/schemas/sig'
salt:
$ref: '#/components/schemas/salt'
ts:
$ref: '#/components/schemas/ts'
label:
type: string
description: Human-readable label for a proxy key or internal transfer
example: trading-bot
transfer_id:
type: integer
description: Internal transfer ID
Error400:
title: Error400
type: object
required:
- status
- error
properties:
status:
type: string
enum:
- err
error:
$ref: '#/components/schemas/error'
error:
type: string
description: >-
Error identifier. For domain rejections and transport errors
(`401`/`404`/`429`/`500`) this is a stable, machine-readable snake_case
identifier that is part of the API contract and safe to branch on, e.g.
`insufficient_margin`, `insufficient_balance`, `order_not_found`,
`reduce_only_invalid`, `unauthorized`, `not_found`. For `400` it is a
human-readable validation detail whose wording may change. See the Error
handling guide for the domain identifiers. (Post-only / Fill-or-Kill
outcomes are order statuses such as `post_only_rejected`, not
rejections.)
example: insufficient_margin
Error429:
title: Error429
type: object
required:
- status
- error
properties:
status:
type: string
enum:
- err
error:
$ref: '#/components/schemas/error'
Error500:
title: Error500
type: object
required:
- status
- error
properties:
status:
type: string
enum:
- err
error:
$ref: '#/components/schemas/error'
account:
type: string
description: Account address in hex format
example: '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266'
token:
type: string
description: Token contract address in hex format
example: '0xaf88d065e77c8cc2239327c5edb3a432268e5831'
amount:
type: string
description: >-
Raw token amount including decimals. For withdrawals this matches the
uint256 amount in the EIP-712 signature (e.g. "100000000" for 100 USDC
with 6 decimals).
example: '100000000'
to:
type: string
description: Destination address in hex format
example: '0x1234567890abcdef1234567890abcdef12345678'
sig:
type: string
description: Signature in hex format
example: 0x1234567890...
salt:
type: integer
description: Salt
example: 1234567890
ts:
type: integer
description: >-
Request timestamp. Unix milliseconds for most operations; Unix seconds
for withdrawals (must match the on-chain EIP-712 struct verified against
block.timestamp).
example: 1767225600000
responses:
Error400Response:
description: |
Bad request — the request was malformed or failed validation (bad query
parameters, unparseable body, invalid signature, or a domain pre-check).
The `error` field is a human-readable validation detail.
content:
application/json:
schema:
$ref: '#/components/schemas/Error400'
Error429Response:
description: >
Too Many Requests. `error` distinguishes the limit that was hit:
`ip_rate_limited` (per-IP token bucket), `action_rate_limited`
(per-account
action rate), or `open_orders_limit` (resting open-order cap).
headers:
Retry-After:
description: >
Whole seconds to wait before retrying. Present only on token-bucket
rate-limit rejections (`ip_rate_limited` and `action_rate_limited`);
a
conservative estimate of when enough capacity will have refilled to
admit the request. Absent on `open_orders_limit`, which is a
capacity
limit, not a rate limit — waiting does not free order slots; cancel
resting orders or wait for fills instead.
schema:
type: integer
example: 2
content:
application/json:
schema:
$ref: '#/components/schemas/Error429'
Error500Response:
description: |
Internal server error. `error` is `internal_error`.
content:
application/json:
schema:
$ref: '#/components/schemas/Error500'
````
@@ -0,0 +1,59 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
> Use this file to discover all available pages before exploring further.
# Introduction
> Overview of the Polymarket APIs
The Polymarket API provides programmatic access to the world's largest prediction market. The platform is served by three separate APIs, each handling a different domain.
***
## APIs
<CardGroup cols={1}>
<Card title="Gamma API" icon="database">
**`https://gamma-api.polymarket.com`**
Markets, events, tags, series, comments, sports, search, and public profiles. This is the primary API for discovering and browsing market data.
</Card>
<Card title="Data API" icon="chart-line">
**`https://data-api.polymarket.com`**
User positions, trades, activity, holder data, open interest, leaderboards, and builder analytics.
</Card>
<Card title="CLOB API" icon="arrows-rotate">
**`https://clob.polymarket.com`**
Orderbook data, pricing, midpoints, spreads, and price history. Also handles order placement, cancellation, and other trading operations. Trading endpoints require [authentication](/api-reference/authentication).
</Card>
</CardGroup>
<Info>
A separate **Bridge API** (`https://bridge.polymarket.com`) handles deposits and withdrawals. Bridges are not handled by Polymarket, it is a proxy of fun.xyz service.
</Info>
***
## Authentication
The Gamma API and Data API are fully public — no authentication required.
The CLOB API has both public endpoints (orderbook, prices) and authenticated endpoints (order management). See [Authentication](/api-reference/authentication) for details.
***
## Next Steps
<CardGroup cols={2}>
<Card title="Authentication" icon="key" href="/api-reference/authentication">
Learn how to authenticate requests for trading endpoints.
</Card>
<Card title="Clients & SDKs" icon="cube" href="/api-reference/clients-sdks">
Official TypeScript, Python, and Rust libraries.
</Card>
</CardGroup>
@@ -0,0 +1,435 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
> Use this file to discover all available pages before exploring further.
# Cancel a quote
> Cancel an active maker quote before it is selected. Requires CLOB L2
authentication for the maker role. `signer_address` and `maker_address`
must match the authenticated identity.
## OpenAPI
````yaml /api-spec/combos-rfq-openapi.yaml post /v1/maker/quotes/cancel
openapi: 3.1.0
info:
title: Polymarket Combinatorial RFQ API
description: >
REST API for the combinatorial RFQ (Request for Quote) system.
This spec covers the publicly documented endpoints used by quoters (market
makers): the combo-market catalog and the authenticated maker commands for
submitting, cancelling, and confirming quotes.
Conventions:
- All `*_e6` fields are six-decimal fixed-point values encoded as
**strings**
to avoid number precision issues.
- All timestamps are **Unix milliseconds** (integer); zero/omitted means
unset.
- Errors return an HTTP status code with a body of the form `{ "error":
"..." }`.
license:
name: MIT
identifier: MIT
version: 1.0.0
servers:
- url: https://combos-rfq-api.polymarket.com
description: Production combinatorial RFQ API
security: []
tags:
- name: Combo Markets
description: Public catalog of markets that can be used as combo legs
- name: Maker
description: Authenticated quoter (maker) commands
paths:
/v1/maker/quotes/cancel:
post:
tags:
- Maker
summary: Cancel a quote
description: |
Cancel an active maker quote before it is selected. Requires CLOB L2
authentication for the maker role. `signer_address` and `maker_address`
must match the authenticated identity.
operationId: cancelMakerQuote
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/CancelQuoteRequest'
example:
rfq_id: rfq_<id>
quote_id: quote_<id>
signer_address: 0xYourSigner
maker_address: 0xYourQuoterWallet
signature_type: 0
responses:
'200':
description: Current RFQ snapshot after the cancellation was applied
content:
application/json:
schema:
$ref: '#/components/schemas/RFQSnapshot'
'400':
$ref: '#/components/responses/BadRequest'
'401':
$ref: '#/components/responses/Unauthorized'
'403':
$ref: '#/components/responses/Forbidden'
'404':
$ref: '#/components/responses/NotFound'
'409':
$ref: '#/components/responses/Conflict'
'429':
$ref: '#/components/responses/TooManyRequests'
'503':
$ref: '#/components/responses/ServiceUnavailable'
security:
- polyApiKey: []
polyAddress: []
polySignature: []
polyPassphrase: []
polyTimestamp: []
components:
schemas:
CancelQuoteRequest:
type: object
properties:
rfq_id:
type: string
example: rfq_<id>
quote_id:
type: string
example: quote_<id>
signer_address:
type: string
description: Must match the authenticated `signer_address`.
example: 0xYourSigner
maker_address:
type: string
description: Must match the authenticated `maker_address`.
example: 0xYourQuoterWallet
signature_type:
$ref: '#/components/schemas/SignatureType'
required:
- rfq_id
- quote_id
- signer_address
- maker_address
- signature_type
RFQSnapshot:
type: object
description: Point-in-time view of an RFQ and its competition/confirmation windows.
properties:
request:
$ref: '#/components/schemas/RFQRequest'
status:
$ref: '#/components/schemas/RFQStatus'
competition_started_at:
type: integer
format: int64
description: Unix milliseconds.
competition_ends_at:
type: integer
format: int64
description: Unix milliseconds.
confirmation_started_at:
type: integer
format: int64
description: Unix milliseconds.
confirmation_ends_at:
type: integer
format: int64
description: Unix milliseconds.
quote_id:
type: string
bundle:
$ref: '#/components/schemas/FillBundle'
maker_confirmations:
type: array
items:
$ref: '#/components/schemas/MakerConfirmationSnapshot'
required:
- request
- status
SignatureType:
type: integer
description: |
CLOB signature type:
- `0` EOA
- `1` POLY_PROXY
- `2` GNOSIS_SAFE
- `3` POLY_1271
enum:
- 0
- 1
- 2
- 3
example: 0
RFQRequest:
type: object
description: The RFQ request as stored by the engine.
properties:
rfq_id:
type: string
auth_address:
type: string
signer_address:
type: string
maker_address:
type: string
signature_type:
$ref: '#/components/schemas/SignatureType'
requestor_public_id:
type: string
leg_position_ids:
type: array
items:
type: string
condition_id:
type: string
yes_position_id:
type: string
no_position_id:
type: string
direction:
$ref: '#/components/schemas/Direction'
side:
$ref: '#/components/schemas/Side'
requested_size:
$ref: '#/components/schemas/RequestedSize'
created_at:
type: integer
format: int64
description: Creation time in Unix milliseconds.
required:
- rfq_id
- leg_position_ids
- direction
- side
RFQStatus:
type: string
description: Lifecycle status of the RFQ
enum:
- CREATED
- COLLECTING_QUOTES
- AWAITING_REQUESTER_ACCEPTANCE
- AWAITING_MAKER_CONFIRMATION
- EXECUTING
- FILLED
- FAILED
- EXPIRED
- CANCELED
- REJECTED
FillBundle:
type: object
description: The selected executable bundle of maker allocations.
properties:
requested_shares_e6:
type: string
description: Requested share size in six-decimal fixed-point units.
requested_notional_e6:
type: string
description: Requested notional in six-decimal fixed-point units (BUY RFQs only).
blended_price_e6:
type: string
description: Blended bundle price in six-decimal fixed-point units.
allocations:
type: array
items:
$ref: '#/components/schemas/FillAllocation'
required:
- requested_shares_e6
- blended_price_e6
- allocations
MakerConfirmationSnapshot:
type: object
properties:
quote_id:
type: string
signer_address:
type: string
maker_address:
type: string
decision:
type: string
enum:
- CONFIRM
- DECLINE
- TIMED_OUT
reason:
type: string
responded_at:
type: integer
format: int64
description: Response time in Unix milliseconds.
required:
- quote_id
- signer_address
- maker_address
ErrorResponse:
type: object
properties:
error:
type: string
description: Human-readable error detail
required:
- error
Direction:
type: string
description: Requester trade direction
enum:
- BUY
- SELL
Side:
type: string
description: Combinatorial position side. Currently only `YES` is supported.
enum:
- 'YES'
- 'NO'
RequestedSize:
type: object
description: Requested RFQ size and unit
properties:
unit:
type: string
description: >
`notional` for requester BUY RFQs and `shares` for requester SELL
RFQs.
enum:
- notional
- shares
value_e6:
type: string
description: Six-decimal fixed-point value encoded as a string.
example: '1000000'
required:
- unit
- value_e6
FillAllocation:
type: object
properties:
maker_quote_id:
type: string
signer_address:
type: string
maker_address:
type: string
size_e6:
type: string
description: >-
Accepted fill size for this maker quote, in six-decimal fixed-point
units.
price_e6:
type: string
description: Fill price in six-decimal fixed-point units.
received_at:
type: integer
format: int64
description: Receipt time in Unix milliseconds.
required:
- maker_quote_id
- signer_address
- maker_address
- size_e6
- price_e6
responses:
BadRequest:
description: >-
Invalid request (malformed JSON, invalid parameters, or failed
validation)
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
example:
error: invalid quote
Unauthorized:
description: Missing or invalid CLOB L2 authentication
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
example:
error: unauthenticated
Forbidden:
description: >-
Authenticated identity does not match the request, or role is not
allowed
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
example:
error: auth address mismatch
NotFound:
description: The referenced RFQ is not active or no longer exists
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
example:
error: unknown rfq
Conflict:
description: The RFQ is not in a state that accepts this command
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
example:
error: competition window closed
TooManyRequests:
description: Rate limited
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
example:
error: rate limited
ServiceUnavailable:
description: An RFQ service dependency is temporarily unavailable
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
example:
error: service unavailable
securitySchemes:
polyApiKey:
type: apiKey
in: header
name: POLY_API_KEY
description: CLOB API key
polyAddress:
type: apiKey
in: header
name: POLY_ADDRESS
description: Wallet address associated with the API key
polySignature:
type: apiKey
in: header
name: POLY_SIGNATURE
description: HMAC-SHA256 signature of the request
polyPassphrase:
type: apiKey
in: header
name: POLY_PASSPHRASE
description: CLOB API key passphrase
polyTimestamp:
type: apiKey
in: header
name: POLY_TIMESTAMP
description: Unix timestamp of the request
````
@@ -0,0 +1,669 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
> Use this file to discover all available pages before exploring further.
# Confirm or decline last look
> Respond to a last-look confirmation request for a selected quote. Requires
CLOB L2 authentication for the maker role. `decision` must be `CONFIRM` or
`DECLINE`.
## OpenAPI
````yaml /api-spec/combos-rfq-openapi.yaml post /v1/maker/confirmations
openapi: 3.1.0
info:
title: Polymarket Combinatorial RFQ API
description: >
REST API for the combinatorial RFQ (Request for Quote) system.
This spec covers the publicly documented endpoints used by quoters (market
makers): the combo-market catalog and the authenticated maker commands for
submitting, cancelling, and confirming quotes.
Conventions:
- All `*_e6` fields are six-decimal fixed-point values encoded as
**strings**
to avoid number precision issues.
- All timestamps are **Unix milliseconds** (integer); zero/omitted means
unset.
- Errors return an HTTP status code with a body of the form `{ "error":
"..." }`.
license:
name: MIT
identifier: MIT
version: 1.0.0
servers:
- url: https://combos-rfq-api.polymarket.com
description: Production combinatorial RFQ API
security: []
tags:
- name: Combo Markets
description: Public catalog of markets that can be used as combo legs
- name: Maker
description: Authenticated quoter (maker) commands
paths:
/v1/maker/confirmations:
post:
tags:
- Maker
summary: Confirm or decline last look
description: >
Respond to a last-look confirmation request for a selected quote.
Requires
CLOB L2 authentication for the maker role. `decision` must be `CONFIRM`
or
`DECLINE`.
operationId: submitMakerConfirmation
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/MakerConfirmationRequest'
example:
rfq_id: rfq_<id>
quote_id: quote_<id>
signer_address: 0xYourSigner
maker_address: 0xYourQuoterWallet
signature_type: 0
decision: CONFIRM
responses:
'200':
description: Result of the confirmation — a snapshot and/or an execution handoff
content:
application/json:
schema:
$ref: '#/components/schemas/MakerConfirmationResult'
'400':
$ref: '#/components/responses/BadRequest'
'401':
$ref: '#/components/responses/Unauthorized'
'403':
$ref: '#/components/responses/Forbidden'
'404':
$ref: '#/components/responses/NotFound'
'409':
$ref: '#/components/responses/Conflict'
'429':
$ref: '#/components/responses/TooManyRequests'
'503':
$ref: '#/components/responses/ServiceUnavailable'
security:
- polyApiKey: []
polyAddress: []
polySignature: []
polyPassphrase: []
polyTimestamp: []
components:
schemas:
MakerConfirmationRequest:
type: object
description: Maker last-look confirmation response.
properties:
rfq_id:
type: string
example: rfq_<id>
quote_id:
type: string
example: quote_<id>
signer_address:
type: string
example: 0xYourSigner
maker_address:
type: string
example: 0xYourQuoterWallet
signature_type:
$ref: '#/components/schemas/SignatureType'
decision:
type: string
description: Confirmation decision.
enum:
- CONFIRM
- DECLINE
required:
- rfq_id
- quote_id
- signer_address
- maker_address
- signature_type
- decision
MakerConfirmationResult:
type: object
description: >
Result of a maker confirmation. Includes a snapshot, an execution
handoff,
or both, depending on whether the confirmation completed the bundle.
properties:
snapshot:
$ref: '#/components/schemas/RFQSnapshot'
execution:
$ref: '#/components/schemas/ExecutionHandoff'
SignatureType:
type: integer
description: |
CLOB signature type:
- `0` EOA
- `1` POLY_PROXY
- `2` GNOSIS_SAFE
- `3` POLY_1271
enum:
- 0
- 1
- 2
- 3
example: 0
RFQSnapshot:
type: object
description: Point-in-time view of an RFQ and its competition/confirmation windows.
properties:
request:
$ref: '#/components/schemas/RFQRequest'
status:
$ref: '#/components/schemas/RFQStatus'
competition_started_at:
type: integer
format: int64
description: Unix milliseconds.
competition_ends_at:
type: integer
format: int64
description: Unix milliseconds.
confirmation_started_at:
type: integer
format: int64
description: Unix milliseconds.
confirmation_ends_at:
type: integer
format: int64
description: Unix milliseconds.
quote_id:
type: string
bundle:
$ref: '#/components/schemas/FillBundle'
maker_confirmations:
type: array
items:
$ref: '#/components/schemas/MakerConfirmationSnapshot'
required:
- request
- status
ExecutionHandoff:
type: object
description: Handoff produced when a confirmed RFQ is ready for onchain execution.
properties:
execution_id:
type: string
request:
$ref: '#/components/schemas/RFQRequest'
quote_id:
type: string
bundle:
$ref: '#/components/schemas/FillBundle'
requester_acceptance:
$ref: '#/components/schemas/RequesterAcceptance'
maker_quotes:
type: array
items:
$ref: '#/components/schemas/Quote'
reservations:
type: array
items:
$ref: '#/components/schemas/WalletReservation'
ready_at:
type: integer
format: int64
description: Unix milliseconds.
required:
- execution_id
- request
- quote_id
- bundle
- requester_acceptance
- maker_quotes
ErrorResponse:
type: object
properties:
error:
type: string
description: Human-readable error detail
required:
- error
RFQRequest:
type: object
description: The RFQ request as stored by the engine.
properties:
rfq_id:
type: string
auth_address:
type: string
signer_address:
type: string
maker_address:
type: string
signature_type:
$ref: '#/components/schemas/SignatureType'
requestor_public_id:
type: string
leg_position_ids:
type: array
items:
type: string
condition_id:
type: string
yes_position_id:
type: string
no_position_id:
type: string
direction:
$ref: '#/components/schemas/Direction'
side:
$ref: '#/components/schemas/Side'
requested_size:
$ref: '#/components/schemas/RequestedSize'
created_at:
type: integer
format: int64
description: Creation time in Unix milliseconds.
required:
- rfq_id
- leg_position_ids
- direction
- side
RFQStatus:
type: string
description: Lifecycle status of the RFQ
enum:
- CREATED
- COLLECTING_QUOTES
- AWAITING_REQUESTER_ACCEPTANCE
- AWAITING_MAKER_CONFIRMATION
- EXECUTING
- FILLED
- FAILED
- EXPIRED
- CANCELED
- REJECTED
FillBundle:
type: object
description: The selected executable bundle of maker allocations.
properties:
requested_shares_e6:
type: string
description: Requested share size in six-decimal fixed-point units.
requested_notional_e6:
type: string
description: Requested notional in six-decimal fixed-point units (BUY RFQs only).
blended_price_e6:
type: string
description: Blended bundle price in six-decimal fixed-point units.
allocations:
type: array
items:
$ref: '#/components/schemas/FillAllocation'
required:
- requested_shares_e6
- blended_price_e6
- allocations
MakerConfirmationSnapshot:
type: object
properties:
quote_id:
type: string
signer_address:
type: string
maker_address:
type: string
decision:
type: string
enum:
- CONFIRM
- DECLINE
- TIMED_OUT
reason:
type: string
responded_at:
type: integer
format: int64
description: Response time in Unix milliseconds.
required:
- quote_id
- signer_address
- maker_address
RequesterAcceptance:
type: object
properties:
rfq_id:
type: string
quote_id:
type: string
auth_address:
type: string
signer_address:
type: string
maker_address:
type: string
signature_type:
$ref: '#/components/schemas/SignatureType'
signed_order:
$ref: '#/components/schemas/ExchangeV3Order'
accepted_at:
type: integer
format: int64
description: Unix milliseconds.
required:
- rfq_id
- quote_id
- signed_order
Quote:
type: object
description: A signed maker quote.
properties:
quote_id:
type: string
description: Maker-generated quote ID (required for REST submissions).
example: quote_<id>
rfq_id:
type: string
description: RFQ ID from the `RFQ_REQUEST`.
example: rfq_<id>
auth_address:
type: string
description: Derived from the authenticated session; ignored if provided.
readOnly: true
signer_address:
type: string
example: 0xYourSigner
maker_address:
type: string
example: 0xYourQuoterWallet
signature_type:
$ref: '#/components/schemas/SignatureType'
price_e6:
type: string
description: Quote price in six-decimal fixed-point units (must be positive).
example: '450000'
size_e6:
type: string
description: >
Fillable share count in six-decimal fixed-point units (must be
positive).
Note this differs from the request's size field, which may be
notional or shares.
example: '1000000'
valid_until:
type: integer
format: int64
description: Optional quote expiry in Unix milliseconds.
signed_order:
$ref: '#/components/schemas/ExchangeV3Order'
received_at:
type: integer
format: int64
description: Server-assigned receipt time in Unix milliseconds.
readOnly: true
required:
- quote_id
- rfq_id
- signer_address
- maker_address
- signature_type
- price_e6
- size_e6
- signed_order
WalletReservation:
type: object
properties:
action_id:
type: string
user:
type: string
wallet_nonce:
type: integer
format: int64
deltas:
type: array
items:
$ref: '#/components/schemas/WalletAssetDelta'
required:
- action_id
- user
- wallet_nonce
- deltas
Direction:
type: string
description: Requester trade direction
enum:
- BUY
- SELL
Side:
type: string
description: Combinatorial position side. Currently only `YES` is supported.
enum:
- 'YES'
- 'NO'
RequestedSize:
type: object
description: Requested RFQ size and unit
properties:
unit:
type: string
description: >
`notional` for requester BUY RFQs and `shares` for requester SELL
RFQs.
enum:
- notional
- shares
value_e6:
type: string
description: Six-decimal fixed-point value encoded as a string.
example: '1000000'
required:
- unit
- value_e6
FillAllocation:
type: object
properties:
maker_quote_id:
type: string
signer_address:
type: string
maker_address:
type: string
size_e6:
type: string
description: >-
Accepted fill size for this maker quote, in six-decimal fixed-point
units.
price_e6:
type: string
description: Fill price in six-decimal fixed-point units.
received_at:
type: integer
format: int64
description: Receipt time in Unix milliseconds.
required:
- maker_quote_id
- signer_address
- maker_address
- size_e6
- price_e6
ExchangeV3Order:
type: object
description: >-
Signed Exchange v3 order. Combinatorial RFQ trades settle through
Exchange v3.
properties:
salt:
type: string
description: Order salt (uint256 as a decimal string)
maker:
type: string
description: Wallet that funds the order
example: 0xYourQuoterWallet
signer:
type: string
description: Address that signs the order
example: 0xYourSigner
tokenId:
type: string
description: YES or NO combo position ID (uint256 as a decimal string)
makerAmount:
type: string
description: >-
Amount the maker pays, in six-decimal base units (uint256 as a
string)
takerAmount:
type: string
description: >-
Amount the maker receives, in six-decimal base units (uint256 as a
string)
side:
type: integer
description: Order side — `0` BUY, `1` SELL
enum:
- 0
- 1
signatureType:
$ref: '#/components/schemas/SignatureType'
timestamp:
type: string
description: Order timestamp in Unix seconds (as a string)
metadata:
type: string
description: 32-byte hex field; defaults to the zero value
example: '0x0000000000000000000000000000000000000000000000000000000000000000'
builder:
type: string
description: 32-byte hex field; defaults to the zero value
example: '0x0000000000000000000000000000000000000000000000000000000000000000'
signature:
type: string
description: EIP-712 signature over the order
example: 0x...
required:
- salt
- maker
- signer
- tokenId
- makerAmount
- takerAmount
- side
- signatureType
- timestamp
- signature
WalletAssetDelta:
type: object
properties:
asset:
type: string
asset_id:
type: string
amount:
type: string
required:
- asset
- asset_id
- amount
responses:
BadRequest:
description: >-
Invalid request (malformed JSON, invalid parameters, or failed
validation)
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
example:
error: invalid quote
Unauthorized:
description: Missing or invalid CLOB L2 authentication
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
example:
error: unauthenticated
Forbidden:
description: >-
Authenticated identity does not match the request, or role is not
allowed
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
example:
error: auth address mismatch
NotFound:
description: The referenced RFQ is not active or no longer exists
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
example:
error: unknown rfq
Conflict:
description: The RFQ is not in a state that accepts this command
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
example:
error: competition window closed
TooManyRequests:
description: Rate limited
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
example:
error: rate limited
ServiceUnavailable:
description: An RFQ service dependency is temporarily unavailable
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
example:
error: service unavailable
securitySchemes:
polyApiKey:
type: apiKey
in: header
name: POLY_API_KEY
description: CLOB API key
polyAddress:
type: apiKey
in: header
name: POLY_ADDRESS
description: Wallet address associated with the API key
polySignature:
type: apiKey
in: header
name: POLY_SIGNATURE
description: HMAC-SHA256 signature of the request
polyPassphrase:
type: apiKey
in: header
name: POLY_PASSPHRASE
description: CLOB API key passphrase
polyTimestamp:
type: apiKey
in: header
name: POLY_TIMESTAMP
description: Unix timestamp of the request
````
@@ -0,0 +1,550 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
> Use this file to discover all available pages before exploring further.
# Submit a quote
> Submit a signed maker quote for an active RFQ. Requires CLOB L2
authentication for the maker role.
REST does not assign a quote ID — generate `quote_id` client-side.
## OpenAPI
````yaml /api-spec/combos-rfq-openapi.yaml post /v1/maker/quotes
openapi: 3.1.0
info:
title: Polymarket Combinatorial RFQ API
description: >
REST API for the combinatorial RFQ (Request for Quote) system.
This spec covers the publicly documented endpoints used by quoters (market
makers): the combo-market catalog and the authenticated maker commands for
submitting, cancelling, and confirming quotes.
Conventions:
- All `*_e6` fields are six-decimal fixed-point values encoded as
**strings**
to avoid number precision issues.
- All timestamps are **Unix milliseconds** (integer); zero/omitted means
unset.
- Errors return an HTTP status code with a body of the form `{ "error":
"..." }`.
license:
name: MIT
identifier: MIT
version: 1.0.0
servers:
- url: https://combos-rfq-api.polymarket.com
description: Production combinatorial RFQ API
security: []
tags:
- name: Combo Markets
description: Public catalog of markets that can be used as combo legs
- name: Maker
description: Authenticated quoter (maker) commands
paths:
/v1/maker/quotes:
post:
tags:
- Maker
summary: Submit a quote
description: |
Submit a signed maker quote for an active RFQ. Requires CLOB L2
authentication for the maker role.
REST does not assign a quote ID — generate `quote_id` client-side.
operationId: submitMakerQuote
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/Quote'
example:
quote_id: quote_<id>
rfq_id: rfq_<id>
signer_address: 0xYourSigner
maker_address: 0xYourQuoterWallet
signature_type: 0
price_e6: '450000'
size_e6: '1000000'
signed_order:
salt: <order_salt>
maker: 0xYourQuoterWallet
signer: 0xYourSigner
tokenId: <yes_or_no_position_id>
makerAmount: <amount_to_pay>
takerAmount: <taker_amount>
side: 0
signatureType: 0
timestamp: <unix_seconds>
metadata: >-
0x0000000000000000000000000000000000000000000000000000000000000000
builder: >-
0x0000000000000000000000000000000000000000000000000000000000000000
signature: 0x...
responses:
'200':
description: Current RFQ snapshot after the quote was accepted
content:
application/json:
schema:
$ref: '#/components/schemas/RFQSnapshot'
'400':
$ref: '#/components/responses/BadRequest'
'401':
$ref: '#/components/responses/Unauthorized'
'403':
$ref: '#/components/responses/Forbidden'
'404':
$ref: '#/components/responses/NotFound'
'409':
$ref: '#/components/responses/Conflict'
'429':
$ref: '#/components/responses/TooManyRequests'
'503':
$ref: '#/components/responses/ServiceUnavailable'
security:
- polyApiKey: []
polyAddress: []
polySignature: []
polyPassphrase: []
polyTimestamp: []
components:
schemas:
Quote:
type: object
description: A signed maker quote.
properties:
quote_id:
type: string
description: Maker-generated quote ID (required for REST submissions).
example: quote_<id>
rfq_id:
type: string
description: RFQ ID from the `RFQ_REQUEST`.
example: rfq_<id>
auth_address:
type: string
description: Derived from the authenticated session; ignored if provided.
readOnly: true
signer_address:
type: string
example: 0xYourSigner
maker_address:
type: string
example: 0xYourQuoterWallet
signature_type:
$ref: '#/components/schemas/SignatureType'
price_e6:
type: string
description: Quote price in six-decimal fixed-point units (must be positive).
example: '450000'
size_e6:
type: string
description: >
Fillable share count in six-decimal fixed-point units (must be
positive).
Note this differs from the request's size field, which may be
notional or shares.
example: '1000000'
valid_until:
type: integer
format: int64
description: Optional quote expiry in Unix milliseconds.
signed_order:
$ref: '#/components/schemas/ExchangeV3Order'
received_at:
type: integer
format: int64
description: Server-assigned receipt time in Unix milliseconds.
readOnly: true
required:
- quote_id
- rfq_id
- signer_address
- maker_address
- signature_type
- price_e6
- size_e6
- signed_order
RFQSnapshot:
type: object
description: Point-in-time view of an RFQ and its competition/confirmation windows.
properties:
request:
$ref: '#/components/schemas/RFQRequest'
status:
$ref: '#/components/schemas/RFQStatus'
competition_started_at:
type: integer
format: int64
description: Unix milliseconds.
competition_ends_at:
type: integer
format: int64
description: Unix milliseconds.
confirmation_started_at:
type: integer
format: int64
description: Unix milliseconds.
confirmation_ends_at:
type: integer
format: int64
description: Unix milliseconds.
quote_id:
type: string
bundle:
$ref: '#/components/schemas/FillBundle'
maker_confirmations:
type: array
items:
$ref: '#/components/schemas/MakerConfirmationSnapshot'
required:
- request
- status
SignatureType:
type: integer
description: |
CLOB signature type:
- `0` EOA
- `1` POLY_PROXY
- `2` GNOSIS_SAFE
- `3` POLY_1271
enum:
- 0
- 1
- 2
- 3
example: 0
ExchangeV3Order:
type: object
description: >-
Signed Exchange v3 order. Combinatorial RFQ trades settle through
Exchange v3.
properties:
salt:
type: string
description: Order salt (uint256 as a decimal string)
maker:
type: string
description: Wallet that funds the order
example: 0xYourQuoterWallet
signer:
type: string
description: Address that signs the order
example: 0xYourSigner
tokenId:
type: string
description: YES or NO combo position ID (uint256 as a decimal string)
makerAmount:
type: string
description: >-
Amount the maker pays, in six-decimal base units (uint256 as a
string)
takerAmount:
type: string
description: >-
Amount the maker receives, in six-decimal base units (uint256 as a
string)
side:
type: integer
description: Order side — `0` BUY, `1` SELL
enum:
- 0
- 1
signatureType:
$ref: '#/components/schemas/SignatureType'
timestamp:
type: string
description: Order timestamp in Unix seconds (as a string)
metadata:
type: string
description: 32-byte hex field; defaults to the zero value
example: '0x0000000000000000000000000000000000000000000000000000000000000000'
builder:
type: string
description: 32-byte hex field; defaults to the zero value
example: '0x0000000000000000000000000000000000000000000000000000000000000000'
signature:
type: string
description: EIP-712 signature over the order
example: 0x...
required:
- salt
- maker
- signer
- tokenId
- makerAmount
- takerAmount
- side
- signatureType
- timestamp
- signature
RFQRequest:
type: object
description: The RFQ request as stored by the engine.
properties:
rfq_id:
type: string
auth_address:
type: string
signer_address:
type: string
maker_address:
type: string
signature_type:
$ref: '#/components/schemas/SignatureType'
requestor_public_id:
type: string
leg_position_ids:
type: array
items:
type: string
condition_id:
type: string
yes_position_id:
type: string
no_position_id:
type: string
direction:
$ref: '#/components/schemas/Direction'
side:
$ref: '#/components/schemas/Side'
requested_size:
$ref: '#/components/schemas/RequestedSize'
created_at:
type: integer
format: int64
description: Creation time in Unix milliseconds.
required:
- rfq_id
- leg_position_ids
- direction
- side
RFQStatus:
type: string
description: Lifecycle status of the RFQ
enum:
- CREATED
- COLLECTING_QUOTES
- AWAITING_REQUESTER_ACCEPTANCE
- AWAITING_MAKER_CONFIRMATION
- EXECUTING
- FILLED
- FAILED
- EXPIRED
- CANCELED
- REJECTED
FillBundle:
type: object
description: The selected executable bundle of maker allocations.
properties:
requested_shares_e6:
type: string
description: Requested share size in six-decimal fixed-point units.
requested_notional_e6:
type: string
description: Requested notional in six-decimal fixed-point units (BUY RFQs only).
blended_price_e6:
type: string
description: Blended bundle price in six-decimal fixed-point units.
allocations:
type: array
items:
$ref: '#/components/schemas/FillAllocation'
required:
- requested_shares_e6
- blended_price_e6
- allocations
MakerConfirmationSnapshot:
type: object
properties:
quote_id:
type: string
signer_address:
type: string
maker_address:
type: string
decision:
type: string
enum:
- CONFIRM
- DECLINE
- TIMED_OUT
reason:
type: string
responded_at:
type: integer
format: int64
description: Response time in Unix milliseconds.
required:
- quote_id
- signer_address
- maker_address
ErrorResponse:
type: object
properties:
error:
type: string
description: Human-readable error detail
required:
- error
Direction:
type: string
description: Requester trade direction
enum:
- BUY
- SELL
Side:
type: string
description: Combinatorial position side. Currently only `YES` is supported.
enum:
- 'YES'
- 'NO'
RequestedSize:
type: object
description: Requested RFQ size and unit
properties:
unit:
type: string
description: >
`notional` for requester BUY RFQs and `shares` for requester SELL
RFQs.
enum:
- notional
- shares
value_e6:
type: string
description: Six-decimal fixed-point value encoded as a string.
example: '1000000'
required:
- unit
- value_e6
FillAllocation:
type: object
properties:
maker_quote_id:
type: string
signer_address:
type: string
maker_address:
type: string
size_e6:
type: string
description: >-
Accepted fill size for this maker quote, in six-decimal fixed-point
units.
price_e6:
type: string
description: Fill price in six-decimal fixed-point units.
received_at:
type: integer
format: int64
description: Receipt time in Unix milliseconds.
required:
- maker_quote_id
- signer_address
- maker_address
- size_e6
- price_e6
responses:
BadRequest:
description: >-
Invalid request (malformed JSON, invalid parameters, or failed
validation)
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
example:
error: invalid quote
Unauthorized:
description: Missing or invalid CLOB L2 authentication
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
example:
error: unauthenticated
Forbidden:
description: >-
Authenticated identity does not match the request, or role is not
allowed
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
example:
error: auth address mismatch
NotFound:
description: The referenced RFQ is not active or no longer exists
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
example:
error: unknown rfq
Conflict:
description: The RFQ is not in a state that accepts this command
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
example:
error: competition window closed
TooManyRequests:
description: Rate limited
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
example:
error: rate limited
ServiceUnavailable:
description: An RFQ service dependency is temporarily unavailable
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
example:
error: service unavailable
securitySchemes:
polyApiKey:
type: apiKey
in: header
name: POLY_API_KEY
description: CLOB API key
polyAddress:
type: apiKey
in: header
name: POLY_ADDRESS
description: Wallet address associated with the API key
polySignature:
type: apiKey
in: header
name: POLY_SIGNATURE
description: HMAC-SHA256 signature of the request
polyPassphrase:
type: apiKey
in: header
name: POLY_PASSPHRASE
description: CLOB API key passphrase
polyTimestamp:
type: apiKey
in: header
name: POLY_TIMESTAMP
description: Unix timestamp of the request
````
@@ -0,0 +1,121 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
> Use this file to discover all available pages before exploring further.
# Get fee rate by path parameter
> Retrieves the base fee rate for a specific token ID using the token ID as a path parameter.
## OpenAPI
````yaml /api-spec/clob-openapi.yaml get /fee-rate/{token_id}
openapi: 3.1.0
info:
title: Polymarket CLOB API
description: Polymarket CLOB API Reference
license:
name: MIT
identifier: MIT
version: 1.0.0
servers:
- url: https://clob.polymarket.com
description: Production CLOB API
- url: https://clob-staging.polymarket.com
description: Staging CLOB API
security: []
tags:
- name: Trade
description: Trade endpoints
- name: Markets
description: Market data endpoints
- name: Account
description: Account and authentication endpoints
- name: Notifications
description: User notification endpoints
- name: Rewards
description: Rewards and earnings endpoints
- name: Rebates
description: Maker rebate endpoints
paths:
/fee-rate/{token_id}:
get:
tags:
- Market Data
summary: Get fee rate by path parameter
description: >
Retrieves the base fee rate for a specific token ID using the token ID
as a path parameter.
operationId: getFeeRateByPath
parameters:
- name: token_id
in: path
description: Token ID (asset ID)
required: true
schema:
type: string
example: 0xabc123def456...
responses:
'200':
description: Successfully retrieved fee rate
content:
application/json:
schema:
$ref: '#/components/schemas/FeeRate'
example:
base_fee: 30
'400':
description: Bad request - Invalid token id
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
example:
error: Invalid token id
'404':
description: Not found - Fee rate not found for market
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
example:
error: fee rate not found for market
'500':
description: Internal server error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
example:
error: Internal server error
security: []
components:
schemas:
FeeRate:
type: object
required:
- base_fee
properties:
base_fee:
type: integer
format: int64
description: Base fee in basis points
example: 30
ErrorResponse:
type: object
required:
- error
properties:
error:
type: string
description: Error message
code:
type: string
description: Machine-readable error code, when provided
retry_after_seconds:
type: integer
description: Number of seconds to wait before retrying, when provided
````
@@ -0,0 +1,124 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
> Use this file to discover all available pages before exploring further.
# Get fee rate
> Retrieves the base fee rate for a specific token ID.
The fee rate can be provided either as a query parameter or as a path parameter.
## OpenAPI
````yaml /api-spec/clob-openapi.yaml get /fee-rate
openapi: 3.1.0
info:
title: Polymarket CLOB API
description: Polymarket CLOB API Reference
license:
name: MIT
identifier: MIT
version: 1.0.0
servers:
- url: https://clob.polymarket.com
description: Production CLOB API
- url: https://clob-staging.polymarket.com
description: Staging CLOB API
security: []
tags:
- name: Trade
description: Trade endpoints
- name: Markets
description: Market data endpoints
- name: Account
description: Account and authentication endpoints
- name: Notifications
description: User notification endpoints
- name: Rewards
description: Rewards and earnings endpoints
- name: Rebates
description: Maker rebate endpoints
paths:
/fee-rate:
get:
tags:
- Market Data
summary: Get fee rate
description: >
Retrieves the base fee rate for a specific token ID.
The fee rate can be provided either as a query parameter or as a path
parameter.
operationId: getFeeRate
parameters:
- name: token_id
in: query
description: Token ID (asset ID)
required: false
schema:
type: string
example: 0xabc123def456...
responses:
'200':
description: Successfully retrieved fee rate
content:
application/json:
schema:
$ref: '#/components/schemas/FeeRate'
example:
base_fee: 30
'400':
description: Bad request - Invalid token id
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
example:
error: Invalid token id
'404':
description: Not found - Fee rate not found for market
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
example:
error: fee rate not found for market
'500':
description: Internal server error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
example:
error: Internal server error
security: []
components:
schemas:
FeeRate:
type: object
required:
- base_fee
properties:
base_fee:
type: integer
format: int64
description: Base fee in basis points
example: 30
ErrorResponse:
type: object
required:
- error
properties:
error:
type: string
description: Error message
code:
type: string
description: Machine-readable error code, when provided
retry_after_seconds:
type: integer
description: Number of seconds to wait before retrying, when provided
````
@@ -0,0 +1,120 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
> Use this file to discover all available pages before exploring further.
# Get last trade price
> Retrieves the last trade price and side for a specific token ID.
Returns default values of "0.5" for price and empty string for side if no trades found.
## OpenAPI
````yaml /api-spec/clob-openapi.yaml get /last-trade-price
openapi: 3.1.0
info:
title: Polymarket CLOB API
description: Polymarket CLOB API Reference
license:
name: MIT
identifier: MIT
version: 1.0.0
servers:
- url: https://clob.polymarket.com
description: Production CLOB API
- url: https://clob-staging.polymarket.com
description: Staging CLOB API
security: []
tags:
- name: Trade
description: Trade endpoints
- name: Markets
description: Market data endpoints
- name: Account
description: Account and authentication endpoints
- name: Notifications
description: User notification endpoints
- name: Rewards
description: Rewards and earnings endpoints
- name: Rebates
description: Maker rebate endpoints
paths:
/last-trade-price:
get:
tags:
- Market Data
summary: Get last trade price
description: >
Retrieves the last trade price and side for a specific token ID.
Returns default values of "0.5" for price and empty string for side if
no trades found.
operationId: getLastTradePrice
parameters:
- name: token_id
in: query
description: Token ID (asset ID)
required: true
schema:
type: string
example: 0xabc123def456...
responses:
'200':
description: Successfully retrieved last trade price
content:
application/json:
schema:
type: object
required:
- price
- side
properties:
price:
type: string
description: Last trade price
example: '0.45'
side:
type: string
description: Last trade side (BUY or SELL)
enum:
- BUY
- SELL
- ''
example: BUY
'400':
description: Bad request - Invalid token id
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
example:
error: Invalid token id
'500':
description: Internal server error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
example:
error: Internal server error
security: []
components:
schemas:
ErrorResponse:
type: object
required:
- error
properties:
error:
type: string
description: Error message
code:
type: string
description: Machine-readable error code, when provided
retry_after_seconds:
type: integer
description: Number of seconds to wait before retrying, when provided
````
@@ -0,0 +1,140 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
> Use this file to discover all available pages before exploring further.
# Get last trade prices (query parameters)
> Retrieves last trade prices for multiple token IDs using query parameters.
Maximum 500 token IDs can be requested per call.
## OpenAPI
````yaml /api-spec/clob-openapi.yaml get /last-trades-prices
openapi: 3.1.0
info:
title: Polymarket CLOB API
description: Polymarket CLOB API Reference
license:
name: MIT
identifier: MIT
version: 1.0.0
servers:
- url: https://clob.polymarket.com
description: Production CLOB API
- url: https://clob-staging.polymarket.com
description: Staging CLOB API
security: []
tags:
- name: Trade
description: Trade endpoints
- name: Markets
description: Market data endpoints
- name: Account
description: Account and authentication endpoints
- name: Notifications
description: User notification endpoints
- name: Rewards
description: Rewards and earnings endpoints
- name: Rebates
description: Maker rebate endpoints
paths:
/last-trades-prices:
get:
tags:
- Market Data
summary: Get last trade prices (query parameters)
description: >
Retrieves last trade prices for multiple token IDs using query
parameters.
Maximum 500 token IDs can be requested per call.
operationId: getLastTradesPricesGet
parameters:
- name: token_ids
in: query
description: Comma-separated list of token IDs (max 500)
required: true
schema:
type: string
example: 0xabc123...,0xdef456...
responses:
'200':
description: Successfully retrieved last trade prices
content:
application/json:
schema:
type: array
items:
type: object
required:
- token_id
- price
- side
properties:
token_id:
type: string
description: Token ID (asset ID)
example: 0xabc123def456...
price:
type: string
description: Last trade price
example: '0.45'
side:
type: string
description: Last trade side (BUY or SELL)
enum:
- BUY
- SELL
example: BUY
example:
- token_id: 0xabc123def456...
price: '0.45'
side: BUY
- token_id: 0xdef456abc123...
price: '0.52'
side: SELL
'400':
description: Bad request - Invalid payload or exceeds limit
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
invalid_payload:
summary: Invalid payload
value:
error: Invalid payload
exceeds_limit:
summary: Payload exceeds limit
value:
error: Payload exceeds the limit
'500':
description: Internal server error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
example:
error: Internal server error
security: []
components:
schemas:
ErrorResponse:
type: object
required:
- error
properties:
error:
type: string
description: Error message
code:
type: string
description: Machine-readable error code, when provided
retry_after_seconds:
type: integer
description: Number of seconds to wait before retrying, when provided
````
@@ -0,0 +1,157 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
> Use this file to discover all available pages before exploring further.
# Get last trade prices (request body)
> Retrieves last trade prices for multiple token IDs using a request body.
Maximum 500 token IDs can be requested per call.
## OpenAPI
````yaml /api-spec/clob-openapi.yaml post /last-trades-prices
openapi: 3.1.0
info:
title: Polymarket CLOB API
description: Polymarket CLOB API Reference
license:
name: MIT
identifier: MIT
version: 1.0.0
servers:
- url: https://clob.polymarket.com
description: Production CLOB API
- url: https://clob-staging.polymarket.com
description: Staging CLOB API
security: []
tags:
- name: Trade
description: Trade endpoints
- name: Markets
description: Market data endpoints
- name: Account
description: Account and authentication endpoints
- name: Notifications
description: User notification endpoints
- name: Rewards
description: Rewards and earnings endpoints
- name: Rebates
description: Maker rebate endpoints
paths:
/last-trades-prices:
post:
tags:
- Market Data
summary: Get last trade prices (request body)
description: |
Retrieves last trade prices for multiple token IDs using a request body.
Maximum 500 token IDs can be requested per call.
operationId: getLastTradesPricesPost
requestBody:
required: true
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/BookRequest'
example:
- token_id: 0xabc123def456...
- token_id: 0xdef456abc123...
responses:
'200':
description: Successfully retrieved last trade prices
content:
application/json:
schema:
type: array
items:
type: object
required:
- token_id
- price
- side
properties:
token_id:
type: string
description: Token ID (asset ID)
example: 0xabc123def456...
price:
type: string
description: Last trade price
example: '0.45'
side:
type: string
description: Last trade side (BUY or SELL)
enum:
- BUY
- SELL
example: BUY
example:
- token_id: 0xabc123def456...
price: '0.45'
side: BUY
- token_id: 0xdef456abc123...
price: '0.52'
side: SELL
'400':
description: Bad request - Invalid payload or exceeds limit
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
invalid_payload:
summary: Invalid payload
value:
error: Invalid payload
exceeds_limit:
summary: Payload exceeds limit
value:
error: Payload exceeds the limit
'500':
description: Internal server error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
example:
error: Internal server error
security: []
components:
schemas:
BookRequest:
type: object
required:
- token_id
properties:
token_id:
type: string
description: Token ID (asset ID)
example: 0xabc123def456...
side:
type: string
description: Order side (optional, not used for midpoint calculation)
enum:
- BUY
- SELL
example: BUY
ErrorResponse:
type: object
required:
- error
properties:
error:
type: string
description: Error message
code:
type: string
description: Machine-readable error code, when provided
retry_after_seconds:
type: integer
description: Number of seconds to wait before retrying, when provided
````
@@ -0,0 +1,139 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
> Use this file to discover all available pages before exploring further.
# Get market price
> Retrieves the best market price for a specific token ID and side (bid or ask).
Returns the best bid price for BUY side or best ask price for SELL side.
## OpenAPI
````yaml /api-spec/clob-openapi.yaml get /price
openapi: 3.1.0
info:
title: Polymarket CLOB API
description: Polymarket CLOB API Reference
license:
name: MIT
identifier: MIT
version: 1.0.0
servers:
- url: https://clob.polymarket.com
description: Production CLOB API
- url: https://clob-staging.polymarket.com
description: Staging CLOB API
security: []
tags:
- name: Trade
description: Trade endpoints
- name: Markets
description: Market data endpoints
- name: Account
description: Account and authentication endpoints
- name: Notifications
description: User notification endpoints
- name: Rewards
description: Rewards and earnings endpoints
- name: Rebates
description: Maker rebate endpoints
paths:
/price:
get:
tags:
- Market Data
summary: Get market price
description: >
Retrieves the best market price for a specific token ID and side (bid or
ask).
Returns the best bid price for BUY side or best ask price for SELL side.
operationId: getPrice
parameters:
- name: token_id
in: query
description: Token ID (asset ID)
required: true
schema:
type: string
example: 0xabc123def456...
- name: side
in: query
description: Order side
required: true
schema:
type: string
enum:
- BUY
- SELL
example: BUY
responses:
'200':
description: Successfully retrieved market price
content:
application/json:
schema:
type: object
required:
- price
properties:
price:
type: number
format: double
description: Market price as a decimal number
example: 0.45
example:
price: 0.45
'400':
description: Bad request - Invalid token id or side
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
invalid_token_id:
summary: Invalid token id
value:
error: Invalid token id
invalid_side:
summary: Invalid side
value:
error: Invalid side
'404':
description: Not found - No orderbook exists for the requested token id
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
example:
error: No orderbook exists for the requested token id
'500':
description: Internal server error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
example:
error: Internal server error
security: []
components:
schemas:
ErrorResponse:
type: object
required:
- error
properties:
error:
type: string
description: Error message
code:
type: string
description: Machine-readable error code, when provided
retry_after_seconds:
type: integer
description: Number of seconds to wait before retrying, when provided
````
@@ -0,0 +1,136 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
> Use this file to discover all available pages before exploring further.
# Get market prices (query parameters)
> Retrieves market prices for multiple token IDs and sides using query parameters.
## OpenAPI
````yaml /api-spec/clob-openapi.yaml get /prices
openapi: 3.1.0
info:
title: Polymarket CLOB API
description: Polymarket CLOB API Reference
license:
name: MIT
identifier: MIT
version: 1.0.0
servers:
- url: https://clob.polymarket.com
description: Production CLOB API
- url: https://clob-staging.polymarket.com
description: Staging CLOB API
security: []
tags:
- name: Trade
description: Trade endpoints
- name: Markets
description: Market data endpoints
- name: Account
description: Account and authentication endpoints
- name: Notifications
description: User notification endpoints
- name: Rewards
description: Rewards and earnings endpoints
- name: Rebates
description: Maker rebate endpoints
paths:
/prices:
get:
tags:
- Market Data
summary: Get market prices (query parameters)
description: >
Retrieves market prices for multiple token IDs and sides using query
parameters.
operationId: getPricesGet
parameters:
- name: token_ids
in: query
description: Comma-separated list of token IDs
required: true
schema:
type: string
example: 0xabc123...,0xdef456...
- name: sides
in: query
description: >-
Comma-separated list of sides (BUY or SELL) corresponding to token
IDs
required: true
schema:
type: string
example: BUY,SELL
responses:
'200':
description: Successfully retrieved market prices
content:
application/json:
schema:
type: object
additionalProperties:
type: object
additionalProperties:
type: number
format: double
description: Map of token ID to map of side to price
example:
0xabc123def456...:
BUY: 0.45
0xdef456abc123...:
SELL: 0.52
'400':
description: Bad request - Invalid payload or side
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
invalid_payload:
summary: Invalid payload
value:
error: Invalid payload
invalid_side:
summary: Invalid side
value:
error: Invalid side
'404':
description: Not found - No orderbook exists for the requested token id
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
example:
error: No orderbook exists for the requested token id
'500':
description: Internal server error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
example:
error: Internal server error
security: []
components:
schemas:
ErrorResponse:
type: object
required:
- error
properties:
error:
type: string
description: Error message
code:
type: string
description: Machine-readable error code, when provided
retry_after_seconds:
type: integer
description: Number of seconds to wait before retrying, when provided
````
@@ -0,0 +1,151 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
> Use this file to discover all available pages before exploring further.
# Get market prices (request body)
> Retrieves market prices for multiple token IDs and sides using a request body.
Each request must include both token_id and side.
## OpenAPI
````yaml /api-spec/clob-openapi.yaml post /prices
openapi: 3.1.0
info:
title: Polymarket CLOB API
description: Polymarket CLOB API Reference
license:
name: MIT
identifier: MIT
version: 1.0.0
servers:
- url: https://clob.polymarket.com
description: Production CLOB API
- url: https://clob-staging.polymarket.com
description: Staging CLOB API
security: []
tags:
- name: Trade
description: Trade endpoints
- name: Markets
description: Market data endpoints
- name: Account
description: Account and authentication endpoints
- name: Notifications
description: User notification endpoints
- name: Rewards
description: Rewards and earnings endpoints
- name: Rebates
description: Maker rebate endpoints
paths:
/prices:
post:
tags:
- Market Data
summary: Get market prices (request body)
description: >
Retrieves market prices for multiple token IDs and sides using a request
body.
Each request must include both token_id and side.
operationId: getPricesPost
requestBody:
required: true
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/BookRequest'
example:
- token_id: 0xabc123def456...
side: BUY
- token_id: 0xdef456abc123...
side: SELL
responses:
'200':
description: Successfully retrieved market prices
content:
application/json:
schema:
type: object
additionalProperties:
type: object
additionalProperties:
type: number
format: double
description: Map of token ID to map of side to price
example:
0xabc123def456...:
BUY: 0.45
0xdef456abc123...:
SELL: 0.52
'400':
description: Bad request - Invalid payload or side
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
invalid_payload:
summary: Invalid payload
value:
error: Invalid payload
invalid_side:
summary: Invalid side
value:
error: Invalid side
'404':
description: Not found - No orderbook exists for the requested token id
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
example:
error: No orderbook exists for the requested token id
'500':
description: Internal server error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
example:
error: Internal server error
security: []
components:
schemas:
BookRequest:
type: object
required:
- token_id
properties:
token_id:
type: string
description: Token ID (asset ID)
example: 0xabc123def456...
side:
type: string
description: Order side (optional, not used for midpoint calculation)
enum:
- BUY
- SELL
example: BUY
ErrorResponse:
type: object
required:
- error
properties:
error:
type: string
description: Error message
code:
type: string
description: Machine-readable error code, when provided
retry_after_seconds:
type: integer
description: Number of seconds to wait before retrying, when provided
````
@@ -0,0 +1,110 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
> Use this file to discover all available pages before exploring further.
# Get midpoint prices (query parameters)
> Retrieves midpoint prices for multiple token IDs using query parameters.
The midpoint is calculated as the average of the best bid and best ask prices.
## OpenAPI
````yaml /api-spec/clob-openapi.yaml get /midpoints
openapi: 3.1.0
info:
title: Polymarket CLOB API
description: Polymarket CLOB API Reference
license:
name: MIT
identifier: MIT
version: 1.0.0
servers:
- url: https://clob.polymarket.com
description: Production CLOB API
- url: https://clob-staging.polymarket.com
description: Staging CLOB API
security: []
tags:
- name: Trade
description: Trade endpoints
- name: Markets
description: Market data endpoints
- name: Account
description: Account and authentication endpoints
- name: Notifications
description: User notification endpoints
- name: Rewards
description: Rewards and earnings endpoints
- name: Rebates
description: Maker rebate endpoints
paths:
/midpoints:
get:
tags:
- Market Data
summary: Get midpoint prices (query parameters)
description: >
Retrieves midpoint prices for multiple token IDs using query parameters.
The midpoint is calculated as the average of the best bid and best ask
prices.
operationId: getMidpointsGet
parameters:
- name: token_ids
in: query
description: Comma-separated list of token IDs
required: true
schema:
type: string
example: 0xabc123...,0xdef456...
responses:
'200':
description: Successfully retrieved midpoint prices
content:
application/json:
schema:
type: object
additionalProperties:
type: string
description: Map of token ID to midpoint price
example:
0xabc123def456...: '0.45'
0xdef456abc123...: '0.52'
'400':
description: Bad request - Invalid payload
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
example:
error: Invalid payload
'500':
description: Internal server error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
example:
error: error getting the mid price
security: []
components:
schemas:
ErrorResponse:
type: object
required:
- error
properties:
error:
type: string
description: Error message
code:
type: string
description: Machine-readable error code, when provided
retry_after_seconds:
type: integer
description: Number of seconds to wait before retrying, when provided
````
@@ -0,0 +1,129 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
> Use this file to discover all available pages before exploring further.
# Get midpoint prices (request body)
> Retrieves midpoint prices for multiple token IDs using a request body.
The midpoint is calculated as the average of the best bid and best ask prices.
## OpenAPI
````yaml /api-spec/clob-openapi.yaml post /midpoints
openapi: 3.1.0
info:
title: Polymarket CLOB API
description: Polymarket CLOB API Reference
license:
name: MIT
identifier: MIT
version: 1.0.0
servers:
- url: https://clob.polymarket.com
description: Production CLOB API
- url: https://clob-staging.polymarket.com
description: Staging CLOB API
security: []
tags:
- name: Trade
description: Trade endpoints
- name: Markets
description: Market data endpoints
- name: Account
description: Account and authentication endpoints
- name: Notifications
description: User notification endpoints
- name: Rewards
description: Rewards and earnings endpoints
- name: Rebates
description: Maker rebate endpoints
paths:
/midpoints:
post:
tags:
- Market Data
summary: Get midpoint prices (request body)
description: >
Retrieves midpoint prices for multiple token IDs using a request body.
The midpoint is calculated as the average of the best bid and best ask
prices.
operationId: getMidpointsPost
requestBody:
required: true
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/BookRequest'
example:
- token_id: 0xabc123def456...
- token_id: 0xdef456abc123...
responses:
'200':
description: Successfully retrieved midpoint prices
content:
application/json:
schema:
type: object
additionalProperties:
type: string
description: Map of token ID to midpoint price
example:
0xabc123def456...: '0.45'
0xdef456abc123...: '0.52'
'400':
description: Bad request - Invalid payload
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
example:
error: Invalid payload
'500':
description: Internal server error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
example:
error: error getting the mid price
security: []
components:
schemas:
BookRequest:
type: object
required:
- token_id
properties:
token_id:
type: string
description: Token ID (asset ID)
example: 0xabc123def456...
side:
type: string
description: Order side (optional, not used for midpoint calculation)
enum:
- BUY
- SELL
example: BUY
ErrorResponse:
type: object
required:
- error
properties:
error:
type: string
description: Error message
code:
type: string
description: Machine-readable error code, when provided
retry_after_seconds:
type: integer
description: Number of seconds to wait before retrying, when provided
````
@@ -0,0 +1,199 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
> Use this file to discover all available pages before exploring further.
# Get order book
> Retrieves the order book summary for a specific token ID.
Includes bids, asks, market details, and last trade price.
## OpenAPI
````yaml /api-spec/clob-openapi.yaml get /book
openapi: 3.1.0
info:
title: Polymarket CLOB API
description: Polymarket CLOB API Reference
license:
name: MIT
identifier: MIT
version: 1.0.0
servers:
- url: https://clob.polymarket.com
description: Production CLOB API
- url: https://clob-staging.polymarket.com
description: Staging CLOB API
security: []
tags:
- name: Trade
description: Trade endpoints
- name: Markets
description: Market data endpoints
- name: Account
description: Account and authentication endpoints
- name: Notifications
description: User notification endpoints
- name: Rewards
description: Rewards and earnings endpoints
- name: Rebates
description: Maker rebate endpoints
paths:
/book:
get:
tags:
- Market Data
summary: Get order book
description: |
Retrieves the order book summary for a specific token ID.
Includes bids, asks, market details, and last trade price.
operationId: getBook
parameters:
- name: token_id
in: query
description: Token ID (asset ID)
required: true
schema:
type: string
example: 0xabc123def456...
responses:
'200':
description: Successfully retrieved order book
content:
application/json:
schema:
$ref: '#/components/schemas/OrderBookSummary'
example:
market: '0x1234567890123456789012345678901234567890'
asset_id: 0xabc123def456...
timestamp: '1234567890'
hash: a1b2c3d4e5f6...
bids:
- price: '0.45'
size: '100'
- price: '0.44'
size: '200'
asks:
- price: '0.46'
size: '150'
- price: '0.47'
size: '250'
min_order_size: '1'
tick_size: '0.01'
neg_risk: false
last_trade_price: '0.45'
'400':
description: Bad request - Invalid token id
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
example:
error: Invalid token id
'404':
description: Not found - No orderbook exists for the requested token id
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
example:
error: No orderbook exists for the requested token id
'500':
description: Internal server error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
example:
error: error getting the orderbook
security: []
components:
schemas:
OrderBookSummary:
type: object
required:
- market
- asset_id
- timestamp
- hash
- bids
- asks
- min_order_size
- tick_size
- neg_risk
- last_trade_price
properties:
market:
type: string
description: Market condition ID
example: '0x1234567890123456789012345678901234567890'
asset_id:
type: string
description: Token ID (asset ID)
example: 0xabc123def456...
timestamp:
type: string
description: Timestamp of the order book snapshot
example: '1234567890'
hash:
type: string
description: Hash of the order book summary
example: a1b2c3d4e5f6...
bids:
type: array
description: List of bid orders (sorted by price descending)
items:
$ref: '#/components/schemas/OrderSummary'
asks:
type: array
description: List of ask orders (sorted by price ascending)
items:
$ref: '#/components/schemas/OrderSummary'
min_order_size:
type: string
description: Minimum order size
example: '1'
tick_size:
type: string
description: Minimum price increment (tick size)
example: '0.01'
neg_risk:
type: boolean
description: Whether negative risk is enabled for this market
example: false
last_trade_price:
type: string
description: Last trade price
example: '0.45'
ErrorResponse:
type: object
required:
- error
properties:
error:
type: string
description: Error message
code:
type: string
description: Machine-readable error code, when provided
retry_after_seconds:
type: integer
description: Number of seconds to wait before retrying, when provided
OrderSummary:
type: object
required:
- price
- size
properties:
price:
type: string
description: Order price
example: '0.45'
size:
type: string
description: Order size
example: '100'
````
@@ -0,0 +1,199 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
> Use this file to discover all available pages before exploring further.
# Get order books (request body)
> Retrieves order book summaries for multiple token IDs using a request body.
## OpenAPI
````yaml /api-spec/clob-openapi.yaml post /books
openapi: 3.1.0
info:
title: Polymarket CLOB API
description: Polymarket CLOB API Reference
license:
name: MIT
identifier: MIT
version: 1.0.0
servers:
- url: https://clob.polymarket.com
description: Production CLOB API
- url: https://clob-staging.polymarket.com
description: Staging CLOB API
security: []
tags:
- name: Trade
description: Trade endpoints
- name: Markets
description: Market data endpoints
- name: Account
description: Account and authentication endpoints
- name: Notifications
description: User notification endpoints
- name: Rewards
description: Rewards and earnings endpoints
- name: Rebates
description: Maker rebate endpoints
paths:
/books:
post:
tags:
- Market Data
summary: Get order books (request body)
description: >
Retrieves order book summaries for multiple token IDs using a request
body.
operationId: getBooksPost
requestBody:
required: true
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/BookRequest'
example:
- token_id: 0xabc123def456...
- token_id: 0xdef456abc123...
responses:
'200':
description: Successfully retrieved order books
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/OrderBookSummary'
example:
- market: '0x1234567890123456789012345678901234567890'
asset_id: 0xabc123def456...
timestamp: '1234567890'
hash: a1b2c3d4e5f6...
bids:
- price: '0.45'
size: '100'
asks:
- price: '0.46'
size: '150'
min_order_size: '1'
tick_size: '0.01'
neg_risk: false
last_trade_price: '0.45'
'400':
description: Bad request - Invalid payload
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
example:
error: Invalid payload
security: []
components:
schemas:
BookRequest:
type: object
required:
- token_id
properties:
token_id:
type: string
description: Token ID (asset ID)
example: 0xabc123def456...
side:
type: string
description: Order side (optional, not used for midpoint calculation)
enum:
- BUY
- SELL
example: BUY
OrderBookSummary:
type: object
required:
- market
- asset_id
- timestamp
- hash
- bids
- asks
- min_order_size
- tick_size
- neg_risk
- last_trade_price
properties:
market:
type: string
description: Market condition ID
example: '0x1234567890123456789012345678901234567890'
asset_id:
type: string
description: Token ID (asset ID)
example: 0xabc123def456...
timestamp:
type: string
description: Timestamp of the order book snapshot
example: '1234567890'
hash:
type: string
description: Hash of the order book summary
example: a1b2c3d4e5f6...
bids:
type: array
description: List of bid orders (sorted by price descending)
items:
$ref: '#/components/schemas/OrderSummary'
asks:
type: array
description: List of ask orders (sorted by price ascending)
items:
$ref: '#/components/schemas/OrderSummary'
min_order_size:
type: string
description: Minimum order size
example: '1'
tick_size:
type: string
description: Minimum price increment (tick size)
example: '0.01'
neg_risk:
type: boolean
description: Whether negative risk is enabled for this market
example: false
last_trade_price:
type: string
description: Last trade price
example: '0.45'
ErrorResponse:
type: object
required:
- error
properties:
error:
type: string
description: Error message
code:
type: string
description: Machine-readable error code, when provided
retry_after_seconds:
type: integer
description: Number of seconds to wait before retrying, when provided
OrderSummary:
type: object
required:
- price
- size
properties:
price:
type: string
description: Order price
example: '0.45'
size:
type: string
description: Order size
example: '100'
````
@@ -0,0 +1,109 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
> Use this file to discover all available pages before exploring further.
# Get spread
> Retrieves the spread for a specific token ID.
The spread is the difference between the best ask and best bid prices.
## OpenAPI
````yaml /api-spec/clob-openapi.yaml get /spread
openapi: 3.1.0
info:
title: Polymarket CLOB API
description: Polymarket CLOB API Reference
license:
name: MIT
identifier: MIT
version: 1.0.0
servers:
- url: https://clob.polymarket.com
description: Production CLOB API
- url: https://clob-staging.polymarket.com
description: Staging CLOB API
security: []
tags:
- name: Trade
description: Trade endpoints
- name: Markets
description: Market data endpoints
- name: Account
description: Account and authentication endpoints
- name: Notifications
description: User notification endpoints
- name: Rewards
description: Rewards and earnings endpoints
- name: Rebates
description: Maker rebate endpoints
paths:
/spread:
get:
tags:
- Market Data
summary: Get spread
description: |
Retrieves the spread for a specific token ID.
The spread is the difference between the best ask and best bid prices.
operationId: getSpread
parameters:
- name: token_id
in: query
description: Token ID (asset ID)
required: true
schema:
type: string
example: 0xabc123def456...
responses:
'200':
description: Successfully retrieved spread
content:
application/json:
schema:
type: object
required:
- spread
properties:
spread:
type: string
description: Spread as a string
example: '0.02'
'400':
description: Bad request - Invalid token id
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
example:
error: Invalid token id
'404':
description: Not found - No orderbook exists for the requested token id
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
example:
error: No orderbook exists for the requested token id
security: []
components:
schemas:
ErrorResponse:
type: object
required:
- error
properties:
error:
type: string
description: Error message
code:
type: string
description: Machine-readable error code, when provided
retry_after_seconds:
type: integer
description: Number of seconds to wait before retrying, when provided
````
@@ -0,0 +1,127 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
> Use this file to discover all available pages before exploring further.
# Get spreads
> Retrieves spreads for multiple token IDs.
The spread is the difference between the best ask and best bid prices.
## OpenAPI
````yaml /api-spec/clob-openapi.yaml post /spreads
openapi: 3.1.0
info:
title: Polymarket CLOB API
description: Polymarket CLOB API Reference
license:
name: MIT
identifier: MIT
version: 1.0.0
servers:
- url: https://clob.polymarket.com
description: Production CLOB API
- url: https://clob-staging.polymarket.com
description: Staging CLOB API
security: []
tags:
- name: Trade
description: Trade endpoints
- name: Markets
description: Market data endpoints
- name: Account
description: Account and authentication endpoints
- name: Notifications
description: User notification endpoints
- name: Rewards
description: Rewards and earnings endpoints
- name: Rebates
description: Maker rebate endpoints
paths:
/spreads:
post:
tags:
- Market Data
summary: Get spreads
description: |
Retrieves spreads for multiple token IDs.
The spread is the difference between the best ask and best bid prices.
operationId: getSpreads
requestBody:
required: true
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/BookRequest'
example:
- token_id: 0xabc123def456...
- token_id: 0xdef456abc123...
responses:
'200':
description: Successfully retrieved spreads
content:
application/json:
schema:
type: object
additionalProperties:
type: string
description: Map of token ID to spread
example:
0xabc123def456...: '0.02'
0xdef456abc123...: '0.015'
'400':
description: Bad request - Invalid payload
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
example:
error: Invalid payload
'500':
description: Internal server error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
example:
error: error getting the spread
security: []
components:
schemas:
BookRequest:
type: object
required:
- token_id
properties:
token_id:
type: string
description: Token ID (asset ID)
example: 0xabc123def456...
side:
type: string
description: Order side (optional, not used for midpoint calculation)
enum:
- BUY
- SELL
example: BUY
ErrorResponse:
type: object
required:
- error
properties:
error:
type: string
description: Error message
code:
type: string
description: Machine-readable error code, when provided
retry_after_seconds:
type: integer
description: Number of seconds to wait before retrying, when provided
````
@@ -0,0 +1,121 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
> Use this file to discover all available pages before exploring further.
# Get tick size by path parameter
> Retrieves the minimum tick size (price increment) for a specific token ID using the token ID as a path parameter.
## OpenAPI
````yaml /api-spec/clob-openapi.yaml get /tick-size/{token_id}
openapi: 3.1.0
info:
title: Polymarket CLOB API
description: Polymarket CLOB API Reference
license:
name: MIT
identifier: MIT
version: 1.0.0
servers:
- url: https://clob.polymarket.com
description: Production CLOB API
- url: https://clob-staging.polymarket.com
description: Staging CLOB API
security: []
tags:
- name: Trade
description: Trade endpoints
- name: Markets
description: Market data endpoints
- name: Account
description: Account and authentication endpoints
- name: Notifications
description: User notification endpoints
- name: Rewards
description: Rewards and earnings endpoints
- name: Rebates
description: Maker rebate endpoints
paths:
/tick-size/{token_id}:
get:
tags:
- Market Data
summary: Get tick size by path parameter
description: >
Retrieves the minimum tick size (price increment) for a specific token
ID using the token ID as a path parameter.
operationId: getTickSizeByPath
parameters:
- name: token_id
in: path
description: Token ID (asset ID)
required: true
schema:
type: string
example: 0xabc123def456...
responses:
'200':
description: Successfully retrieved tick size
content:
application/json:
schema:
$ref: '#/components/schemas/TickSize'
example:
minimum_tick_size: 0.01
'400':
description: Bad request - Invalid token id
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
example:
error: Invalid token id
'404':
description: Not found - Market not found
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
example:
error: market not found
'500':
description: Internal server error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
example:
error: Internal server error
security: []
components:
schemas:
TickSize:
type: object
required:
- minimum_tick_size
properties:
minimum_tick_size:
type: number
format: double
description: Minimum tick size (price increment)
example: 0.01
ErrorResponse:
type: object
required:
- error
properties:
error:
type: string
description: Error message
code:
type: string
description: Machine-readable error code, when provided
retry_after_seconds:
type: integer
description: Number of seconds to wait before retrying, when provided
````
@@ -0,0 +1,125 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
> Use this file to discover all available pages before exploring further.
# Get tick size
> Retrieves the minimum tick size (price increment) for a specific token ID.
The tick size can be provided either as a query parameter or as a path parameter.
## OpenAPI
````yaml /api-spec/clob-openapi.yaml get /tick-size
openapi: 3.1.0
info:
title: Polymarket CLOB API
description: Polymarket CLOB API Reference
license:
name: MIT
identifier: MIT
version: 1.0.0
servers:
- url: https://clob.polymarket.com
description: Production CLOB API
- url: https://clob-staging.polymarket.com
description: Staging CLOB API
security: []
tags:
- name: Trade
description: Trade endpoints
- name: Markets
description: Market data endpoints
- name: Account
description: Account and authentication endpoints
- name: Notifications
description: User notification endpoints
- name: Rewards
description: Rewards and earnings endpoints
- name: Rebates
description: Maker rebate endpoints
paths:
/tick-size:
get:
tags:
- Market Data
summary: Get tick size
description: >
Retrieves the minimum tick size (price increment) for a specific token
ID.
The tick size can be provided either as a query parameter or as a path
parameter.
operationId: getTickSize
parameters:
- name: token_id
in: query
description: Token ID (asset ID)
required: false
schema:
type: string
example: 0xabc123def456...
responses:
'200':
description: Successfully retrieved tick size
content:
application/json:
schema:
$ref: '#/components/schemas/TickSize'
example:
minimum_tick_size: 0.01
'400':
description: Bad request - Invalid token id
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
example:
error: Invalid token id
'404':
description: Not found - Market not found
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
example:
error: market not found
'500':
description: Internal server error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
example:
error: Internal server error
security: []
components:
schemas:
TickSize:
type: object
required:
- minimum_tick_size
properties:
minimum_tick_size:
type: number
format: double
description: Minimum tick size (price increment)
example: 0.01
ErrorResponse:
type: object
required:
- error
properties:
error:
type: string
description: Error message
code:
type: string
description: Machine-readable error code, when provided
retry_after_seconds:
type: integer
description: Number of seconds to wait before retrying, when provided
````
@@ -0,0 +1,144 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
> Use this file to discover all available pages before exploring further.
# Get batch prices history
> Retrieve historical price data for multiple markets in a single request.
## OpenAPI
````yaml /api-spec/clob-openapi.yaml post /batch-prices-history
openapi: 3.1.0
info:
title: Polymarket CLOB API
description: Polymarket CLOB API Reference
license:
name: MIT
identifier: MIT
version: 1.0.0
servers:
- url: https://clob.polymarket.com
description: Production CLOB API
- url: https://clob-staging.polymarket.com
description: Staging CLOB API
security: []
tags:
- name: Trade
description: Trade endpoints
- name: Markets
description: Market data endpoints
- name: Account
description: Account and authentication endpoints
- name: Notifications
description: User notification endpoints
- name: Rewards
description: Rewards and earnings endpoints
- name: Rebates
description: Maker rebate endpoints
paths:
/batch-prices-history:
post:
tags:
- Markets
summary: Get batch prices history
description: Retrieve historical price data for multiple markets in a single request.
operationId: getBatchPricesHistory
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/BatchPricesHistoryRequest'
responses:
'200':
description: Successful response with price history for each market
content:
application/json:
schema:
$ref: '#/components/schemas/BatchPricesHistoryResponse'
'400':
description: Bad Request - Missing or invalid parameters
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'500':
description: Internal server error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
security: []
components:
schemas:
BatchPricesHistoryRequest:
type: object
required:
- markets
properties:
markets:
type: array
items:
type: string
description: List of market asset ids to query. Maximum 20.
maxItems: 20
start_ts:
type: number
format: double
description: Filter by items after this unix timestamp (seconds).
end_ts:
type: number
format: double
description: Filter by items before this unix timestamp (seconds).
interval:
type: string
enum:
- max
- all
- 1m
- 1w
- 1d
- 6h
- 1h
description: Time interval for data aggregation.
fidelity:
type: integer
description: Accuracy of the data expressed in minutes. Default is 1 minute.
BatchPricesHistoryResponse:
type: object
properties:
history:
type: object
additionalProperties:
type: array
items:
$ref: '#/components/schemas/MarketPrice'
description: Map of market asset id to array of price data points.
ErrorResponse:
type: object
required:
- error
properties:
error:
type: string
description: Error message
code:
type: string
description: Machine-readable error code, when provided
retry_after_seconds:
type: integer
description: Number of seconds to wait before retrying, when provided
MarketPrice:
type: object
properties:
t:
type: integer
format: uint32
p:
type: number
format: float
````

Some files were not shown because too many files have changed in this diff Show More