Overview
drive.markets provides distributed order routing for Polymarket’s CLOB API, delivering low-latency execution through globally distributed routing paths.
Authentication
All API endpoints require authentication using Polymarket’s standard headers:
POLY-API-KEY: Your API key
POLY-SIGNATURE: Request signature (signed with your private key)
POLY-TIMESTAMP: Unix timestamp of the request
POLY-NONCE: Unique nonce for the request
These headers are automatically handled when using the Polymarket SDK.
Using with Polymarket SDK
The API is compatible with Polymarket’s SDK. Simply specify https://poly.drive.markets in the host parameter:
import { ClobClient } from '@polymarket/clob-client';
const host = 'https://clob.polymarket.com'
const orderHost = 'https://poly.drive.markets'
const signer = new Wallet("");
const funder = '';
// 1: Magic/Email Login
// 2: Browser Wallet (Metamask, Coinbase Wallet, etc)
// 0: EOA
const signatureType = 1;
const credsClient = new ClobClient(host, 137, signer).createOrDeriveApiKey();
(async () => {
const creds = await credsClient.createOrDeriveApiKey();
const clobClient = new ClobClient(host, 137, signer, await creds, signatureType, funder);
const orderClient = new ClobClient(orderHost, 137, signer);
const order = await clobClient.createOrder({
tokenID: '0x...',
price: '0.5',
side: 'BUY',
size: '100',
feeRateBps: 100
});
const response = await orderClient.postOrder(order, OrderType.FOK);
return response
})();
Direct API Usage
If you’re not using the SDK, you’ll need to sign the authentication headers manually:
curl -X POST https://poly.drive.markets/order \
-H "POLY-API-KEY: your-api-key" \
-H "POLY-SIGNATURE: your-signature" \
-H "POLY-TIMESTAMP: 1234567890" \
-H "POLY-NONCE: unique-nonce" \
-d '{
"order": {
"salt": 123456789,
"maker": "0x...",
"signer": "0x...",
"taker": "0x...",
"tokenId": "0x...",
"makerAmount": "1000000000000000000",
"takerAmount": "500000000000000000",
"expiration": "1234567890",
"nonce": "0",
"feeRateBps": 100,
"side": "BUY",
"signatureType": 0,
"signature": "0x..."
},
"owner": "your-api-key",
"orderType": "FOK"
}'
Supported Endpoints
- POST /order - Place a single order
- POST /orders - Place multiple orders
- DELETE /order - Cancel a single order
- DELETE /orders - Cancel multiple orders
- DELETE /cancel-all - Cancel all open orders
- DELETE /cancel-market-orders - Cancel orders from a specific market
Next Steps
All orders are routed via best effort basis, with the lowest latency path being automatically selected for optimal performance.