Cancel orders by user reference
curl --request POST \
--url https://api.4casters.io/session/cancelByReference \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"gameID": "6924f82640a7e89c3d3acc41",
"userReferences": [
"my-order-1",
"my-order-2"
]
}
'import requests
url = "https://api.4casters.io/session/cancelByReference"
payload = {
"gameID": "6924f82640a7e89c3d3acc41",
"userReferences": ["my-order-1", "my-order-2"]
}
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({
gameID: '6924f82640a7e89c3d3acc41',
userReferences: ['my-order-1', 'my-order-2']
})
};
fetch('https://api.4casters.io/session/cancelByReference', 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.4casters.io/session/cancelByReference",
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([
'gameID' => '6924f82640a7e89c3d3acc41',
'userReferences' => [
'my-order-1',
'my-order-2'
]
]),
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.4casters.io/session/cancelByReference"
payload := strings.NewReader("{\n \"gameID\": \"6924f82640a7e89c3d3acc41\",\n \"userReferences\": [\n \"my-order-1\",\n \"my-order-2\"\n ]\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.4casters.io/session/cancelByReference")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"gameID\": \"6924f82640a7e89c3d3acc41\",\n \"userReferences\": [\n \"my-order-1\",\n \"my-order-2\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.4casters.io/session/cancelByReference")
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 \"gameID\": \"6924f82640a7e89c3d3acc41\",\n \"userReferences\": [\n \"my-order-1\",\n \"my-order-2\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"data": [
{
"success": true,
"reason": "<string>",
"sessionID": "<string>",
"description": "<string>",
"odds": 123,
"filled": 123,
"offered": 123,
"remaining": 123,
"gameID": "<string>",
"userReference": "<string>"
}
]
}Orders
Cancel by user reference
Cancel orders by their client-defined reference
POST
/
session
/
cancelByReference
Cancel orders by user reference
curl --request POST \
--url https://api.4casters.io/session/cancelByReference \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"gameID": "6924f82640a7e89c3d3acc41",
"userReferences": [
"my-order-1",
"my-order-2"
]
}
'import requests
url = "https://api.4casters.io/session/cancelByReference"
payload = {
"gameID": "6924f82640a7e89c3d3acc41",
"userReferences": ["my-order-1", "my-order-2"]
}
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({
gameID: '6924f82640a7e89c3d3acc41',
userReferences: ['my-order-1', 'my-order-2']
})
};
fetch('https://api.4casters.io/session/cancelByReference', 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.4casters.io/session/cancelByReference",
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([
'gameID' => '6924f82640a7e89c3d3acc41',
'userReferences' => [
'my-order-1',
'my-order-2'
]
]),
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.4casters.io/session/cancelByReference"
payload := strings.NewReader("{\n \"gameID\": \"6924f82640a7e89c3d3acc41\",\n \"userReferences\": [\n \"my-order-1\",\n \"my-order-2\"\n ]\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.4casters.io/session/cancelByReference")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"gameID\": \"6924f82640a7e89c3d3acc41\",\n \"userReferences\": [\n \"my-order-1\",\n \"my-order-2\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.4casters.io/session/cancelByReference")
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 \"gameID\": \"6924f82640a7e89c3d3acc41\",\n \"userReferences\": [\n \"my-order-1\",\n \"my-order-2\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"data": [
{
"success": true,
"reason": "<string>",
"sessionID": "<string>",
"description": "<string>",
"odds": 123,
"filled": 123,
"offered": 123,
"remaining": 123,
"gameID": "<string>",
"userReference": "<string>"
}
]
}Cancel every open order in the given game whose
userReference matches one of the supplied references. Useful when you’ve tagged orders with your own ids and want to cancel by those instead of tracking 4casters order ids.
Request
POST /session/cancelByReference
string
required
Scope the search to a single game.
array
required
Array of
userReference strings. Every open order in gameID whose userReference is in this array is cancelled.curl -X POST https://api.4casters.io/session/cancelByReference \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"gameID": "6924f82640a7e89c3d3acc41",
"userReferences": ["my-order-1", "my-order-2"]
}'
Response
array
Per-order cancel results. Same shape as Cancel an order.
Errors
| Status | Meaning |
|---|---|
400 | userReferences missing or not an array. |
Authorizations
Pass your auth token in the Authorization header. The Bearer prefix is optional; the server also accepts a signed auth cookie or a token field in the request body.
Response
Per-order cancel results
Show child attributes
Show child attributes
Was this page helpful?
⌘I