Audience: developers. This is a hands-on, copy-paste guide. For eligibility, agreements, and the business setup, see ISVs / IBs and Partner Onboarding.
- Authenticated with the API as your Firm — your only credential; every action after this is on behalf of a participant
- Onboarded a Retail Participant via KYC and captured their trading account
- Previewed and placed an on-demand funded order on their behalf
- Seen where the money moves — and how settled funds sweep back
Prerequisites: Complete Partner Onboarding to receive your Client ID and register your public key, and have your funding relationship configured (On-Demand Funding is Beta, enabled per partner). This guide uses pre-production (
api.preprod.polymarketexchange.com).Step 1: Authenticate
Authentication uses Private Key JWT — you sign a JWT with your private key and exchange it for a short-lived access token. The full mechanism, claims, and key rotation are covered in the Authentication guide; the complete, runnable token code is in the full script at the bottom of this page. Once you have a token, set your auth header and confirm your identity withGET /v1/whoami:
Your Firm authenticates; it never trades. The Firm identity above is a permissions container — it holds no funds and places no orders of its own. Every trading action in this guide is performed on behalf of a Retail Participant: participant-scoped REST calls (positions, reports) identify them with the
x-participant-id header — see Authentication → Acting on behalf of a participant — while funded orders carry the participant’s trading account (customer_account_id) in the request body. You’ll capture both identifiers in Step 2.Step 2: Onboard a participant (KYC)
Before you can fund and place an order for a Retail Participant, they must pass KYC. Submit their identity data withPOST /v1/kyc/start:
kyc.approved event, which carries the two identifiers you need:
provisioned_participant(e.g.firms/ISV-Participant-Acme/users/user-123) — thex-participant-idvalue for participant-scoped REST calls.- The participant’s provisioned trading account — the
customer_account_idfor funded orders. You can also list accounts under your Firm at any time:
No deposit step. The account is provisioned with a $0 balance and that’s fine — on-demand funding moves the exact cost of each order into the account at placement time. The participant can trade the moment KYC clears.
Step 3: Pick a market
Funded orders identify markets by slug. Discover markets with the Market API, then confirm the one you want:orderPriceMinTickSize and minimumTradeQty from the response to validate prices and quantities before submitting.
Step 4: Preview the funded order
The funding API is gRPC-only (OrderFundingService). PreviewFundedOrder quotes the full prefund — collateral, exchange fee reserve, and your vendor fee — without moving funds, so you can show the participant the cost before they commit:
Step 5: Place the funded order
CreateFundedOrder transfers the total prefund from your partner funding account into the participant’s account and submits the order — one idempotent call:
On transport errors (
UNAVAILABLE, timeouts), also retry with the same key — it can never double-fund or double-place. See idempotency and retries.
Step 6: Watch the money
Every cash movement is visible in real time — this is how your backend knows what happened and when funds become sweepable:- The prefund transfer (and any compensating reversal) appears on the Balance Ledger Stream for the participant account and your funding account.
- Fills arrive on the Drop Copy Stream; per-execution fee collection and settlement credits land on the ledger.
- Log the
correlationidentifiers (idempotency_key,funding_request_id,request_id) from every response — they tie ledger entries back to orders.
Step 7: Sweep settled funds back
After fills settle, cancels release collateral, or positions close, cash accumulates in the participant’s account — it does not move back automatically. Your backend watches the ledger, determines the sweepable amount per your agreements, and initiates a sweep back to the partner funding account. See settlement and sweeps for the lifecycle, and Settlement Sweeps for the planned sweep API contract.Complete example
A single runnable script covering the funded-order path — including the full token exchange (see the Authentication guide for an explanation of each claim). KYC is omitted because its terminal outcome arrives on your webhook; run Step 2 once and plug in the resulting account:polymarket.us.orderfunding.v1 stubs are generated from the funding API protos provided during beta enablement — contact institutional@polymarket.us if you don’t have them.
Next steps
On-Demand Funding
The full model — parties, cost model, sweeps, and reconciliation.
KYC Verification
All four verification outcomes and webhook handling.
Balance Ledger Stream
Track every prefund, fill, and settlement credit in real time.
Authentication
Token refresh, key rotation, and scopes.