Skip to main content
The Polymarket Order Router enables server-side order placement on Polymarket through Dome’s infrastructure. Orders are signed locally by your users’ wallets and executed via Dome servers, providing improved order execution through builder attribution.

Key Benefits

  • Builder attribution: Orders routed through Dome’s builder for better execution
  • No signature popups: After initial setup, no wallet signatures needed per order
  • Wallet flexibility: Supports Privy embedded wallets and external wallets (MetaMask, Rabby)

Prerequisites

Before using the Order Router, you need:
  1. A Dome API key from dashboard.domeapi.io
  2. The @dome-api/sdk package installed
  3. A wallet provider (Privy for embedded wallets, or any EVM wallet for external wallets)
  4. USDC.e funded on Polygon for your users’ wallets

Installation

For Privy integration:

Quick Start

1. Initialize the Router

2. Create a Signer

For Privy embedded wallets:
For external wallets, implement the RouterSigner interface:
Link the user to Polymarket to create CLOB API credentials. This requires one wallet signature.

4. Place Orders

Once linked, place orders without additional wallet signatures:

Order Flow

REST Endpoint

The SDK uses the following REST endpoint under the hood. You can also call it directly if you’re not using the TypeScript SDK.

POST /polymarket/placeOrder

Endpoint: https://api.domeapi.io/v1/polymarket/placeOrder Headers:
Request Body (JSON-RPC):
Response:
Order Status Values:
  • LIVE - Order is on the orderbook
  • MATCHED - Order was filled immediately
  • DELAYED - Order is being processed
Error Response:

SDK Reference

PolymarketRouter

Initialize the router with your configuration:

linkUser(params)

Creates Polymarket CLOB API credentials. Returns credentials that should be stored in your database. Returns: PolymarketCredentials for EOA wallets, or SafeLinkResult for Safe wallets.

placeOrder(params, credentials?)

Places an order on Polymarket via Dome server. Returns: Order result with status and transaction hashes.

setCredentials(userId, credentials)

Manually set credentials loaded from your database:

getCredentials(userId)

Get stored credentials from memory:

Order Types

For copy trading or instant confirmation, use FOK or FAK:

Wallet Types

EOA Wallets (Privy Embedded)

For Privy-managed embedded wallets:

Safe Wallets (External - MetaMask, Rabby)

For external wallets, the router deploys a Safe smart account:

Credential Storage

Store credentials securely in your database after the initial linkUser call:

Error Handling

Environment Variables

FAQ

Q: Do I need a Dome API key? Yes, for placeOrder(). Get one at domeapi.io or contact support. Q: Where do I store credentials? In your own database. Encrypt apiSecret and apiPassphrase at rest. Q: Why use Dome server instead of direct CLOB? Geo-unrestricted access, builder attribution for better execution, and observability. Q: What’s the minimum order size? 1minimumordervalue(e.g.,100sharesat1 minimum order value (e.g., 100 shares at 0.01 = $1). Q: How do I find market IDs (token IDs)? Browse markets at polymarket.com or use the Dome API markets endpoint.

Need Help?