Placing Orders
Detailed instructions for creating, placing, and managing orders using Polymarket’s CLOB API.
Create and Place an Order
Create and place an order using the Polymarket CLOB API clients. All orders are represented as “limit” orders, but “market” orders are also supported. To place a market order, simply ensure your price is marketable against current resting limit orders, which are executed on input at the best price. Thus to:
HTTP REQUEST
POST /<clob-endpoint>/order
Request Payload Parameters
Name | Required | Type | Description |
---|---|---|---|
order | yes | Order | signed object |
owner | yes | string | api key of order owner |
orderType | yes | string | order type (“FOK”, “GTC”, “GTD”) |
An order
object is the form:
Name | Required | Type | Description |
---|---|---|---|
salt | yes | integer | random salt used to create unique order |
maker | yes | string | maker address (funder) |
signer | yes | string | signing address |
taker | yes | string | taker address (operator) |
tokenId | yes | string | ERC1155 token ID of conditional token being traded |
makerAmount | yes | string | maximum amount maker is willing to spend |
takerAmount | yes | string | minimum amount taker will pay the maker in return |
expiration | yes | string | unix expiration timestamp |
nonce | yes | string | maker’s exchange nonce of the order is associated |
feeRateBps | yes | string | fee rate basis points as required by the operator |
side | yes | string | buy or sell enum index |
signatureType | yes | integer | signature type enum index |
signature | yes | string | hex encoded signature |
Order types
- FOK: A Fill-Or-Kill order is an market order to buy (in dollars) or sell (in shares) shares that must be executed immediately in its entirety; otherwise, the entire order will be cancelled.
- GTC: A Good-Til-Cancelled order is a limit order that is active until it is fulfilled or cancelled.
- GTD: A Good-Til-Date order is a type of order that is active until its specified date (UTC seconds timestamp), unless it has already been fulfilled or cancelled. There is a security threshold of one minute. If the order needs to expire in 30 seconds the correct expiration value is: now * 1 mute + 30 seconds
Response Format
Name | Type | Description |
---|---|---|
success | boolean | boolean indicating if server-side err (success = false ) -> server-side error |
errorMsg | string | error message in case of unsuccessful placement (in case success = false , e.g. client-side error , the reason is in errorMsg ) |
orderId | string | id of order |
orderHashes | string[] | hash of settlement transaction order was marketable and triggered a match |
Insert Error Messages
If the errorMsg
field of the response object from placement is not an empty string, the order was not able to be immediately placed. This might be because of a delay or because of a failure. If the success
is not true
, then there was an issue placing the order. The following errorMessages
are possible:
Error
Error | Success | Message | Description |
---|---|---|---|
INVALID_ORDER_MIN_TICK_SIZE | yes | order is invalid. Price breaks minimum tick size rules | order price isn’t accurate to correct tick sizing |
INVALID_ORDER_MIN_SIZE | yes | order is invalid. Size lower than the minimum | order size must meet min size threshold requirement |
INVALID_ORDER_DUPLICATED | yes | order is invalid. Duplicated. Same order has already been placed, can’t be placed again | |
INVALID_ORDER_NOT_ENOUGH_BALANCE | yes | not enough balance / allowance | funder address doesn’t have sufficient balance or allowance for order |
INVALID_ORDER_EXPIRATION | yes | invalid expiration | expiration field expresses a time before now |
INVALID_ORDER_ERROR | yes | could not insert order | system error while inserting order |
EXECUTION_ERROR | yes | could not run the execution | system error while attempting to execute trade |
ORDER_DELAYED | no | order match delayed due to market conditions | order placement delayed |
DELAYING_ORDER_ERROR | yes | error delaying the order | system error while delaying order |
FOK_ORDER_NOT_FILLED_ERROR | yes | order couldn’t be fully filled, FOK orders are fully filled/killed | FOK order not fully filled so can’t be placed |
MARKET_NOT_READY | no | the market is not yet ready to process new orders | system not accepting orders for market yet |
Insert Statuses
When placing an order, a status field is included. The status field provides additional information regarding the order’s state as a result of the placement. Possible values include:
Status
Status | Description |
---|---|
matched | order placed and live |
delayed | order marketable, but subject to matching delay |
unmatched | order marketable, but failure delaying, placement successful |