Place order
Place a limit order with a POST request. When the market reaches your desired price, the bet is placed automatically. Send the market id, side, trigger price, and amount.
Base URL
All API requests use this base:
HTTP request
Send a POST request to the place-order endpoint with the required headers and a JSON body containing the market id, side, trigger price, and amount.
Endpoint
POST https://nqyocjuqubsdrguazcjz.supabase.co/rest/v1/rpc/place_order
Required headers
Content-Type: application/json apikey: <your-api-key> Accept: application/json
Include the apikey header and set Content-Type: application/json for the request body.
Request body
JSON object with the following fields:
- market_id (string, required) — The unique ID of the market (e.g. from Get market by id or the markets list).
- side (string, required) — The outcome to bet on: "yes" or "no".
- trigger_price (number, required) — The price at which the bet should execute, between 0 and 1 (e.g. 0.65 for 65¢). When the market’s current price reaches this level, the order is filled.
- amount (number, required) — The amount to bet in $PREDICT when the trigger is hit (pre-fee). Must be greater than 0.
Example body:
{
"market_id": "550e8400-e29b-41d4-a716-446655440000",
"side": "yes",
"trigger_price": 0.65,
"amount": 100
}Response
On success, the API returns 200 with a JSON object indicating the order was placed (it may be filled immediately or remain open until the trigger price is reached):
{
"success": true,
"data": {
"order_id": "uuid",
"market_id": "string",
"side": "yes",
"trigger_price": number,
"amount": number,
"status": "open" | "filled" | "cancelled",
"created_at": "ISO8601 string",
"filled_at": "ISO8601 string | null"
}
}On error, the API returns an appropriate HTTP status (e.g. 400 for invalid parameters, 401 for missing or invalid API key, 404 if the market does not exist):
{
"error": "Error message describing what went wrong"
}