Place order
curl --request POST \
--url https://relay.bayse.markets/v1/pm/events/{eventId}/markets/{marketId}/orders \
--header 'Content-Type: application/json' \
--data '
{
"side": "<string>",
"outcomeId": "<string>",
"amount": 123,
"type": "<string>",
"currency": "<string>",
"price": 123,
"timeInForce": "<string>",
"postOnly": true,
"stpMode": "<string>",
"maxSlippage": 123,
"expiresAt": "<string>"
}
'import requests
url = "https://relay.bayse.markets/v1/pm/events/{eventId}/markets/{marketId}/orders"
payload = {
"side": "<string>",
"outcomeId": "<string>",
"amount": 123,
"type": "<string>",
"currency": "<string>",
"price": 123,
"timeInForce": "<string>",
"postOnly": True,
"stpMode": "<string>",
"maxSlippage": 123,
"expiresAt": "<string>"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
side: '<string>',
outcomeId: '<string>',
amount: 123,
type: '<string>',
currency: '<string>',
price: 123,
timeInForce: '<string>',
postOnly: true,
stpMode: '<string>',
maxSlippage: 123,
expiresAt: '<string>'
})
};
fetch('https://relay.bayse.markets/v1/pm/events/{eventId}/markets/{marketId}/orders', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://relay.bayse.markets/v1/pm/events/{eventId}/markets/{marketId}/orders",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'side' => '<string>',
'outcomeId' => '<string>',
'amount' => 123,
'type' => '<string>',
'currency' => '<string>',
'price' => 123,
'timeInForce' => '<string>',
'postOnly' => true,
'stpMode' => '<string>',
'maxSlippage' => 123,
'expiresAt' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://relay.bayse.markets/v1/pm/events/{eventId}/markets/{marketId}/orders"
payload := strings.NewReader("{\n \"side\": \"<string>\",\n \"outcomeId\": \"<string>\",\n \"amount\": 123,\n \"type\": \"<string>\",\n \"currency\": \"<string>\",\n \"price\": 123,\n \"timeInForce\": \"<string>\",\n \"postOnly\": true,\n \"stpMode\": \"<string>\",\n \"maxSlippage\": 123,\n \"expiresAt\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://relay.bayse.markets/v1/pm/events/{eventId}/markets/{marketId}/orders")
.header("Content-Type", "application/json")
.body("{\n \"side\": \"<string>\",\n \"outcomeId\": \"<string>\",\n \"amount\": 123,\n \"type\": \"<string>\",\n \"currency\": \"<string>\",\n \"price\": 123,\n \"timeInForce\": \"<string>\",\n \"postOnly\": true,\n \"stpMode\": \"<string>\",\n \"maxSlippage\": 123,\n \"expiresAt\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://relay.bayse.markets/v1/pm/events/{eventId}/markets/{marketId}/orders")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"side\": \"<string>\",\n \"outcomeId\": \"<string>\",\n \"amount\": 123,\n \"type\": \"<string>\",\n \"currency\": \"<string>\",\n \"price\": 123,\n \"timeInForce\": \"<string>\",\n \"postOnly\": true,\n \"stpMode\": \"<string>\",\n \"maxSlippage\": 123,\n \"expiresAt\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"engine": "AMM",
"order": {
"id": "e5f6a7b8-c9d0-1234-efab-567890123456",
"outcome": "YES",
"side": "BUY",
"type": "MARKET",
"status": "filled",
"amount": 100,
"price": 0.7235,
"quantity": 138.21,
"currency": "USD",
"createdAt": "2026-02-17T12:00:00Z",
"updatedAt": "2026-02-17T12:00:00Z"
}
}
{
"engine": "CLOB",
"order": {
"id": "f6a7b8c9-d0e1-2345-fabc-678901234567",
"marketId": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
"userId": "9a8b7c6d-5e4f-3210-abcd-ef1234567890",
"outcome": "YES",
"side": "BUY",
"orderType": "LIMIT",
"stpMode": "SKIP",
"type": "GTC",
"status": "open",
"amount": 100,
"price": 0.70,
"size": 100,
"filledSize": 0,
"remainingSize": 100,
"avgFillPrice": 0,
"fee": 0,
"postOnly": false,
"quantity": 0,
"createdAt": "2026-02-17T12:00:00Z",
"updatedAt": "2026-02-17T12:00:00Z"
}
}
Trading
Place order
Place a buy or sell order on a prediction market
POST
/
v1
/
pm
/
events
/
{eventId}
/
markets
/
{marketId}
/
orders
Place order
curl --request POST \
--url https://relay.bayse.markets/v1/pm/events/{eventId}/markets/{marketId}/orders \
--header 'Content-Type: application/json' \
--data '
{
"side": "<string>",
"outcomeId": "<string>",
"amount": 123,
"type": "<string>",
"currency": "<string>",
"price": 123,
"timeInForce": "<string>",
"postOnly": true,
"stpMode": "<string>",
"maxSlippage": 123,
"expiresAt": "<string>"
}
'import requests
url = "https://relay.bayse.markets/v1/pm/events/{eventId}/markets/{marketId}/orders"
payload = {
"side": "<string>",
"outcomeId": "<string>",
"amount": 123,
"type": "<string>",
"currency": "<string>",
"price": 123,
"timeInForce": "<string>",
"postOnly": True,
"stpMode": "<string>",
"maxSlippage": 123,
"expiresAt": "<string>"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
side: '<string>',
outcomeId: '<string>',
amount: 123,
type: '<string>',
currency: '<string>',
price: 123,
timeInForce: '<string>',
postOnly: true,
stpMode: '<string>',
maxSlippage: 123,
expiresAt: '<string>'
})
};
fetch('https://relay.bayse.markets/v1/pm/events/{eventId}/markets/{marketId}/orders', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://relay.bayse.markets/v1/pm/events/{eventId}/markets/{marketId}/orders",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'side' => '<string>',
'outcomeId' => '<string>',
'amount' => 123,
'type' => '<string>',
'currency' => '<string>',
'price' => 123,
'timeInForce' => '<string>',
'postOnly' => true,
'stpMode' => '<string>',
'maxSlippage' => 123,
'expiresAt' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://relay.bayse.markets/v1/pm/events/{eventId}/markets/{marketId}/orders"
payload := strings.NewReader("{\n \"side\": \"<string>\",\n \"outcomeId\": \"<string>\",\n \"amount\": 123,\n \"type\": \"<string>\",\n \"currency\": \"<string>\",\n \"price\": 123,\n \"timeInForce\": \"<string>\",\n \"postOnly\": true,\n \"stpMode\": \"<string>\",\n \"maxSlippage\": 123,\n \"expiresAt\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://relay.bayse.markets/v1/pm/events/{eventId}/markets/{marketId}/orders")
.header("Content-Type", "application/json")
.body("{\n \"side\": \"<string>\",\n \"outcomeId\": \"<string>\",\n \"amount\": 123,\n \"type\": \"<string>\",\n \"currency\": \"<string>\",\n \"price\": 123,\n \"timeInForce\": \"<string>\",\n \"postOnly\": true,\n \"stpMode\": \"<string>\",\n \"maxSlippage\": 123,\n \"expiresAt\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://relay.bayse.markets/v1/pm/events/{eventId}/markets/{marketId}/orders")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"side\": \"<string>\",\n \"outcomeId\": \"<string>\",\n \"amount\": 123,\n \"type\": \"<string>\",\n \"currency\": \"<string>\",\n \"price\": 123,\n \"timeInForce\": \"<string>\",\n \"postOnly\": true,\n \"stpMode\": \"<string>\",\n \"maxSlippage\": 123,\n \"expiresAt\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"engine": "AMM",
"order": {
"id": "e5f6a7b8-c9d0-1234-efab-567890123456",
"outcome": "YES",
"side": "BUY",
"type": "MARKET",
"status": "filled",
"amount": 100,
"price": 0.7235,
"quantity": 138.21,
"currency": "USD",
"createdAt": "2026-02-17T12:00:00Z",
"updatedAt": "2026-02-17T12:00:00Z"
}
}
{
"engine": "CLOB",
"order": {
"id": "f6a7b8c9-d0e1-2345-fabc-678901234567",
"marketId": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
"userId": "9a8b7c6d-5e4f-3210-abcd-ef1234567890",
"outcome": "YES",
"side": "BUY",
"orderType": "LIMIT",
"stpMode": "SKIP",
"type": "GTC",
"status": "open",
"amount": 100,
"price": 0.70,
"size": 100,
"filledSize": 0,
"remainingSize": 100,
"avgFillPrice": 0,
"fee": 0,
"postOnly": false,
"quantity": 0,
"createdAt": "2026-02-17T12:00:00Z",
"updatedAt": "2026-02-17T12:00:00Z"
}
}
Authentication
Write authentication required —X-Public-Key, X-Timestamp, and X-Signature headers. See the Authentication guide.
Path parameters
string
required
UUID of the event.
string
required
UUID of the market.
Request body
string
required
BUY or SELL.number
required
Amount to spend (buy) or receive (sell), in the specified currency. Minimum: $1.00 USD / ₦100.00 NGN.
string
required
LIMIT or MARKET.string
USD (default) or NGN.number
Limit price per share (0.01–0.99). Required for
LIMIT orders.string
GTC (good-til-cancelled, default for limit), GTD (good-til-date), FAK (fill-and-kill, default for market), or FOK (fill-or-kill).boolean
If
true, the order is rejected instead of crossing the spread. Limit orders only. Default: false.string
Self-trade prevention mode. Controls how the engine resolves a match against another resting order from the same user. CLOB only. Default:
SKIP. Unknown values fall back to SKIP.SKIP— the match is silently skipped and both orders remain on the book.CANCEL_OLDEST— the resting same-user maker is cancelled and refunded; the taker continues matching against other counterparties.CANCEL_NEWEST— the incoming taker stops at the same-user match. If it had already filled against other users, those fills stand and the taker comes back ascancelled; otherwise it isrejected.CANCEL_BOTH— the resting maker is cancelled and the taker is cancelled or rejected under the same rule asCANCEL_NEWEST.
number
Maximum acceptable slippage for market orders (0.00–1.00).
string
ISO 8601 expiration timestamp. Required for
GTD orders.Example request
PUBLIC_KEY="pk_live_abcdef123456"
SECRET_KEY="sk_live_secret789xyz"
TIMESTAMP=$(date +%s)
METHOD="POST"
URL_PATH="/v1/pm/events/a1b2c3d4-e5f6-7890-abcd-ef1234567890/markets/b2c3d4e5-f6a7-8901-bcde-f12345678901/orders"
BODY='{"side":"BUY","outcomeId":"c3d4e5f6-a7b8-9012-cdef-345678901234","amount":100,"type":"MARKET","currency":"USD"}'
BODY_HASH=$(printf '%s' "$BODY" | openssl dgst -sha256 -hex 2>/dev/null | sed 's/.*= //')
PAYLOAD="${TIMESTAMP}.${METHOD}.${URL_PATH}.${BODY_HASH}"
SIGNATURE=$(printf '%s' "$PAYLOAD" | openssl dgst -sha256 -hmac "$SECRET_KEY" -binary | base64)
curl -X POST "https://relay.bayse.markets${URL_PATH}" \
-H "X-Public-Key: ${PUBLIC_KEY}" \
-H "X-Timestamp: ${TIMESTAMP}" \
-H "X-Signature: ${SIGNATURE}" \
-H "Content-Type: application/json" \
-d "$BODY"
PUBLIC_KEY="pk_live_abcdef123456"
SECRET_KEY="sk_live_secret789xyz"
TIMESTAMP=$(date +%s)
METHOD="POST"
URL_PATH="/v1/pm/events/a1b2c3d4-e5f6-7890-abcd-ef1234567890/markets/b2c3d4e5-f6a7-8901-bcde-f12345678901/orders"
BODY='{"side":"BUY","outcomeId":"c3d4e5f6-a7b8-9012-cdef-345678901234","amount":100,"type":"LIMIT","price":0.70,"currency":"USD"}'
BODY_HASH=$(printf '%s' "$BODY" | openssl dgst -sha256 -hex 2>/dev/null | sed 's/.*= //')
PAYLOAD="${TIMESTAMP}.${METHOD}.${URL_PATH}.${BODY_HASH}"
SIGNATURE=$(printf '%s' "$PAYLOAD" | openssl dgst -sha256 -hmac "$SECRET_KEY" -binary | base64)
curl -X POST "https://relay.bayse.markets${URL_PATH}" \
-H "X-Public-Key: ${PUBLIC_KEY}" \
-H "X-Timestamp: ${TIMESTAMP}" \
-H "X-Signature: ${SIGNATURE}" \
-H "Content-Type: application/json" \
-d "$BODY"
import crypto from 'crypto';
const publicKey = 'pk_live_abcdef123456';
const secretKey = 'sk_live_secret789xyz';
const timestamp = Math.floor(Date.now() / 1000);
const method = 'POST';
const path = '/v1/pm/events/a1b2c3d4-e5f6-7890-abcd-ef1234567890/markets/b2c3d4e5-f6a7-8901-bcde-f12345678901/orders';
const body = JSON.stringify({
side: 'BUY',
outcomeId: 'c3d4e5f6-a7b8-9012-cdef-345678901234',
amount: 100,
type: 'LIMIT',
price: 0.70,
currency: 'USD',
});
const bodyHash = crypto.createHash('sha256').update(body).digest('hex');
const payload = `${timestamp}.${method}.${path}.${bodyHash}`;
const signature = crypto
.createHmac('sha256', secretKey)
.update(payload)
.digest('base64');
const response = await fetch(`https://relay.bayse.markets${path}`, {
method,
headers: {
'X-Public-Key': publicKey,
'X-Timestamp': timestamp.toString(),
'X-Signature': signature,
'Content-Type': 'application/json',
},
body,
});
const order = await response.json();
import hmac, hashlib, base64, json, time, requests
public_key = 'pk_live_abcdef123456'
secret_key = 'sk_live_secret789xyz'
timestamp = int(time.time())
method = 'POST'
path = '/v1/pm/events/a1b2c3d4-e5f6-7890-abcd-ef1234567890/markets/b2c3d4e5-f6a7-8901-bcde-f12345678901/orders'
body = json.dumps({
'side': 'BUY',
'outcomeId': 'c3d4e5f6-a7b8-9012-cdef-345678901234',
'amount': 100,
'type': 'LIMIT',
'price': 0.70,
'currency': 'USD',
})
body_hash = hashlib.sha256(body.encode()).hexdigest()
payload = f'{timestamp}.{method}.{path}.{body_hash}'
signature = base64.b64encode(
hmac.new(secret_key.encode(), payload.encode(), hashlib.sha256).digest()
).decode()
resp = requests.post(
f'https://relay.bayse.markets{path}',
headers={
'X-Public-Key': public_key,
'X-Timestamp': str(timestamp),
'X-Signature': signature,
'Content-Type': 'application/json',
},
data=body,
)
order = resp.json()
import (
"crypto/hmac"
"crypto/sha256"
"encoding/base64"
"encoding/hex"
"fmt"
"strconv"
"strings"
"time"
)
timestamp := time.Now().Unix()
method := "POST"
urlPath := "/v1/pm/events/a1b2c3d4-e5f6-7890-abcd-ef1234567890/markets/b2c3d4e5-f6a7-8901-bcde-f12345678901/orders"
body := []byte(`{"side":"BUY","outcomeId":"c3d4e5f6-a7b8-9012-cdef-345678901234","amount":100,"type":"LIMIT","price":0.70,"currency":"USD"}`)
bodySum := sha256.Sum256(body)
bodyHash := hex.EncodeToString(bodySum[:])
payload := fmt.Sprintf("%d.%s.%s.%s", timestamp, method, urlPath, bodyHash)
mac := hmac.New(sha256.New, []byte("sk_live_secret789xyz"))
mac.Write([]byte(payload))
signature := base64.StdEncoding.EncodeToString(mac.Sum(nil))
req, _ := http.NewRequest("POST", "https://relay.bayse.markets"+urlPath, strings.NewReader(string(body)))
req.Header.Set("X-Public-Key", "pk_live_abcdef123456")
req.Header.Set("X-Timestamp", strconv.FormatInt(timestamp, 10))
req.Header.Set("X-Signature", signature)
req.Header.Set("Content-Type", "application/json")
resp, _ := http.DefaultClient.Do(req)
Response
The response contains anengine field indicating the market type, and an order object with the order details.
string
AMM or CLOB.object
The placed order. Fields vary by engine type.
Show AMM order fields
Show AMM order fields
Show CLOB order fields
Show CLOB order fields
string
Order UUID.
string
Market UUID.
string
User UUID.
string
YES or NO.string
BUY or SELL.string
LIMIT or MARKET.string
Order type.
string
Order status:
pending, open, partial_filled, filled, cancelled, rejected, or expired.number
Requested amount.
number
Limit price.
number
Total size.
number
Amount filled so far.
number
Amount remaining on the book.
number
Average price of fills so far.
number
Fee charged.
boolean
Whether the order is post-only.
string
Self-trade prevention mode applied:
SKIP, CANCEL_OLDEST, CANCEL_NEWEST, or CANCEL_BOTH.number
Shares received.
string
ISO 8601 timestamp.
string
ISO 8601 timestamp.
{
"engine": "AMM",
"order": {
"id": "e5f6a7b8-c9d0-1234-efab-567890123456",
"outcome": "YES",
"side": "BUY",
"type": "MARKET",
"status": "filled",
"amount": 100,
"price": 0.7235,
"quantity": 138.21,
"currency": "USD",
"createdAt": "2026-02-17T12:00:00Z",
"updatedAt": "2026-02-17T12:00:00Z"
}
}
{
"engine": "CLOB",
"order": {
"id": "f6a7b8c9-d0e1-2345-fabc-678901234567",
"marketId": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
"userId": "9a8b7c6d-5e4f-3210-abcd-ef1234567890",
"outcome": "YES",
"side": "BUY",
"orderType": "LIMIT",
"stpMode": "SKIP",
"type": "GTC",
"status": "open",
"amount": 100,
"price": 0.70,
"size": 100,
"filledSize": 0,
"remainingSize": 100,
"avgFillPrice": 0,
"fee": 0,
"postOnly": false,
"quantity": 0,
"createdAt": "2026-02-17T12:00:00Z",
"updatedAt": "2026-02-17T12:00:00Z"
}
}
Replacing market-maker quotes with stpMode
A market maker re-quoting on both sides of a CLOB book risks crossing its own resting orders mid-update. Setting stpMode to CANCEL_OLDEST cancels the stale same-user maker server-side as the new quote arrives, so the new order can continue matching against external counterparties without sitting next to a duplicate of itself.
cURL
BODY='{"side":"BUY","outcomeId":"c3d4e5f6-a7b8-9012-cdef-345678901234","amount":100,"type":"LIMIT","price":0.71,"timeInForce":"GTC","stpMode":"CANCEL_OLDEST","currency":"USD"}'
curl -X POST "https://relay.bayse.markets/v1/pm/events/${EVENT_ID}/markets/${MARKET_ID}/orders" \
-H "X-Public-Key: ${PUBLIC_KEY}" \
-H "X-Timestamp: ${TIMESTAMP}" \
-H "X-Signature: ${SIGNATURE}" \
-H "Content-Type: application/json" \
-d "$BODY"
⌘I