Docs update 2026-04-17: CLOB V2 migration guide, changelog Apr 17 update, new endpoints
This commit is contained in:
@@ -62,14 +62,14 @@ Before making authenticated requests, you need to obtain API credentials using L
|
||||
<Tabs>
|
||||
<Tab title="TypeScript">
|
||||
```typescript theme={null}
|
||||
import { ClobClient } from "@polymarket/clob-client";
|
||||
import { ClobClient } from "@polymarket/clob-client-v2";
|
||||
import { Wallet } from "ethers"; // v5.8.0
|
||||
|
||||
const client = new ClobClient(
|
||||
"https://clob.polymarket.com",
|
||||
137, // Polygon mainnet
|
||||
new Wallet(process.env.PRIVATE_KEY)
|
||||
);
|
||||
const client = new ClobClient({
|
||||
host: "https://clob.polymarket.com",
|
||||
chain: 137, // Polygon mainnet
|
||||
signer: new Wallet(process.env.PRIVATE_KEY),
|
||||
});
|
||||
|
||||
// Creates new credentials or derives existing ones
|
||||
const credentials = await client.createOrDeriveApiKey();
|
||||
@@ -90,7 +90,7 @@ Before making authenticated requests, you need to obtain API credentials using L
|
||||
|
||||
client = ClobClient(
|
||||
host="https://clob.polymarket.com",
|
||||
chain_id=137, # Polygon mainnet
|
||||
chain=137, # Polygon mainnet
|
||||
key=os.getenv("PRIVATE_KEY")
|
||||
)
|
||||
|
||||
@@ -137,7 +137,7 @@ Before making authenticated requests, you need to obtain API credentials using L
|
||||
|
||||
### 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) or [TypeScript](https://github.com/Polymarket/clob-client) clients.
|
||||
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**
|
||||
|
||||
@@ -220,8 +220,8 @@ The `POLY_SIGNATURE` is generated by signing the following EIP-712 struct:
|
||||
|
||||
Reference implementations:
|
||||
|
||||
* [TypeScript](https://github.com/Polymarket/clob-client/blob/main/src/signing/eip712.ts)
|
||||
* [Python](https://github.com/Polymarket/py-clob-client/blob/main/py_clob_client/signing/eip712.py)
|
||||
* [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/signing/eip712.py)
|
||||
|
||||
Response:
|
||||
|
||||
@@ -249,24 +249,24 @@ All trading endpoints require these 5 headers:
|
||||
| `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/blob/main/src/signing/hmac.ts) and [Python](https://github.com/Polymarket/py-clob-client/blob/main/py_clob_client/signing/hmac.py) clients.
|
||||
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/signing/hmac.py) clients.
|
||||
|
||||
### CLOB Client
|
||||
|
||||
<Tabs>
|
||||
<Tab title="TypeScript">
|
||||
```typescript theme={null}
|
||||
import { ClobClient } from "@polymarket/clob-client";
|
||||
import { ClobClient } from "@polymarket/clob-client-v2";
|
||||
import { Wallet } from "ethers"; // v5.8.0
|
||||
|
||||
const client = new ClobClient(
|
||||
"https://clob.polymarket.com",
|
||||
137,
|
||||
new Wallet(process.env.PRIVATE_KEY),
|
||||
apiCreds, // Generated from L1 auth, API credentials enable L2 methods
|
||||
1, // signatureType explained below
|
||||
funderAddress // funder explained below
|
||||
);
|
||||
const client = new ClobClient({
|
||||
host: "https://clob.polymarket.com",
|
||||
chain: 137,
|
||||
signer: new Wallet(process.env.PRIVATE_KEY),
|
||||
creds: apiCreds, // Generated from L1 auth, API credentials enable L2 methods
|
||||
signatureType: 1, // signatureType explained below
|
||||
funderAddress, // funder explained below
|
||||
});
|
||||
|
||||
// Now you can trade!
|
||||
const order = await client.createAndPostOrder(
|
||||
@@ -283,7 +283,7 @@ The `POLY_SIGNATURE` for L2 is an HMAC-SHA256 signature created using the user's
|
||||
|
||||
client = ClobClient(
|
||||
host="https://clob.polymarket.com",
|
||||
chain_id=137,
|
||||
chain=137,
|
||||
key=os.getenv("PRIVATE_KEY"),
|
||||
creds=api_creds, # Generated from L1 auth, API credentials enable L2 methods
|
||||
signature_type=1, # signatureType explained below
|
||||
|
||||
@@ -0,0 +1,183 @@
|
||||
> ## 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 CLOB market info
|
||||
|
||||
> Returns all CLOB-level parameters for a market in a single call —
|
||||
tokens, tick size, base fees, rewards, RFQ status, and fee details.
|
||||
|
||||
|
||||
|
||||
|
||||
## OpenAPI
|
||||
|
||||
````yaml /api-spec/clob-openapi.yaml get /clob-markets/{condition_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:
|
||||
/clob-markets/{condition_id}:
|
||||
get:
|
||||
tags:
|
||||
- Markets
|
||||
summary: Get CLOB market info
|
||||
description: |
|
||||
Returns all CLOB-level parameters for a market in a single call —
|
||||
tokens, tick size, base fees, rewards, RFQ status, and fee details.
|
||||
operationId: getClobMarketInfo
|
||||
parameters:
|
||||
- name: condition_id
|
||||
in: path
|
||||
required: true
|
||||
description: The condition ID of the market
|
||||
schema:
|
||||
type: string
|
||||
example: '0xbd31dc8a20211944f6b70f31557f1001557b59905b7738480ca09bd4532f84af'
|
||||
responses:
|
||||
'200':
|
||||
description: Successfully retrieved CLOB market info
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/ClobMarketDetails'
|
||||
'400':
|
||||
description: Bad request - Invalid condition ID
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/ErrorResponse'
|
||||
'500':
|
||||
description: Internal server error
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/ErrorResponse'
|
||||
components:
|
||||
schemas:
|
||||
ClobMarketDetails:
|
||||
type: object
|
||||
description: >-
|
||||
CLOB-level parameters for a market — tokens, tick size, base fees,
|
||||
rewards, RFQ status, and fee details.
|
||||
properties:
|
||||
gst:
|
||||
type: string
|
||||
format: date-time
|
||||
nullable: true
|
||||
description: >-
|
||||
Game start time (used for sports markets), ISO 8601 timestamp or
|
||||
null
|
||||
r:
|
||||
$ref: '#/components/schemas/ClobRewards'
|
||||
t:
|
||||
type: array
|
||||
description: Tokens for this market
|
||||
items:
|
||||
$ref: '#/components/schemas/ClobToken'
|
||||
mos:
|
||||
type: number
|
||||
format: float
|
||||
description: Minimum order size
|
||||
example: 5
|
||||
mts:
|
||||
type: number
|
||||
format: float
|
||||
description: Minimum tick size (price increment)
|
||||
example: 0.01
|
||||
mbf:
|
||||
type: integer
|
||||
format: int64
|
||||
description: Maker base fee in basis points
|
||||
example: 0
|
||||
tbf:
|
||||
type: integer
|
||||
format: int64
|
||||
description: Taker base fee in basis points
|
||||
example: 0
|
||||
rfqe:
|
||||
type: boolean
|
||||
description: Whether RFQ (Request for Quote) is enabled for this market
|
||||
itode:
|
||||
type: boolean
|
||||
description: Whether taker order delay is enabled
|
||||
ibce:
|
||||
type: boolean
|
||||
description: Whether Blockaid check is enabled
|
||||
fd:
|
||||
$ref: '#/components/schemas/FeeDetails'
|
||||
oas:
|
||||
type: integer
|
||||
description: Minimum order age in seconds
|
||||
ErrorResponse:
|
||||
type: object
|
||||
required:
|
||||
- error
|
||||
properties:
|
||||
error:
|
||||
type: string
|
||||
description: Error message
|
||||
ClobRewards:
|
||||
type: object
|
||||
description: Rewards configuration for a market.
|
||||
additionalProperties: true
|
||||
ClobToken:
|
||||
type: object
|
||||
description: A token in a CLOB market with its ID and outcome label.
|
||||
properties:
|
||||
t:
|
||||
type: string
|
||||
description: The token ID
|
||||
example: >-
|
||||
71321045679252212594626385532706912750332728571942532289631379312455583992563
|
||||
o:
|
||||
type: string
|
||||
description: Outcome label for the token (e.g. "Yes", "No")
|
||||
example: 'Yes'
|
||||
FeeDetails:
|
||||
type: object
|
||||
description: Fee curve parameters for a market.
|
||||
properties:
|
||||
r:
|
||||
type: number
|
||||
format: float
|
||||
nullable: true
|
||||
description: Fee rate
|
||||
example: 0.02
|
||||
e:
|
||||
type: number
|
||||
format: float
|
||||
nullable: true
|
||||
description: Fee curve exponent
|
||||
example: 2
|
||||
to:
|
||||
type: boolean
|
||||
nullable: true
|
||||
description: Whether fees apply to takers only
|
||||
example: true
|
||||
|
||||
````
|
||||
@@ -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 market by token
|
||||
|
||||
> Returns the parent market for a given token ID. Useful when you have
|
||||
a token ID and need to resolve its parent market without knowing the
|
||||
condition ID in advance.
|
||||
|
||||
|
||||
|
||||
|
||||
## OpenAPI
|
||||
|
||||
````yaml /api-spec/clob-openapi.yaml get /markets-by-token/{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:
|
||||
/markets-by-token/{token_id}:
|
||||
get:
|
||||
tags:
|
||||
- Markets
|
||||
summary: Get market by token
|
||||
description: |
|
||||
Returns the parent market for a given token ID. Useful when you have
|
||||
a token ID and need to resolve its parent market without knowing the
|
||||
condition ID in advance.
|
||||
operationId: getMarketByToken
|
||||
parameters:
|
||||
- name: token_id
|
||||
in: path
|
||||
required: true
|
||||
description: The token ID to look up the parent market for
|
||||
schema:
|
||||
type: string
|
||||
responses:
|
||||
'200':
|
||||
description: Successfully retrieved market
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/MarketByTokenResponse'
|
||||
'400':
|
||||
description: Invalid market - empty token_id
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/ErrorResponse'
|
||||
'404':
|
||||
description: Market not found for token
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/ErrorResponse'
|
||||
'500':
|
||||
description: Internal server error
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/ErrorResponse'
|
||||
components:
|
||||
schemas:
|
||||
MarketByTokenResponse:
|
||||
type: object
|
||||
description: >-
|
||||
Response for GET /markets-by-token/{token_id} — condition ID and both
|
||||
token IDs in the market.
|
||||
required:
|
||||
- condition_id
|
||||
- primary_token_id
|
||||
- secondary_token_id
|
||||
properties:
|
||||
condition_id:
|
||||
type: string
|
||||
description: The condition ID of the market containing the given token
|
||||
example: '0xbd31dc8a20211944f6b70f31557f1001557b59905b7738480ca09bd4532f84af'
|
||||
primary_token_id:
|
||||
type: string
|
||||
description: The primary (Yes) token ID
|
||||
example: >-
|
||||
71321045679252212594626385532706912750332728571942532289631379312455583992563
|
||||
secondary_token_id:
|
||||
type: string
|
||||
description: The secondary (No) token ID
|
||||
example: >-
|
||||
52114319501245915516055106046884209969926127482827954674443846427813813222426
|
||||
ErrorResponse:
|
||||
type: object
|
||||
required:
|
||||
- error
|
||||
properties:
|
||||
error:
|
||||
type: string
|
||||
description: Error message
|
||||
|
||||
````
|
||||
Reference in New Issue
Block a user