Orders
Cancel an Order
Cancels an open or partially-filled order and releases held balance. Cannot cancel a fully-filled order.
PUT
/
v1
/
markets
/
{market_id}
/
orders
/
{order_id}
/
cancel
Cancel an Order
curl --request PUT \
--url https://api.predictamarkets.com/v1/markets/{market_id}/orders/{order_id}/cancel \
--header 'X-Api-Key: <api-key>'import requests
url = "https://api.predictamarkets.com/v1/markets/{market_id}/orders/{order_id}/cancel"
headers = {"X-Api-Key": "<api-key>"}
response = requests.put(url, headers=headers)
print(response.text)const options = {method: 'PUT', headers: {'X-Api-Key': '<api-key>'}};
fetch('https://api.predictamarkets.com/v1/markets/{market_id}/orders/{order_id}/cancel', 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://api.predictamarkets.com/v1/markets/{market_id}/orders/{order_id}/cancel",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_HTTPHEADER => [
"X-Api-Key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.predictamarkets.com/v1/markets/{market_id}/orders/{order_id}/cancel"
req, _ := http.NewRequest("PUT", url, nil)
req.Header.Add("X-Api-Key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.put("https://api.predictamarkets.com/v1/markets/{market_id}/orders/{order_id}/cancel")
.header("X-Api-Key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.predictamarkets.com/v1/markets/{market_id}/orders/{order_id}/cancel")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["X-Api-Key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"id": 501,
"market_id": 12,
"market_asset_id": 34,
"account_id": 1042,
"order_type": "BUY",
"opinion_side": "YES",
"price": "65.00",
"quantity": "10.00",
"initial_quantity": "10.00",
"status": "CANCELLED",
"prediction_key": "mkt-12-yes",
"auto_cancel_at": null,
"created_at": "2025-04-10T09:00:00Z",
"updated_at": "2025-04-10T09:01:00Z"
}{
"detail": "Order is already filled and cannot be cancelled"
}{
"detail": "Not authenticated"
}{
"detail": "You are not authorized to cancel this order"
}{
"detail": "Order not found"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}{
"detail": "An unexpected error occurred. Please try again later."
}Authorizations
Path Parameters
Flexible identifier type that accepts either a numeric integer ID or a human-readable qualified ID string (QID). QIDs follow a prefix convention: MA for markets, MAA for market assets, AP for account payouts. Most path parameters that accept an ID use this type so callers can use whichever form is more convenient.
Integer ID of the order to cancel
Response
Order cancelled
The response is of type string.
Previous
Sell a PositionCreates a SELL order against the existing order book to exit a filled position at the specified price and quantity.
Next
⌘I
Cancel an Order
curl --request PUT \
--url https://api.predictamarkets.com/v1/markets/{market_id}/orders/{order_id}/cancel \
--header 'X-Api-Key: <api-key>'import requests
url = "https://api.predictamarkets.com/v1/markets/{market_id}/orders/{order_id}/cancel"
headers = {"X-Api-Key": "<api-key>"}
response = requests.put(url, headers=headers)
print(response.text)const options = {method: 'PUT', headers: {'X-Api-Key': '<api-key>'}};
fetch('https://api.predictamarkets.com/v1/markets/{market_id}/orders/{order_id}/cancel', 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://api.predictamarkets.com/v1/markets/{market_id}/orders/{order_id}/cancel",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_HTTPHEADER => [
"X-Api-Key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.predictamarkets.com/v1/markets/{market_id}/orders/{order_id}/cancel"
req, _ := http.NewRequest("PUT", url, nil)
req.Header.Add("X-Api-Key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.put("https://api.predictamarkets.com/v1/markets/{market_id}/orders/{order_id}/cancel")
.header("X-Api-Key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.predictamarkets.com/v1/markets/{market_id}/orders/{order_id}/cancel")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["X-Api-Key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"id": 501,
"market_id": 12,
"market_asset_id": 34,
"account_id": 1042,
"order_type": "BUY",
"opinion_side": "YES",
"price": "65.00",
"quantity": "10.00",
"initial_quantity": "10.00",
"status": "CANCELLED",
"prediction_key": "mkt-12-yes",
"auto_cancel_at": null,
"created_at": "2025-04-10T09:00:00Z",
"updated_at": "2025-04-10T09:01:00Z"
}{
"detail": "Order is already filled and cannot be cancelled"
}{
"detail": "Not authenticated"
}{
"detail": "You are not authorized to cancel this order"
}{
"detail": "Order not found"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}{
"detail": "An unexpected error occurred. Please try again later."
}