Skip to content

GuidesBuild schemas by venue

Step zero — from nothing to your first trade

Section titled “Step zero — from nothing to your first trade”
  1. 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.
  2. 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 ClobAuth message and the SDK derives existing CLOB credentials or creates them locally.
  3. Fund it. A practical first test is about $10–$25 of pUSD on Polygon (137), not a venue minimum. If funds are elsewhere, use GET /v1/bridge/quote; existing USDC.e can also be wrapped through the documented funding steps.
  4. 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.

  • 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 type 1 or 2, or, when enabled, a Deposit Wallet for signature type 3.
  • 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.

FieldTypeRequiredMeaning
assetuint256 decimal string or safe integerthis or outcome + outcomeSideCatalog outcome id / CLOB token id
outcomestring or safe integerwith outcomeSideCatalog market id
outcomeSide"YES" or "NO"with outcomeSelects the market’s catalog outcome token
isBuybooleanyesBUY when true, SELL when false
pricenumber or numeric string in (0, 1)yesRounded with the live CLOB tick rules
sizenumber or numeric string > 0yes, except a market BUYOutcome shares; rounded down to two decimals
amountnumber or numeric string > 0market BUY only (when enabled)USD to spend on a FAK or FOK BUY
orderTypeGTC, GTD, FAK, or FOKno (when enabled)Explicit order type; omitted keeps GTC/GTD from expiresAt
postOnlyboolean (default false)no (when enabled)Maker-only on GTC/GTD; refused on FAK/FOK
owner0x… EVM addressyesControlling EOA signer and CLOB POLY_ADDRESS identity
funder0x… EVM addresssignature type 1, 2, or 3Proxy/Safe maker, or the Deposit Wallet; must differ from owner
signatureType0, 1, 2, or 3 (default 0)noEOA, Proxy, Gnosis Safe, or Deposit Wallet (3, when enabled)
expiresAtnon-negative Unix seconds (default 0)noWire-only expiration: 0 builds GTC; positive builds GTD
metadatabytes32 hex (default zero bytes32)noSigned V2 metadata
builderbytes32 hex (default zero bytes32)noSigned 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.

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 as funder and its controlling EOA as owner. The signed order has maker = signer = funder. The artifact also carries owner, which stays the CLOB POLY_ADDRESS identity for submit, status, and cancel.
  • Signing a deposit-wallet order. The EOA signs Polymarket’s ERC-7739 TypedDataSign payload, not the Order typed data in the envelope. Use the returned domain and the types TypedDataSign (contents of type Order, then name, version, chainId, verifyingContract, salt) plus Order. In the message, contents is the returned message, name is "DepositWallet", version is "1", chainId is 137, verifyingContract is order.maker, and salt is zero bytes32. Then append the documented wrap: the exchange domain separator, the Order contents hash, the Order type 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-1271 isValidSignature on Polygon, as the exchange does. A wrong signature answers 400. An unavailable chain read answers a retryable 502, and nothing reaches the venue. A deployment with no Polygon RPC configured answers a retryable 503. 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 buildResult orders may also use signature types 1, 2, and 3. A type 3 echo must send the EOA owner next to buildResult.
  • Market orders (orderType: "FAK" or "FOK"). FAK fills what it can at once and cancels the rest. FOK fills completely or not at all. price is 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 takes amount, the USD to spend, and no size. A SELL takes size, the shares to sell, and no amount. Omit expiresAt, because market orders carry expiration 0.
  • 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 GTC and GTD. GTC refuses an expiresAt, and GTD requires a positive one. Omitting orderType keeps today’s choice from expiresAt.

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.

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.