Cancel orders
curl --request POST \
--url https://api.foresight.now/v1/orders/cancel \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"order_hashes": [
"<string>"
],
"condition_id": "<string>",
"chain_id": 56
}
'import requests
url = "https://api.foresight.now/v1/orders/cancel"
payload = {
"order_hashes": ["<string>"],
"condition_id": "<string>",
"chain_id": 56
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({order_hashes: ['<string>'], condition_id: '<string>', chain_id: 56})
};
fetch('https://api.foresight.now/v1/orders/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.foresight.now/v1/orders/cancel",
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([
'order_hashes' => [
'<string>'
],
'condition_id' => '<string>',
'chain_id' => 56
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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://api.foresight.now/v1/orders/cancel"
payload := strings.NewReader("{\n \"order_hashes\": [\n \"<string>\"\n ],\n \"condition_id\": \"<string>\",\n \"chain_id\": 56\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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://api.foresight.now/v1/orders/cancel")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"order_hashes\": [\n \"<string>\"\n ],\n \"condition_id\": \"<string>\",\n \"chain_id\": 56\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.foresight.now/v1/orders/cancel")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"order_hashes\": [\n \"<string>\"\n ],\n \"condition_id\": \"<string>\",\n \"chain_id\": 56\n}"
response = http.request(request)
puts response.read_body{
"cancelled_count": 3,
"order_hashes": [
"<string>"
]
}{
"correlation_id": "<string>",
"code": "NOT_FOUND",
"message": "<string>",
"status_code": 404,
"timestamp": "2023-11-07T05:31:56Z",
"path": "/v1/markets/0x.../book"
}Orders
Cancel orders
Cancel orders by hash, by filter, or all. L2, permission trade.
POST
/
v1
/
orders
/
cancel
Cancel orders
curl --request POST \
--url https://api.foresight.now/v1/orders/cancel \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"order_hashes": [
"<string>"
],
"condition_id": "<string>",
"chain_id": 56
}
'import requests
url = "https://api.foresight.now/v1/orders/cancel"
payload = {
"order_hashes": ["<string>"],
"condition_id": "<string>",
"chain_id": 56
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({order_hashes: ['<string>'], condition_id: '<string>', chain_id: 56})
};
fetch('https://api.foresight.now/v1/orders/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.foresight.now/v1/orders/cancel",
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([
'order_hashes' => [
'<string>'
],
'condition_id' => '<string>',
'chain_id' => 56
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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://api.foresight.now/v1/orders/cancel"
payload := strings.NewReader("{\n \"order_hashes\": [\n \"<string>\"\n ],\n \"condition_id\": \"<string>\",\n \"chain_id\": 56\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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://api.foresight.now/v1/orders/cancel")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"order_hashes\": [\n \"<string>\"\n ],\n \"condition_id\": \"<string>\",\n \"chain_id\": 56\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.foresight.now/v1/orders/cancel")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"order_hashes\": [\n \"<string>\"\n ],\n \"condition_id\": \"<string>\",\n \"chain_id\": 56\n}"
response = http.request(request)
puts response.read_body{
"cancelled_count": 3,
"order_hashes": [
"<string>"
]
}{
"correlation_id": "<string>",
"code": "NOT_FOUND",
"message": "<string>",
"status_code": 404,
"timestamp": "2023-11-07T05:31:56Z",
"path": "/v1/markets/0x.../book"
}Authorizations
PrivyJWTApiKey & ApiSecret
Privy-issued JWT. Required for L1 routes; accepted on L2 routes.
Body
application/json
Three modes, resolved by body shape:
- By hash —
order_hashes, up to 100 hashes per request. - By filter — any subset of
condition_id+chain_id+outcome+side. Filtering by market requires bothcondition_idandchain_id. - Cancel all — empty body. Cancels the caller's OPEN / PARTIALLY_FILLED orders.
⌘I