GuidesBuild schemas by venue
Step zero — from nothing to your first trade
Section titled “Step zero — from nothing to your first trade”- Create the account. Open polymarket.com, connect a Polygon-capable EOA, and follow the venue’s current account and eligibility prompts. Predictefy has no verified information on a separate identity-check flow; confirm it with the venue.
- Set up credentials. If this is your first wallet, create one, store its seed phrase offline,
and never share the private key. Predictefy never sees that key. You do not mint CLOB credentials
manually: on the first direct SDK call, the wallet signs Polymarket’s
ClobAuthmessage and the SDK derives existing CLOB credentials or creates them locally. - Fund it. A practical first test is about $10–$25 of pUSD on Polygon (
137), not a venue minimum. If funds are elsewhere, useGET /v1/bridge/quote; existing USDC.e can also be wrapped through the documented funding steps. - Allow time. Budget 1–2 hours for a first wallet and cross-chain funding; much less if both are ready.
Polymarket applies regional eligibility rules and evaluates the submitting connection. Do not mask your location.
What you need first
Section titled “What you need first”- Production status: Enabled for build, submit, and cancel. Hosted requests use eligible regional egress and reach Polymarket; a live credentialed submit has not yet been verified on that path. The venue-direct SDK remains supported.
- Wallet and chain: A Polygon (
137) EOA signs. The funds-holding maker may instead be a Polymarket Proxy or Safe for signature type1or2, or, when enabled, a Deposit Wallet for signature type3. - Venue account: Use a Polymarket-eligible wallet/account. The SDK derives or creates its CLOB credentials for the verified signer and account.
- Credentials: On
client.accounts.polymarket, the wallet key and CLOB key/secret/passphrase stay in the caller’s process and go only to Polymarket. The hosted path accepts the triple transiently through eligible regional egress. - Funding: Polygon pUSD in the EOA, Proxy, or Safe, with approval to the applicable V2 CTF or NegRisk exchange. LI.FI can land pUSD; existing USDC.e can be wrapped through the documented funding steps.
Polymarket is server-built by default. Send plain intent parameters; Predictefy resolves the CLOB
token through its own catalog, fails closed unless live GET /version returns exactly 2, and
reads the token-bound tick, fee details, and NegRisk value from GET /clob-markets/{conditionId}.
The CLOB NegRisk value must agree with Gamma for a new server build. Predictefy then returns the
complete unsigned V2 EIP-712 order. The server never receives a private key or signs the order.
| Field | Type | Required | Meaning |
|---|---|---|---|
asset | uint256 decimal string or safe integer | this or outcome + outcomeSide | Catalog outcome id / CLOB token id |
outcome | string or safe integer | with outcomeSide | Catalog market id |
outcomeSide | "YES" or "NO" | with outcome | Selects the market’s catalog outcome token |
isBuy | boolean | yes | BUY when true, SELL when false |
price | number or numeric string in (0, 1) | yes | Rounded with the live CLOB tick rules |
size | number or numeric string > 0 | yes, except a market BUY | Outcome shares; rounded down to two decimals |
amount | number or numeric string > 0 | market BUY only (when enabled) | USD to spend on a FAK or FOK BUY |
orderType | GTC, GTD, FAK, or FOK | no (when enabled) | Explicit order type; omitted keeps GTC/GTD from expiresAt |
postOnly | boolean (default false) | no (when enabled) | Maker-only on GTC/GTD; refused on FAK/FOK |
owner | 0x… EVM address | yes | Controlling EOA signer and CLOB POLY_ADDRESS identity |
funder | 0x… EVM address | signature type 1, 2, or 3 | Proxy/Safe maker, or the Deposit Wallet; must differ from owner |
signatureType | 0, 1, 2, or 3 (default 0) | no | EOA, Proxy, Gnosis Safe, or Deposit Wallet (3, when enabled) |
expiresAt | non-negative Unix seconds (default 0) | no | Wire-only expiration: 0 builds GTC; positive builds GTD |
metadata | bytes32 hex (default zero bytes32) | no | Signed V2 metadata |
builder | bytes32 hex (default zero bytes32) | no | Signed V2 builder code |
outcome + outcomeSide resolves binary Yes/No outcomes only. On a market with named outcomes,
pass the outcome’s CLOB token id as asset; outcomeSide answers 404 MARKET_NOT_FOUND.
For signature type 0, omit funder or set it equal to owner; the order has
maker = signer = owner. For types 1 and 2, funder is required and must differ from owner;
the signed order has maker = funder and signer = owner, and the EOA owner signs and remains the
CLOB L2-auth identity.
Deposit wallets and market orders
Section titled “Deposit wallets and market orders”These additions are available when the deployment enables them. Otherwise orderType and
amount are rejected as unexpected fields and signature type 3 is refused, exactly as before.
A rollback also refuses stored type 3, echoed Proxy/Safe and server-built FAK/FOK orders at
hosted submit and client-direct reserve; they work again when the deployment re-enables them.
Venue rules come from Polymarket’s order
guide and wallet
types.
- Deposit Wallet (
signatureType: 3). Polymarket accounts deployed on or after May 4, 2026 trade from a Deposit Wallet. Pass the wallet asfunderand its controlling EOA asowner. The signed order hasmaker = signer = funder. The artifact also carriesowner, which stays the CLOBPOLY_ADDRESSidentity for submit, status, and cancel. - Signing a deposit-wallet order. The EOA signs Polymarket’s ERC-7739
TypedDataSignpayload, not theOrdertyped data in the envelope. Use the returneddomainand the typesTypedDataSign(contentsof typeOrder, thenname,version,chainId,verifyingContract,salt) plusOrder. In the message,contentsis the returnedmessage,nameis"DepositWallet",versionis"1",chainIdis137,verifyingContractisorder.maker, andsaltis zero bytes32. Then append the documented wrap: the exchange domain separator, theOrdercontents hash, theOrdertype string, and its 2-byte length. - How Predictefy checks it. On hosted submit, Predictefy rebuilds that wrap from the stored
order and requires the inner signature to recover to
owner. It then calls the wallet’s ERC-1271isValidSignatureon Polygon, as the exchange does. A wrong signature answers400. An unavailable chain read answers a retryable502, and nothing reaches the venue. A deployment with no Polygon RPC configured answers a retryable503. Neither failure consumes the hosted reservation, so the same execution can be retried once the RPC answers. The client-direct route (build, reserve, send, acknowledge) sends no signature to Predictefy, so Polymarket verifies it there. - Echoed builds. Echoed
buildResultorders may also use signature types1,2, and3. A type3echo must send the EOAownernext tobuildResult. - Market orders (
orderType: "FAK"or"FOK"). FAK fills what it can at once and cancels the rest. FOK fills completely or not at all.priceis the worst acceptable price: the most a BUY pays per share, or the least a SELL accepts. It must sit on the market tick. A BUY takesamount, the USD to spend, and nosize. A SELL takessize, the shares to sell, and noamount. OmitexpiresAt, because market orders carry expiration0. - Market order checks. The rounded share quantity must meet the market’s minimum order size.
A BUY whose rounded amounts would cross the worst price is refused. Spend caps and reservations
use the worst-price notional, so a BUY reserves its full
amount. - Explicit
GTCandGTD.GTCrefuses anexpiresAt, andGTDrequires a positive one. OmittingorderTypekeeps today’s choice fromexpiresAt.
Post-only limit orders
Section titled “Post-only limit orders”Post-only is available when the deployment enables it; otherwise postOnly is rejected as an
unexpected field, exactly as before. Send postOnly: true on a GTC or GTD limit order to add
liquidity only: if the order would match immediately, the venue refuses it instead of taking.
Every supported signature type accepts the flag. A FAK or FOK order with postOnly
answers 400. The flag is relayed beside the signed order, so it never changes the signature or
its EIP-712 digest. Omitting it, or sending false, keeps the request byte-identical to before
the feature. A rollback refuses a stored post-only order at submit and reserve.
Batch cancellation
Section titled “Batch cancellation”When the deployment enables it, POST /v1/exec/polymarket/orders/batch-cancel builds ONE cancel
intent for 1 to 20 of your own executions. Submit the returned execution through
/v1/exec/polymarket/orders/submit with your CLOB credentials, exactly like a single cancel. The
submit sends one venue DELETE /orders carrying exactly the targets’ stored venue order ids. The
venue’s market-wide and account-wide cancel endpoints are never called.
Only orders the service itself relayed and the venue acknowledged on our submit path are eligible.
An execution recorded through the client-direct acknowledgment route is refused, because two
accounts may share one venue owner and credential. It stays cancellable one by one. Every target
must share one owner. The build answers 501 while the deployment switch is off.
On submit, submittedArtifact.results carries one entry per order id, in request order, and the
row is canceled only when every entry confirmed. A partial or refused batch is failed with a
bounded summary such as “1 of 2 orders cancelled”. Entry failures use the closed
CANCEL_ACTION_* codes; venue free text is never returned. Repeating a build or submit with the
same Idempotency-Key replays the original and charges nothing more.
GET /v1/exec/venues includes cancelMany: true only while this feature is on.
Cancel by market or all. There is no server route for these scopes. The SDK helpers
exec.cancelOrdersByMarket and exec.cancelOpenOrders page your open executions through
GET /v1/exec/polymarket/orders?status=open (100 per page by default), skip rows whose intent is
not an order (redeem, modify or cancel), client-direct acknowledgments and orders with no venue
id, then build and submit batch-cancel intents of at most 20. A busy account therefore makes several calls; each batch is its own execution and charge.
Pass your CLOB credentials once in submit, and an optional marketId for the market scope.
The SDK’s venue-direct helper below still builds signature types 0 to 2 limit orders. For
deposit wallets and market orders, use the generic build, reserve, and acknowledge calls.
The response keeps the established unsigned envelope (order, domain, structHash, exchange,
collateral, NegRisk disclosures) and carries buildVersion: 2 plus canonical types,
primaryType: "Order", and message.
Pass those typed-data fields directly to eth_signTypedData_v4. The signed V2 order fields, in
order, are salt, maker, signer, tokenId, makerAmount, takerAmount, side,
signatureType, timestamp, metadata, and builder. timestamp is generated in Unix
milliseconds. expiration remains in the relayed wire order for GTC/GTD but is not signed.
V1-only taker, nonce, and feeRateBps fields are neither accepted nor relayed. Fees are
set by the market and estimated from the live market fd curve, plus the live builder taker fee
when a nonzero builder is used. feeEstimate.fee is a taker fee estimate in USD. Both sides pay
it in pUSD collateral on the V2 exchange: a BUY pays the fee in pUSD, not outcome tokens, and a
SELL has it deducted from its pUSD proceeds. The archived CTF Exchange V1 charged its own
BUY-side base fee in outcome tokens, but a V2 order carries no fee rate, so that V1 fee does not
apply. Polymarket charges makers no fee, so an order that rests as a maker pays none. A nonzero
builder must be a code the venue has registered; an unknown code answers
400 UNKNOWN_BUILDER_CODE, is not retryable, and never reaches the venue order relay.
The domain is Polymarket CTF Exchange, version 2, on chain 137. The standard exchange is
0xE111180000d2663C0091e4f400237545B87B996B; NegRisk uses
0xe2222d279d744050d28e00520010520000310F59. Both settle pUSD
(0xC011a7E12a19f7B1f670d46F03B03f3342E82DFB) with six decimals. The echoed buildResult path
also requires V2; a V1 echo is rejected as a new-order artifact.
Orders also need Polymarket’s trading approvals: pUSD to buy, outcome tokens to sell, plus the Neg Risk Adapter on NegRisk markets. The CLOB rejects an order without them. The accounts guide lists the spender addresses.
Client-side submit: the working Polymarket route
Section titled “Client-side submit: the working Polymarket route”Polymarket geo-evaluates the network connection that submits the CLOB order. Hosted requests use
eligible regional egress, and venue reads and order requests reach Polymarket through it; a live
credentialed submit remains unverified. The caller-direct SDK route remains supported: it uses Predictefy only to
build the complete unsigned order, reconstructs and verifies that server artifact, signs it with the
caller’s wallet, and sends the signed order directly from the caller’s connection to
https://clob.polymarket.com.
import { Predictefy, PREDICTEFY_EXEC_BASE_URL } from '@predictefy/sdk';
const client = new Predictefy({ apiKey: process.env.PREDICTEFY_API_KEY, execBaseUrl: PREDICTEFY_EXEC_BASE_URL, venueCredentials: { polymarket: { address: account.address } },});
const placed = await client.accounts.polymarket.createOrder( { idempotencyKey: 'your-stable-build-key', asset: '987654321', isBuy: true, price: 0.4, size: 10, owner: account.address, signatureType: 0, }, account,);
const accountAuth = { address: account.address, signer: account };const status = await client.accounts.polymarket.fetchOrder(placed.orderId, accountAuth);const canceled = await client.accounts.polymarket.cancelOrder(placed.orderId, accountAuth);Before signing, the SDK binds the returned token, side, rounded maker/taker amounts, identities,
signature type, metadata, builder, and expiration to the original caller intent. Only an explicit
allowlist of plain order fields crosses the hosted build boundary; an unknown field is rejected by
name while its value remains redacted. Both token-selection modes are independently bound. With
asset, the signed CLOB token id must equal the caller’s value and the SDK performs no Gamma
lookup. With outcome + outcomeSide, the SDK sends the caller-pinned catalog id — never a
builder-selected condition or market id — to https://gamma-api.polymarket.com/markets/{id},
requires exactly one case-insensitive Yes and one No outcome, and checks the signed token against
the requested side by array position. Gamma’s authoritative negRisk boolean also pins the EIP-712
domain to the fixed standard or NegRisk exchange. The Gamma request carries no headers, refuses
redirects, and its immutable mapping is cached per SDK client. A venue-read failure, malformed
mapping, foreign-market token, opposite-side token, or exchange mismatch is a typed refusal before
signTypedData.
On the first call, the SDK asks the same wallet to sign Polymarket’s ClobAuth EIP-712 message,
tries to derive the wallet’s existing CLOB API credentials, and creates them if no credential
exists for nonce 0. It caches the triple by explicit account and verified signer address. Every
cache lookup re-verifies the signer, and authenticated status, cancel, and open-orders calls require
an explicit account context. You may instead provide an existing triple under
venueCredentials.polymarket for that address.
The private key remains inside the caller’s signer. The order signature, ClobAuth signature,
CLOB API credentials, and HMAC headers never transit Predictefy’s servers. The optional hosted fetch
override is never reused for venue traffic; a separate credential-trusted venueFetch override is
available when required. Credentialed requests are pinned to clob.polymarket.com, every redirect
is refused, and transport/HTTP failures return only typed generic errors without upstream text.
This path exposes the caller’s real connection to the venue; callers must still satisfy
Polymarket’s own account and jurisdiction rules and must not mask their location.
The endpoint shapes follow current official Polymarket documentation. Before relying on this route in production, complete one full eligible-wallet derive, create, submit, status, and cancel pass.