How to Place Limit Orders with the Polymarket CLOB API

This is a practical walkthrough of placing a limit order on Polymarket programmatically. It is educational — always test with tiny size first, and treat any code as a starting point you must verify against the current API docs.

💡

This guide pairs with our full Polymarket API Guide. Here we focus specifically on getting a limit order placed and confirmed.

Prerequisites

Authenticating with the CLOB

Polymarket uses a two-level auth model: an L1 signature from your wallet key proves ownership, and L2 API credentials authorize requests. Get this right first — signing is where most first-time integrations fail.

from py_clob_client.client import ClobClient

client = ClobClient(
    host="https://clob.polymarket.com",
    key=PRIVATE_KEY,        # keep in an env var, never in code
    chain_id=137,           # Polygon
)
client.set_api_creds(client.create_or_derive_api_creds())

Constructing a limit order

A limit order needs the token ID, a side (BUY/SELL), a price between 0 and 1, and a size. The price is the probability you are willing to pay or accept.

from py_clob_client.clob_types import OrderArgs
from py_clob_client.order_builder.constants import BUY

order_args = OrderArgs(
    token_id=TOKEN_ID,
    side=BUY,
    price=0.42,   # 42c = 42% implied probability
    size=100,     # number of shares
)
signed = client.create_order(order_args)

Price ticks and size rules

Prices must align to the market's tick size and size to its minimums; otherwise the order is rejected. Read these from the market metadata rather than hardcoding them.

Submitting and confirming

resp = client.post_order(signed)
print(resp)   # inspect status: live, matched, or an error

Check the response rather than assuming success. A returned order ID with a “live” status means it is resting on the book; a “matched” status means it filled.

Handling errors and rejections

Cancelling and replacing

To move a quote, cancel the existing order and post a new one. The choice of order type (e.g. good-til-cancelled vs fill-or-kill) determines how the order behaves while it rests.

⚠️

Test every integration with the smallest possible size in a live market before scaling. A logic bug in order construction can place wrong-sized or wrong-side orders — small size caps the damage while you verify.

Automate Polymarket the self-hosted way

PolyBot runs on your own server with your keys — copy trading and an AI strategy, a full dashboard, risk limits, and a kill switch included. One-time purchase.

Frequently Asked Questions

Polymarket provides an official Python client, py-clob-client, which handles authentication, order signing, and submission. Other community libraries exist, but always verify them against the current official API docs.
Price is expressed as a probability between 0 and 1 (for example, 0.42 means 42 cents, or 42% implied probability). Prices must align to the market's tick size or the order is rejected.
Common causes are a price that does not match the tick size, a size below the market minimum, insufficient balance or token allowance, or authentication errors. Inspect the API response, which usually identifies the issue.
PB
Written by the PolyBot Team

We build self-hosted automation tools for Polymarket and write about prediction-market execution, strategy, and risk management. Our guides are educational, not financial advice.

More PolyBot guides →

Disclaimer: This article is for educational purposes only and is not financial, investment, or legal advice. Prediction-market trading carries a real risk of loss. Automation does not guarantee profit, and past performance never guarantees future results. Only trade funds you can afford to lose, and confirm that Polymarket is available and legal in your jurisdiction before trading.

Related Articles

Polymarket API Guide: How the CLOB Works →Polymarket Order Types Explained →Polymarket API Rate Limits →Polymarket WebSocket API →