manifold
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseManifold API
Manifold API
Manifold is a prediction market platform where users create and trade on questions about real-world events. It uses a combination of play-money (mana) and prize-cash, with automated market makers (CPMM) and a rich API for programmatic access.
Check this skill and the official documentation FREQUENTLY for updates. The API is still in alpha and may change without notice.
Community: Join the Manifold Discord for questions, bug reports, and to share what you build.
Source code: Manifold is open source. Type definitions live at common/src/api/schema.ts.
Manifold是一个预测市场平台,用户可在此创建并交易与现实世界事件相关的问题。它结合了虚拟货币(Mana)和奖励现金机制,采用自动做市商(CPMM),并提供功能丰富的API供程序化访问。
请定期查看本技能及官方文档以获取更新。目前API仍处于alpha阶段,可能会在无通知的情况下变更。
社区: 加入Manifold Discord以提问、提交Bug报告,以及分享你的开发成果。
源代码: Manifold是开源项目。类型定义文件位于common/src/api/schema.ts。
Key Concepts (Glossary)
核心概念(术语表)
| Term | Definition |
|---|---|
| Market (Contract) | A single tradeable question. Called "contract" in the codebase, "market" in the API. Has an outcome type (BINARY, MULTIPLE_CHOICE, PSEUDO_NUMERIC, BOUNTIED_QUESTION, POLL). |
| Mana (M$) | Play-money currency used for most markets. Cannot be withdrawn for real money. |
| Prize Cash (CASH) | Real-money currency available on select markets. Can be withdrawn. Identified by |
| Sibling Contract | The mana or prize-cash counterpart of a market. Toggle between them via |
| Topic (Group) | A tag applied to markets for categorization. Called "group" in the codebase and API. |
| CPMM | Constant Product Market Maker. The automated market maker used for binary ( |
| DPM | Dynamic Parimutuel Market — a legacy mechanism ( |
| Probability | A number between 0 and 1 representing the market's current implied probability of YES. |
| Pool | The liquidity pool of shares backing the market maker. For CPMM markets, shows YES and NO share counts. |
| Liquidity | Mana deposited into the AMM pool. More liquidity means less price impact per trade. |
| Bet | A trade on a market. Can be a market order or a limit order (when |
| Limit Order | A bet that only executes at a specified probability price or better. Remains open until filled, cancelled, or expired. |
| Shares | Units of a position. Winning YES shares pay out M$1 each; losing shares pay M$0. |
| Resolution | The final outcome of a market: YES, NO, MKT (probability), or CANCEL. |
| Answer | A possible outcome in a MULTIPLE_CHOICE or FREE_RESPONSE market. Each answer has its own probability. |
| Bounty | A BOUNTIED_QUESTION market where the creator distributes mana rewards to the best comments/answers. |
| Poll | A non-trading market type where users simply vote on options. |
| 术语 | 定义 |
|---|---|
| Market(合约) | 单个可交易的问题。在代码库中称为“contract”,在API中称为“market”。包含结果类型(BINARY、MULTIPLE_CHOICE、PSEUDO_NUMERIC、BOUNTIED_QUESTION、POLL)。 |
| Mana(M$) | 大多数市场使用的虚拟货币,无法兑换为真实货币。 |
| 奖励现金(CASH) | 部分特定市场可用的真实货币,可以提现。在市场中通过 |
| Sibling Contract | 某个市场对应的Mana或奖励现金版本。可通过 |
| Topic(Group) | 用于市场分类的标签。在代码库和API中称为“group”。 |
| CPMM | 恒定乘积做市商。用于二元市场( |
| DPM | 动态 pari-mutuel 市场——一种用于旧版自由回答市场的遗留机制( |
| Probability | 0到1之间的数值,代表市场当前隐含的YES结果概率。 |
| Pool | 支持做市商的份额流动性池。对于CPMM市场,显示YES和NO的份额数量。 |
| Liquidity | 存入AMM池的Mana。流动性越高,每次交易对价格的影响越小。 |
| Bet | 市场中的一笔交易。可以是市价单,也可以是限价单(当指定 |
| Limit Order | 仅在指定概率价格或更优价格下执行的订单。未成交部分会保持挂单状态,直到成交、取消或过期。 |
| Shares | 持仓的单位。获胜的YES份额每份支付M$1;失败的份额支付M$0。 |
| Resolution | 市场的最终结果:YES、NO、MKT(概率)或CANCEL。 |
| Answer | MULTIPLE_CHOICE或FREE_RESPONSE市场中的一个可能结果。每个答案都有独立的概率。 |
| Bounty | BOUNTIED_QUESTION类型的市场,创建者会向最佳评论/答案发放Mana奖励。 |
| Poll | 非交易类市场,用户仅能对选项进行投票。 |
Base URLs
基础URL
| Environment | REST API | WebSocket |
|---|---|---|
| Production | | |
| Dev | | |
Important: The API was recently moved fromtohttps://manifold.markets/api. The old domain will be removed in the future. Always use the new domain.https://api.manifold.markets
All REST endpoints are prefixed with .
/v0/| 环境 | REST API | WebSocket |
|---|---|---|
| 生产环境 | | |
| 开发环境 | | |
重要提示: API最近已从迁移至https://manifold.markets/api。旧域名将在未来停用,请始终使用新域名。https://api.manifold.markets
所有REST端点均以为前缀。
/v0/Documentation & References
文档与参考资源
| Resource | URL |
|---|---|
| API Documentation | https://docs.manifold.markets/api |
| Platform | https://manifold.markets |
| Source Code (GitHub) | https://github.com/manifoldmarkets/manifold |
| API Type Definitions | https://github.com/manifoldmarkets/manifold/tree/main/common/src/api/schema.ts |
| Discord Community | https://discord.com/invite/eHQBNBqXuh |
| Terms of Service | https://docs.manifold.markets/terms |
| Data Downloads & Licensing | https://docs.manifold.markets/data |
Authentication
身份验证
Some endpoints are public (no auth required). Write endpoints and user-specific reads require authentication via an API key.
部分端点为公开访问(无需验证)。写入类端点和用户专属读取类端点需要通过API密钥进行身份验证。
Generating an API Key
生成API密钥
- Log in to Manifold.
- Go to your user profile and click "edit".
- Scroll to the API key field at the bottom.
- Click the "refresh" button to generate a new key.
- Copy and store the key securely. Clicking refresh again will invalidate the old key and generate a new one.
- 登录Manifold。
- 进入个人资料页面并点击“编辑”。
- 滚动至页面底部的API密钥区域。
- 点击“刷新”按钮生成新密钥。
- 复制并安全存储密钥。再次点击刷新会使旧密钥失效并生成新密钥。
Using the API Key
使用API密钥
Include the key in the header:
AuthorizationAuthorization: Key {your_api_key}Alternatively, the API accepts Firebase JWTs via , but this is intended for the web client and not recommended for third-party use.
Authorization: Bearer {jwt}在请求头中包含密钥:
AuthorizationAuthorization: Key {your_api_key}此外,API也支持通过传入Firebase JWT,但该方式仅适用于Web客户端,不推荐第三方使用。
Authorization: Bearer {jwt}Example Authenticated Request
身份验证请求示例
bash
curl "https://api.manifold.markets/v0/me" \
-H "Authorization: Key YOUR_API_KEY"bash
curl "https://api.manifold.markets/v0/me" \
-H "Authorization: Key YOUR_API_KEY"Rate Limits
请求频率限制
There is a rate limit of 500 requests per minute per IP address. Do not use multiple IP addresses to circumvent this limit.
Implement exponential backoff on HTTP 429 responses.
每个IP地址的请求频率限制为每分钟500次。请勿使用多个IP地址规避此限制。
收到HTTP 429响应时,请实现指数退避机制。
Fees
费用
- Comments placed through the API incur a M$1 transaction fee.
- Market creation costs mana (see the market creation endpoint for current costs per type).
- 通过API发布评论会产生M$1的交易费用。
- 创建市场需要消耗Mana(具体费用请查看市场创建端点的说明)。
Licensing
授权许可
- Permitted: Bots, automated trading, algorithmic tools, integrations.
- Prohibited: Scraping through means other than the API; circumventing rate limits.
- AI training data: Not permitted for commercial use without a data license. Academic and personal/non-commercial use is allowed. Contact for commercial licensing.
api@manifold.markets
- 允许用途: 机器人、自动化交易、算法工具、集成开发。
- 禁止用途: 通过API以外的方式进行数据爬取;规避请求频率限制。
- AI训练数据: 未经数据授权,禁止用于商业用途。学术研究和个人/非商业用途是允许的。如需商业授权,请联系。
api@manifold.markets
REST API Endpoints Overview
REST API端点概述
All endpoints are relative to .
https://api.manifold.markets/v0所有端点均基于。
https://api.manifold.markets/v0Users
用户相关
| Endpoint | Method | Auth | Description |
|---|---|---|---|
| GET | No | Get a user by username. Returns |
| GET | No | Get basic display info by username. Returns |
| GET | No | Get a user by unique ID. Returns |
| GET | No | Get display info by ID. Returns |
| GET | Yes | Get the authenticated user. Returns |
| GET | No | List all users, ordered by creation date desc. Params: |
| 端点 | 方法 | 身份验证 | 描述 |
|---|---|---|---|
| GET | 否 | 通过用户名获取用户信息,返回 |
| GET | 否 | 通过用户名获取基础展示信息,返回 |
| GET | 否 | 通过唯一ID获取用户信息,返回 |
| GET | 否 | 通过ID获取展示信息,返回 |
| GET | 是 | 获取当前已验证用户的信息,返回 |
| GET | 否 | 按创建时间降序列出所有用户。参数: |
User Type
User类型
User {
id: string
createdTime: number
name: string // display name
username: string // used in URLs
url: string
avatarUrl?: string
bio?: string
bannerUrl?: string
website?: string
twitterHandle?: string
discordHandle?: string
isBot?: boolean
isAdmin?: boolean
isTrustworthy?: boolean // moderator
isBannedFromPosting?: boolean
userDeleted?: boolean
balance: number
totalDeposits: number
lastBetTime?: number
currentBettingStreak?: number
}User {
id: string
createdTime: number
name: string // 显示名称
username: string // URL中使用的用户名
url: string
avatarUrl?: string
bio?: string
bannerUrl?: string
website?: string
twitterHandle?: string
discordHandle?: string
isBot?: boolean
isAdmin?: boolean
isTrustworthy?: boolean // 版主
isBannedFromPosting?: boolean
userDeleted?: boolean
balance: number
totalDeposits: number
lastBetTime?: number
currentBettingStreak?: number
}DisplayUser Type
DisplayUser类型
DisplayUser {
id: string
name: string
username: string
avatarUrl?: string
}DisplayUser {
id: string
name: string
username: string
avatarUrl?: string
}Portfolio
投资组合相关
| Endpoint | Method | Auth | Description |
|---|---|---|---|
| GET | No | Get a user's live portfolio metrics. Param: |
| GET | No | Get portfolio history over a period. Params: |
| GET | No* | Get a user's positions and their contracts. Params: |
| 端点 | 方法 | 身份验证 | 描述 |
|---|---|---|---|
| GET | 否 | 获取用户的实时投资组合指标。参数: |
| GET | 否 | 获取用户在指定时间段内的投资组合历史。参数: |
| GET | 否* | 获取用户的持仓及对应市场信息。参数: |
PortfolioMetrics Type
PortfolioMetrics类型
PortfolioMetrics {
investmentValue: number
cashInvestmentValue: number
balance: number
cashBalance: number
spiceBalance: number
totalDeposits: number
totalCashDeposits: number
loanTotal: number
timestamp: number
profit?: number
userId: string
}
LivePortfolioMetrics = PortfolioMetrics & {
dailyProfit: number
}PortfolioMetrics {
investmentValue: number
cashInvestmentValue: number
balance: number
cashBalance: number
spiceBalance: number
totalDeposits: number
totalCashDeposits: number
loanTotal: number
timestamp: number
profit?: number
userId: string
}
LivePortfolioMetrics = PortfolioMetrics & {
dailyProfit: number
}Markets — Discovery & Listing
市场 — 发现与列表
| Endpoint | Method | Auth | Description |
|---|---|---|---|
| GET | No | List markets by creation date desc. Params: |
| GET | No | Get a single market by ID. Returns |
| GET | No | Get a market by slug (URL path after username). Returns |
| GET | No | Search/filter markets (similar to browse page). Returns |
| 端点 | 方法 | 身份验证 | 描述 |
|---|---|---|---|
| GET | 否 | 按创建时间降序列出市场。参数: |
| GET | 否 | 通过ID获取单个市场的详细信息,返回 |
| GET | 否 | 通过slug(用户名后的URL路径)获取市场信息,返回 |
| GET | 否 | 搜索/筛选市场(与平台浏览页逻辑类似),返回 |
Search Markets Parameters
搜索市场参数
| Parameter | Description |
|---|---|
| Search query string. Can be empty. |
| |
| |
| |
| Only markets tagged with this topic slug. |
| Only markets by this creator. |
| 0–1000 (default 100). |
| Number to skip (max 1000 when |
| Millisecond timestamp cursor for efficient pagination with |
| Minimum liquidity per contract/answer. |
| 参数 | 描述 |
|---|---|
| 搜索查询字符串,可为空。 |
| |
| |
| |
| 仅返回带有该主题slug的市场。 |
| 仅返回该创建者创建的市场。 |
| 0–1000(默认100)。 |
| 跳过的结果数量(当 |
| 毫秒级时间戳游标,配合 |
| 每个合约/答案的最低流动性要求。 |
Markets — Probabilities
市场 — 概率相关
| Endpoint | Method | Auth | Description |
|---|---|---|---|
| GET | No | Get current probability (max 1s cache). Returns |
| GET | No | Batch probabilities for multiple markets (max 1s cache). Param: |
| 端点 | 方法 | 身份验证 | 描述 |
|---|---|---|---|
| GET | 否 | 获取市场当前的概率(最大1秒缓存)。二元市场返回 |
| GET | 否 | 批量获取多个市场的概率(最大1秒缓存)。参数: |
Markets — Positions
市场 — 持仓相关
| Endpoint | Method | Auth | Description |
|---|---|---|---|
| GET | No | Get position data for a market. Params: |
| 端点 | 方法 | 身份验证 | 描述 |
|---|---|---|---|
| GET | 否 | 获取市场的持仓数据。参数: |
ContractMetric Type
ContractMetric类型
ContractMetric {
contractId: string
from: {
[period: string]: { // day, week, month
profit: number
profitPercent: number
invested: number
prevValue: number
value: number
}
} | undefined
hasNoShares: boolean
hasShares: boolean
hasYesShares: boolean
invested: number
loan: number
maxSharesOutcome: string | null
payout: number
profit: number
profitPercent: number
totalShares: { [outcome: string]: number }
userId: string
userUsername: string
userName: string
userAvatarUrl: string
lastBetTime: number
}ContractMetric {
contractId: string
from: {
[period: string]: { // day, week, month
profit: number
profitPercent: number
invested: number
prevValue: number
value: number
}
} | undefined
hasNoShares: boolean
hasShares: boolean
hasYesShares: boolean
invested: number
loan: number
maxSharesOutcome: string | null
payout: number
profit: number
profitPercent: number
totalShares: { [outcome: string]: number }
userId: string
userUsername: string
userName: string
userAvatarUrl: string
lastBetTime: number
}Markets — Creation & Management
市场 — 创建与管理
| Endpoint | Method | Auth | Description |
|---|---|---|---|
| POST | Yes | Create a new market. Returns |
| POST | Yes | Add an answer to a MULTIPLE_CHOICE market. Param: |
| POST | Yes | Add mana to liquidity pool (does not boost). Param: |
| POST | Yes | Add mana to a bounty question's reward. Param: |
| POST | Yes | Distribute bounty reward. Params: |
| POST | Yes | Set close time. Param: |
| POST | Yes | Add/remove a topic tag. Params: |
| POST | Yes | Resolve a market. See resolution format below. |
| 端点 | 方法 | 身份验证 | 描述 |
|---|---|---|---|
| POST | 是 | 创建新市场,返回 |
| POST | 是 | 为MULTIPLE_CHOICE类型的市场添加答案。参数: |
| POST | 是 | 向流动性池存入Mana(不会获得额外奖励)。参数: |
| POST | 是 | 为悬赏问题的奖励池添加Mana。参数: |
| POST | 是 | 发放悬赏奖励。参数: |
| POST | 是 | 设置市场关闭时间。参数: |
| POST | 是 | 添加/移除主题标签。参数: |
| POST | 是 | 结算市场,结算格式见下方说明。 |
Market Creation Parameters
市场创建参数
Common parameters (all market types):
| Parameter | Required | Description |
|---|---|---|
| Yes | |
| Yes | The headline question. |
| No | Plain text description. Or use |
| No | When the market closes (ms since epoch). Defaults to 7 days from now. |
| No | |
| No | Array of topic IDs to tag. |
| No | Additional liquidity to add. |
Additional parameters by type:
| Type | Extra Parameters |
|---|---|
| BINARY | |
| PSEUDO_NUMERIC | |
| MULTIPLE_CHOICE | |
| BOUNTIED_QUESTION | |
| POLL | |
Creation costs:
| Type | Cost |
|---|---|
| BINARY | M$50 |
| PSEUDO_NUMERIC | M$250 |
| MULTIPLE_CHOICE | M$25/answer or M$25 for no preset answers |
所有市场类型的通用参数:
| 参数 | 是否必填 | 描述 |
|---|---|---|
| 是 | |
| 是 | 市场的核心问题标题。 |
| 否 | 纯文本描述。也可使用 |
| 否 | 市场关闭时间(自纪元起的毫秒数),默认创建后7天关闭。 |
| 否 | |
| 否 | 要添加的主题ID数组。 |
| 否 | 额外添加的流动性。 |
按类型区分的额外参数:
| 类型 | 额外参数 |
|---|---|
| BINARY | |
| PSEUDO_NUMERIC | |
| MULTIPLE_CHOICE | |
| BOUNTIED_QUESTION | |
| POLL | |
创建成本:
| 类型 | 成本 |
|---|---|
| BINARY | M$50 |
| PSEUDO_NUMERIC | M$250 |
| MULTIPLE_CHOICE | 每个答案M$25,无预设答案则为M$25 |
Resolution Formats
结算格式
Binary markets:
- :
outcome,YES,NO, orMKT.CANCEL - : Optional, used when resolving to
probabilityInt.MKT
Multiple Choice (shouldAnswersSumToOne = true):
{
"outcome": "MKT",
"resolutions": [
{ "answer": <index>, "pct": <weight> }
]
}Weights must sum to 100. Or use as a number for a single answer index, or .
outcomeCANCELMultiple Choice (shouldAnswersSumToOne = false):
Resolve each answer independently with separate requests:
{
"outcome": "YES", // or "NO"
"answerId": "<answer_id>"
}Numeric markets:
- :
outcomeor a numeric bucket ID.CANCEL - : The resolution value.
value - : Required if
probabilityIntis provided.value
二元市场:
- :
outcome、YES、NO或MKT。CANCEL - : 可选,结算为
probabilityInt时使用。MKT
多选项市场(shouldAnswersSumToOne = true):
{
"outcome": "MKT",
"resolutions": [
{ "answer": <index>, "pct": <weight> }
]
}权重总和必须为100。也可将设为单个答案的索引,或设为。
outcomeCANCEL多选项市场(shouldAnswersSumToOne = false):
需通过单独请求为每个答案独立结算:
{
"outcome": "YES", // 或"NO"
"answerId": "<answer_id>"
}数值型市场:
- :
outcome或某个数值区间的ID。CANCEL - : 结算的具体数值。
value - : 提供
probabilityInt时必填。value
Trading
交易相关
| Endpoint | Method | Auth | Description |
|---|---|---|---|
| POST | Yes | Place a bet or limit order. Returns |
| POST | Yes | Place multiple YES bets on a sums-to-one multi-choice market, targeting equal shares per answer. Returns |
| POST | Yes | Cancel an open limit order. |
| POST | Yes | Sell shares. Params: |
| 端点 | 方法 | 身份验证 | 描述 |
|---|---|---|---|
| POST | 是 | 下单交易或限价单,返回 |
| POST | 是 | 在总和为1的多选项市场中下单多个YES交易,目标为每个答案持有相等份额,返回 |
| POST | 是 | 取消未成交的限价单。 |
| POST | 是 | 卖出份额。参数: |
Bet Parameters
Bet参数
| Parameter | Required | Description |
|---|---|---|
| Yes | Amount in mana to bet, before fees. |
| Yes | The market ID. |
| No | |
| No | Makes this a limit order. A number from 0.01 to 0.99 (whole percentage points only, e.g., 0.01 = 1%). |
| No | Timestamp (ms) when the limit order auto-cancels. |
| No | Milliseconds after creation for auto-cancel. |
| No | If |
| 参数 | 是否必填 | 描述 |
|---|---|---|
| 是 | 下单的Mana金额(不含手续费)。 |
| 是 | 市场ID。 |
| 否 | |
| 否 | 设置此参数则为限价单,取值范围0.01到0.99(仅支持整数百分比,例如0.01=1%)。 |
| 否 | 限价单自动取消的时间戳(毫秒)。 |
| 否 | 下单后多久自动取消(毫秒)。 |
| 否 | 设为 |
Multi-Bet Parameters
Multi-Bet参数
| Parameter | Required | Description |
|---|---|---|
| Yes | Market ID. Must be |
| Yes | Array of answer IDs (min 2). |
| Yes | Total mana to spend across selected answers. |
| No | Per-leg limit price (0.01–0.99, two decimal places). |
| No | Timestamp (ms) for auto-cancel of unfilled portions. |
| 参数 | 是否必填 | 描述 |
|---|---|---|
| 是 | 市场ID,必须是 |
| 是 | 答案ID数组(至少2个)。 |
| 是 | 分配给选中答案的总Mana金额。 |
| 否 | 每个答案的限价价格(0.01–0.99,保留两位小数)。 |
| 否 | 未成交部分自动取消的时间戳(毫秒)。 |
Comments
评论相关
| Endpoint | Method | Auth | Description |
|---|---|---|---|
| POST | Yes | Create a top-level comment on a market. Params: |
| GET | No | List comments for a market or user. Params: |
| 端点 | 方法 | 身份验证 | 描述 |
|---|---|---|---|
| POST | 是 | 在市场中发布顶级评论。参数: |
| GET | 否 | 列出市场或用户的评论。参数: |
Bets
交易记录相关
| Endpoint | Method | Auth | Description |
|---|---|---|---|
| GET | No | List bets. Params: |
| 端点 | 方法 | 身份验证 | 描述 |
|---|---|---|---|
| GET | 否 | 列出交易记录。参数: |
Bet Type
Bet类型
Bet {
id: string
contractId: string
userId: string
amount: number // mana spent (filled portion for limits)
orderAmount: number // original order amount
shares: number
outcome: "YES" | "NO"
probBefore: number
probAfter: number
createdTime: number
fees: {
creatorFee: number
platformFee: number
liquidityFee: number
}
isFilled: boolean
isCancelled: boolean
loanAmount: number
limitProb?: number // present for limit orders
fills: Fill[]
answerId?: string // for multi-choice markets
}
Fill {
matchedBetId: string | null
amount: number
shares: number
timestamp: number
fees: { creatorFee: number; platformFee: number; liquidityFee: number }
}Bet {
id: string
contractId: string
userId: string
amount: number // 花费的Mana(限价单为已成交部分)
orderAmount: number // 原始订单金额
shares: number
outcome: "YES" | "NO"
probBefore: number
probAfter: number
createdTime: number
fees: {
creatorFee: number
platformFee: number
liquidityFee: number
}
isFilled: boolean
isCancelled: boolean
loanAmount: number
limitProb?: number // 限价单会包含此参数
fills: Fill[]
answerId?: string // 多选项市场会包含此参数
}
Fill {
matchedBetId: string | null
amount: number
shares: number
timestamp: number
fees: { creatorFee: number; platformFee: number; liquidityFee: number }
}Topics (Groups)
主题(Groups)相关
| Endpoint | Method | Auth | Description |
|---|---|---|---|
| GET | No | List public topics, 500 at a time, newest first. Params: |
| GET | No | Get a topic by slug. |
| GET | No | Get a topic by ID. |
| 端点 | 方法 | 身份验证 | 描述 |
|---|---|---|---|
| GET | 否 | 列出公开主题,每次最多500个,按创建时间降序。参数: |
| GET | 否 | 通过slug获取主题信息。 |
| GET | 否 | 通过ID获取主题信息。 |
Mana Transfers
Mana转账相关
| Endpoint | Method | Auth | Description |
|---|---|---|---|
| POST | Yes | Send mana to other users. Params: |
| 端点 | 方法 | 身份验证 | 描述 |
|---|---|---|---|
| POST | 是 | 向其他用户发送Mana。参数: |
Transactions
交易记录(Transactions)相关
| Endpoint | Method | Auth | Description |
|---|---|---|---|
| GET | No | List transactions, newest first. Params: |
| 端点 | 方法 | 身份验证 | 描述 |
|---|---|---|---|
| GET | 否 | 列出交易记录,按时间降序。参数: |
Leagues
排行榜(Leagues)相关
| Endpoint | Method | Auth | Description |
|---|---|---|---|
| GET | No | Get league standings. Params: |
| 端点 | 方法 | 身份验证 | 描述 |
|---|---|---|---|
| GET | 否 | 获取排行榜排名。参数: |
Market Types
市场类型
| | Description |
|---|---|---|
| | Yes/No market with a single probability (0–1). Most common type. |
| | Multiple answers, each with its own probability. Can be dependent (sum to 100%) or independent. |
| | Legacy. Anyone can add answers. Uses DPM mechanism. |
| | Maps probability to a numeric range [min, max]. Can be linear or log scale. |
| — | No trading. Creator distributes bounty to best comments. |
| — | No trading. Users vote on options. |
| | 描述 |
|---|---|---|
| | 是/否类型的市场,单个概率值(0–1),最常见的市场类型。 |
| | 多选项市场,每个答案有独立的概率。分为依赖型(概率总和为100%)和独立型。 |
| | 遗留类型,任何人都可添加答案,使用DPM机制。 |
| | 将概率映射到数值区间[min, max],支持线性或对数刻度。 |
| — | 非交易类市场,创建者向最佳评论发放悬赏。 |
| — | 非交易类市场,用户仅能投票。 |
LiteMarket Type
LiteMarket类型
LiteMarket {
id: string
creatorId: string
creatorUsername: string
creatorName: string
creatorAvatarUrl?: string
createdTime: number
closeTime?: number
question: string
url: string // always points to manifold.markets
outcomeType: string
mechanism: string
probability: number
pool: { [outcome: string]: number }
p?: number // CPMM probability constant
totalLiquidity?: number // CPMM only
value?: number // PSEUDO_NUMERIC only
min?: number // PSEUDO_NUMERIC only
max?: number // PSEUDO_NUMERIC only
isLogScale?: boolean // PSEUDO_NUMERIC only
volume: number
volume24Hours: number
isResolved: boolean
resolutionTime?: number
resolution?: string
resolutionProbability?: number // for MKT resolution
uniqueBettorCount: number
lastUpdatedTime?: number
lastBetTime?: number
token?: "MANA" | "CASH"
siblingContractId?: string // toggle between mana/cash version
}LiteMarket {
id: string
creatorId: string
creatorUsername: string
creatorName: string
creatorAvatarUrl?: string
createdTime: number
closeTime?: number
question: string
url: string // 始终指向manifold.markets
outcomeType: string
mechanism: string
probability: number
pool: { [outcome: string]: number }
p?: number // CPMM概率常数
totalLiquidity?: number // 仅CPMM市场有此参数
value?: number // 仅PSEUDO_NUMERIC市场有此参数
min?: number // 仅PSEUDO_NUMERIC市场有此参数
max?: number // 仅PSEUDO_NUMERIC市场有此参数
isLogScale?: boolean // 仅PSEUDO_NUMERIC市场有此参数
volume: number
volume24Hours: number
isResolved: boolean
resolutionTime?: number
resolution?: string
resolutionProbability?: number // 结算为MKT时的概率
uniqueBettorCount: number
lastUpdatedTime?: number
lastBetTime?: number
token?: "MANA" | "CASH"
siblingContractId?: string // 在Mana/现金版本间切换
}FullMarket Type
FullMarket类型
FullMarket = LiteMarket & {
answers?: Answer[] // multi markets only
shouldAnswersSumToOne?: boolean // multi markets only
addAnswersMode?: "ANYONE" | "ONLY_CREATOR" | "DISABLED"
options?: { text: string; votes: number }[] // poll only
totalBounty?: number // bounty only
bountyLeft?: number // bounty only
description: JSONContent // TipTap rich text
textDescription: string // plain text
coverImageUrl?: string
groupSlugs?: string[] // topic tags
}FullMarket = LiteMarket & {
answers?: Answer[] // 仅多选项市场有此参数
shouldAnswersSumToOne?: boolean // 仅多选项市场有此参数
addAnswersMode?: "ANYONE" | "ONLY_CREATOR" | "DISABLED"
options?: { text: string; votes: number }[] // 仅投票市场有此参数
totalBounty?: number // 仅悬赏市场有此参数
bountyLeft?: number // 仅悬赏市场有此参数
description: JSONContent // TipTap富文本
textDescription: string // 纯文本描述
coverImageUrl?: string
groupSlugs?: string[] // 主题标签
}WebSocket API
WebSocket API
Manifold provides a real-time WebSocket server for subscribing to live updates.
Manifold提供实时WebSocket服务器,用于订阅市场的实时更新。
Connection
连接地址
wss://api.manifold.markets/ws (production)
wss://api.dev.manifold.markets/ws (dev)No authentication is required to connect. Authentication is optional (for user-specific topics).
wss://api.manifold.markets/ws (生产环境)
wss://api.dev.manifold.markets/ws (开发环境)连接无需身份验证,身份验证为可选(用于订阅用户专属主题)。
Message Format
消息格式
All messages are JSON. Client messages must include:
- :
type,identify,subscribe, orunsubscribe.ping - : A unique number identifying the message.
txid
The server acknowledges each message:
{ "type": "ack", "txid": 123, "success": true }所有消息均为JSON格式。客户端消息必须包含:
- :
type、identify、subscribe或unsubscribe。ping - : 唯一标识该消息的数字。
txid
服务器会确认每条消息:
{ "type": "ack", "txid": 123, "success": true }Subscribing to Topics
订阅主题
Send a subscribe message:
{
"type": "subscribe",
"txid": 1,
"topics": ["global/new-bet", "contract/[marketId]"]
}发送订阅消息:
{
"type": "subscribe",
"txid": 1,
"topics": ["global/new-bet", "contract/[marketId]"]
}Available Topics
可用主题
Global Topics
全局主题
| Topic | Description |
|---|---|
| All new bets across all markets. |
| All new markets being created. |
| All new comments across all markets. |
| All new liquidity subsidies. |
| Updates to any public market. |
| 主题 | 描述 |
|---|---|
| 所有市场的新交易记录。 |
| 所有新创建的市场。 |
| 所有市场的新评论。 |
| 所有新的流动性补贴。 |
| 所有公开市场的更新。 |
Per-Market Topics (replace [marketId]
with actual ID)
[marketId]单市场主题(将[marketId]
替换为实际ID)
[marketId]| Topic | Description |
|---|---|
| General market updates. |
| New bets on this market. |
| New comments on this market. |
| New liquidity subsidies. |
| New answers added (multi-choice). |
| Updates to existing answers. |
| Limit order updates. |
| Chart annotations. |
| User position updates in this market. |
| 主题 | 描述 |
|---|---|
| 市场的通用更新。 |
| 该市场的新交易记录。 |
| 该市场的新评论。 |
| 该市场的新流动性补贴。 |
| 新增的答案(多选项市场)。 |
| 现有答案的更新。 |
| 限价单的更新。 |
| 图表注释的更新。 |
| 用户在该市场的持仓更新。 |
Other Topics
其他主题
| Topic | Description |
|---|---|
| Updates to a user's public info. |
| Updates to a specific answer. |
| Updates to the TV schedule. |
| 主题 | 描述 |
|---|---|
| 用户公开信息的更新。 |
| 特定答案的更新。 |
| TV日程的更新。 |
Keep-Alive
保持连接
Send periodic pings (every 30–60 seconds) to keep the connection alive. If no ping is received for 60 seconds, the server terminates the connection.
{ "type": "ping", "txid": 42 }需定期发送ping消息(每30–60秒一次)以保持连接。如果60秒内未收到ping消息,服务器会终止连接。
{ "type": "ping", "txid": 42 }Broadcast Messages
广播消息
The server sends updates as broadcast messages:
{
"type": "broadcast",
"topic": "global/new-bet",
"data": { ... }
}服务器会通过广播消息发送更新:
{
"type": "broadcast",
"topic": "global/new-bet",
"data": { ... }
}Common Patterns
常见使用示例
List Recent Markets
列出最近的市场
bash
curl -s "https://api.manifold.markets/v0/markets?limit=5" | jq '.[].question'bash
curl -s "https://api.manifold.markets/v0/markets?limit=5" | jq '.[].question'Get a Single Market by ID
通过ID获取单个市场
bash
curl -s "https://api.manifold.markets/v0/market/3zspH9sSzMlbFQLn9GKR" | jq '{question, probability, volume, isResolved}'bash
curl -s "https://api.manifold.markets/v0/market/3zspH9sSzMlbFQLn9GKR" | jq '{question, probability, volume, isResolved}'Get a Market by Slug
通过Slug获取市场
bash
curl -s "https://api.manifold.markets/v0/slug/will-carrick-flynn-win-the-general" | jq '{question, probability}'bash
curl -s "https://api.manifold.markets/v0/slug/will-carrick-flynn-win-the-general" | jq '{question, probability}'Search for Open Binary Markets
搜索开放的二元市场
bash
curl -s "https://api.manifold.markets/v0/search-markets?term=AI&sort=liquidity&filter=open&contractType=BINARY&limit=10" | jq '.[].question'bash
curl -s "https://api.manifold.markets/v0/search-markets?term=AI&sort=liquidity&filter=open&contractType=BINARY&limit=10" | jq '.[].question'Get Current Probability
获取当前概率
bash
curl -s "https://api.manifold.markets/v0/market/9t61v9e7x4/prob" | jq '.'bash
curl -s "https://api.manifold.markets/v0/market/9t61v9e7x4/prob" | jq '.'Get Batch Probabilities
批量获取概率
bash
curl -s "https://api.manifold.markets/v0/market-probs?ids=9t61v9e7x4&ids=ZNlNdzz690" | jq '.'bash
curl -s "https://api.manifold.markets/v0/market-probs?ids=9t61v9e7x4&ids=ZNlNdzz690" | jq '.'Place a YES Bet
下单YES交易
bash
curl -X POST "https://api.manifold.markets/v0/bet" \
-H "Authorization: Key YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"amount": 10, "contractId": "MARKET_ID", "outcome": "YES"}'bash
curl -X POST "https://api.manifold.markets/v0/bet" \
-H "Authorization: Key YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"amount": 10, "contractId": "MARKET_ID", "outcome": "YES"}'Place a Limit Order
下单限价单
bash
curl -X POST "https://api.manifold.markets/v0/bet" \
-H "Authorization: Key YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"amount": 100,
"contractId": "MARKET_ID",
"outcome": "YES",
"limitProb": 0.40,
"expiresMillisAfter": 86400000
}'bash
curl -X POST "https://api.manifold.markets/v0/bet" \
-H "Authorization: Key YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"amount": 100,
"contractId": "MARKET_ID",
"outcome": "YES",
"limitProb": 0.40,
"expiresMillisAfter": 86400000
}'Sell All Shares in a Market
卖出市场中的所有份额
bash
curl -X POST "https://api.manifold.markets/v0/market/MARKET_ID/sell" \
-H "Authorization: Key YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"outcome": "YES"}'bash
curl -X POST "https://api.manifold.markets/v0/market/MARKET_ID/sell" \
-H "Authorization: Key YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"outcome": "YES"}'Cancel a Limit Order
取消限价单
bash
curl -X POST "https://api.manifold.markets/v0/bet/cancel/BET_ID" \
-H "Authorization: Key YOUR_API_KEY"bash
curl -X POST "https://api.manifold.markets/v0/bet/cancel/BET_ID" \
-H "Authorization: Key YOUR_API_KEY"Create a Binary Market
创建二元市场
bash
curl -X POST "https://api.manifold.markets/v0/market" \
-H "Authorization: Key YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"outcomeType": "BINARY",
"question": "Will it rain in SF tomorrow?",
"descriptionMarkdown": "Resolves YES if measurable rainfall is recorded at SFO weather station.",
"initialProb": 30,
"closeTime": 1735689600000
}'bash
curl -X POST "https://api.manifold.markets/v0/market" \
-H "Authorization: Key YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"outcomeType": "BINARY",
"question": "旧金山明天会下雨吗?",
"descriptionMarkdown": "若SFO气象站记录到可测量的降雨量,则结算为YES。",
"initialProb": 30,
"closeTime": 1735689600000
}'Create a Multiple Choice Market
创建多选项市场
bash
curl -X POST "https://api.manifold.markets/v0/market" \
-H "Authorization: Key YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"outcomeType": "MULTIPLE_CHOICE",
"question": "Who will win the award?",
"answers": ["Alice", "Bob", "Charlie"],
"shouldAnswersSumToOne": true,
"addAnswersMode": "ONLY_CREATOR"
}'bash
curl -X POST "https://api.manifold.markets/v0/market" \
-H "Authorization: Key YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"outcomeType": "MULTIPLE_CHOICE",
"question": "谁会获得该奖项?",
"answers": ["Alice", "Bob", "Charlie"],
"shouldAnswersSumToOne": true,
"addAnswersMode": "ONLY_CREATOR"
}'Resolve a Binary Market
结算二元市场
bash
curl -X POST "https://api.manifold.markets/v0/market/MARKET_ID/resolve" \
-H "Authorization: Key YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"outcome": "YES"}'bash
curl -X POST "https://api.manifold.markets/v0/market/MARKET_ID/resolve" \
-H "Authorization: Key YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"outcome": "YES"}'Get Your Portfolio
获取个人投资组合
bash
curl -s "https://api.manifold.markets/v0/get-user-portfolio?userId=YOUR_USER_ID" | jq '.'bash
curl -s "https://api.manifold.markets/v0/get-user-portfolio?userId=YOUR_USER_ID" | jq '.'Get Top Positions on a Market
获取市场中的顶级持仓用户
bash
curl -s "https://api.manifold.markets/v0/market/MARKET_ID/positions?top=5&order=profit" | jq '.[].userName'bash
curl -s "https://api.manifold.markets/v0/market/MARKET_ID/positions?top=5&order=profit" | jq '.[].userName'Paginate Through All Markets (by newest)
分页获取所有市场(按最新创建)
bash
undefinedbash
undefinedPage 1
第一页
curl -s "https://api.manifold.markets/v0/search-markets?sort=newest&limit=100" > page1.json
curl -s "https://api.manifold.markets/v0/search-markets?sort=newest&limit=100" > page1.json
Page 2: use createdTime of last result
第二页:使用上一页最后一条结果的createdTime
BEFORE_TIME=$(jq '.[-1].createdTime' page1.json)
curl -s "https://api.manifold.markets/v0/search-markets?sort=newest&limit=100&beforeTime=$BEFORE_TIME" > page2.json
undefinedBEFORE_TIME=$(jq '.[-1].createdTime' page1.json)
curl -s "https://api.manifold.markets/v0/search-markets?sort=newest&limit=100&beforeTime=$BEFORE_TIME" > page2.json
undefinedPaginate Through Bets
分页获取交易记录
bash
undefinedbash
undefinedFirst page
第一页
curl -s "https://api.manifold.markets/v0/bets?contractId=MARKET_ID&limit=100" > bets1.json
curl -s "https://api.manifold.markets/v0/bets?contractId=MARKET_ID&limit=100" > bets1.json
Next page: use ID of last bet
下一页:使用上一页最后一条交易记录的ID
BEFORE=$(jq -r '.[-1].id' bets1.json)
curl -s "https://api.manifold.markets/v0/bets?contractId=MARKET_ID&limit=100&before=$BEFORE" > bets2.json
undefinedBEFORE=$(jq -r '.[-1].id' bets1.json)
curl -s "https://api.manifold.markets/v0/bets?contractId=MARKET_ID&limit=100&before=$BEFORE" > bets2.json
undefinedSend Mana to Users
向用户发送Mana
bash
curl -X POST "https://api.manifold.markets/v0/managram" \
-H "Authorization: Key YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"toIds": ["USER_ID_1", "USER_ID_2"], "amount": 100, "message": "Thanks!"}'bash
curl -X POST "https://api.manifold.markets/v0/managram" \
-H "Authorization: Key YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"toIds": ["USER_ID_1", "USER_ID_2"], "amount": 100, "message": "谢谢!"}'Post a Comment
发布评论
bash
curl -X POST "https://api.manifold.markets/v0/comment" \
-H "Authorization: Key YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"contractId": "MARKET_ID", "markdown": "Great question! I think YES is undervalued."}'bash
curl -X POST "https://api.manifold.markets/v0/comment" \
-H "Authorization: Key YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"contractId": "MARKET_ID", "markdown": "很棒的问题!我认为YES被低估了。"}'WebSocket Subscription (Node.js)
WebSocket订阅示例(Node.js)
javascript
const ws = new WebSocket("wss://api.manifold.markets/ws");
let txid = 0;
ws.onopen = () => {
ws.send(JSON.stringify({
type: "subscribe",
txid: txid++,
topics: ["global/new-bet"]
}));
};
ws.onmessage = (event) => {
const msg = JSON.parse(event.data);
if (msg.type === "broadcast") {
console.log("New bet:", msg.data);
}
};
// Keep-alive ping every 30 seconds
setInterval(() => {
ws.send(JSON.stringify({ type: "ping", txid: txid++ }));
}, 30000);javascript
const ws = new WebSocket("wss://api.manifold.markets/ws");
let txid = 0;
ws.onopen = () => {
ws.send(JSON.stringify({
type: "subscribe",
txid: txid++,
topics: ["global/new-bet"]
}));
};
ws.onmessage = (event) => {
const msg = JSON.parse(event.data);
if (msg.type === "broadcast") {
console.log("新交易:", msg.data);
}
};
// 每30秒发送一次ping以保持连接
setInterval(() => {
ws.send(JSON.stringify({ type: "ping", txid: txid++ }));
}, 30000);Usage Tips
使用技巧
- All timestamps are UNIX milliseconds (JavaScript style), not seconds.
Date.now() - Never hardcode API keys — use environment variables or secure key storage.
- Market URLs always point to regardless of which API instance you're using. The username in the URL path doesn't need to be correct (e.g.,
https://manifold.marketsworks).manifold.markets/anyone/market-slug - GET parameters go in the query string. POST/PUT parameters go in the JSON body.
- Limit orders with crossing the current market price will partially fill immediately. Any unfilled remainder stays as a resting limit order.
limitProb - precision: Only whole percentage points (two decimal places, e.g.,
limitProb,0.01,0.50).0.99 - Multi-choice markets come in two flavors: dependent (, probabilities sum to 100%) and independent (each answer is effectively a separate binary market).
shouldAnswersSumToOne=true - Combine REST + WebSocket for best results: use REST for initial state, WebSocket for real-time deltas.
- Paginate responsibly: For with
/search-markets, usesort=newestfor efficient deep pagination. ForbeforeTimeand/bets, use cursor-based pagination with/markets/before.after - Market token type matters: check the field (
tokenorMANA) to know if a market uses play-money or prize-cash.CASH - Dry run bets by passing to simulate without placing.
dryRun: true - Description formats: You can provide market descriptions as plain text (), HTML (
description), Markdown (descriptionHtml), or TipTap JSON (descriptionMarkdown). Only provide one.descriptionJson
- 所有时间戳均为UNIX毫秒级(与JavaScript 格式一致),而非秒级。
Date.now() - 切勿硬编码API密钥——请使用环境变量或安全的密钥存储方式。
- 市场URL始终指向,无论你使用哪个API实例。URL路径中的用户名无需正确(例如
https://manifold.markets也可访问)。manifold.markets/anyone/market-slug - GET参数需放在查询字符串中,POST/PUT参数需放在JSON请求体中。
- 限价单的若与当前市场价格交叉,会立即部分成交,未成交部分会保持挂单状态。
limitProb - 精度:仅支持整数百分比(两位小数,例如
limitProb、0.01、0.50)。0.99 - 多选项市场分为两种类型:依赖型(,概率总和为100%)和独立型(每个答案相当于独立的二元市场)。
shouldAnswersSumToOne=true - 结合REST与WebSocket使用以获得最佳效果:使用REST获取初始状态,使用WebSocket获取实时增量更新。
- 合理分页:对于且
/search-markets,使用sort=newest实现高效深度分页;对于beforeTime和/bets,使用基于游标的分页方式(/markets/before)。after - 市场代币类型很重要:请检查字段(
token或MANA)以确定市场使用虚拟货币还是奖励现金。CASH - 模拟交易可通过传入实现,不会实际下单。
dryRun: true - 描述格式:市场描述可提供为纯文本()、HTML(
description)、Markdown(descriptionHtml)或TipTap JSON(descriptionMarkdown),仅需提供其中一种。descriptionJson
Error Handling
错误处理
API responses are JSON. Successful requests return HTTP 200 with a JSON result. Error responses (4xx/5xx) return a JSON object with an error message.
| Status | Meaning |
|---|---|
| 200 | Success |
| 400 | Bad request (invalid parameters) |
| 401 | Unauthorized (missing or invalid API key) |
| 403 | Forbidden (insufficient permissions) |
| 404 | Not found |
| 429 | Rate limited (500 req/min exceeded) |
| 5xx | Server error |
Implement retry with exponential backoff for 429 and 5xx responses.
API响应均为JSON格式。成功请求返回HTTP 200及JSON结果。错误响应(4xx/5xx)返回包含错误消息的JSON对象。
| 状态码 | 含义 |
|---|---|
| 200 | 请求成功 |
| 400 | 请求参数错误 |
| 401 | 未授权(API密钥缺失或无效) |
| 403 | 禁止访问(权限不足) |
| 404 | 资源不存在 |
| 429 | 请求频率超限(超过每分钟500次) |
| 5xx | 服务器内部错误 |
收到429或5xx响应时,请实现指数退避重试机制。
Internal API
内部API
Manifold has some internal endpoints not part of the official API. These are undocumented and subject to change without notice.
| Endpoint | Method | Auth | Description |
|---|---|---|---|
| POST | Yes | Unresolve a market. Param: |
Note: Internal endpoints are not prefixed with .
/v0Manifold有一些未纳入官方API的内部端点,这些端点未被文档化,且可能在无通知的情况下变更。
| 端点 | 方法 | 身份验证 | 描述 |
|---|---|---|---|
| POST | 是 | 撤销市场的结算状态。参数: |
注意:内部端点不以为前缀。
/v0/Versioning
版本控制
The current API version is v0 under . The API is still in alpha. Monitor the official documentation and the Discord for breaking changes.
/v0/