Get bet by user reference
curl --request GET \
--url https://api.4casters.io/user/getBetByUserReference \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.4casters.io/user/getBetByUserReference"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.4casters.io/user/getBetByUserReference', 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/user/getBetByUserReference",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$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.4casters.io/user/getBetByUserReference"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.4casters.io/user/getBetByUserReference")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.4casters.io/user/getBetByUserReference")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"data": {
"unmatched": [
{
"id": "<string>",
"txID": "<string>",
"bet": 123,
"odds": 123,
"spread": 123,
"total": 123,
"participantID": "<string>",
"otherParticipantID": "<string>",
"expiry": "2023-11-07T05:31:56Z",
"filled": 123,
"offered": 123,
"remaining": 123,
"takenRatio": 123,
"createdAt": "2023-11-07T05:31:56Z",
"origin": "<string>",
"graded": true,
"closed": true,
"adminRefund": true,
"userReference": "<string>",
"wagerRequestID": "<string>",
"game": {
"id": "<string>",
"league": "<string>",
"sport": "<string>",
"start": "2023-11-07T05:31:56Z",
"ended": true,
"eventName": "<string>",
"isFutures": true,
"participants": [
{
"id": "<string>",
"longName": "<string>",
"shortName": "<string>",
"mainPitcher": "<string>",
"rotationNumber": "<string>",
"futuresSide": "<string>",
"score": 123
}
]
}
}
],
"matched": [
{
"id": "<string>",
"txID": "<string>",
"bet": 123,
"odds": 123,
"spread": 123,
"total": 123,
"participantID": "<string>",
"market": "<string>",
"side": "<string>",
"userReference": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"matchedTime": "2023-11-07T05:31:56Z",
"graded": true,
"closed": true,
"origin": "<string>",
"adminRefund": true,
"risk": "<string>",
"win": "<string>",
"fee": "<string>",
"game": {
"id": "<string>",
"league": "<string>",
"sport": "<string>",
"start": "2023-11-07T05:31:56Z",
"ended": true,
"eventName": "<string>",
"isFutures": true,
"participants": [
{
"id": "<string>",
"longName": "<string>",
"shortName": "<string>",
"mainPitcher": "<string>",
"rotationNumber": "<string>",
"futuresSide": "<string>",
"score": 123
}
]
}
}
],
"graded": [
{
"id": "<string>",
"txID": "<string>",
"ticketNumber": "<string>",
"bet": 123,
"odds": 123,
"spread": 123,
"total": 123,
"participantID": "<string>",
"market": "<string>",
"side": "<string>",
"matchedTime": "2023-11-07T05:31:56Z",
"settledAt": "2023-11-07T05:31:56Z",
"createdAt": "2023-11-07T05:31:56Z",
"graded": true,
"closed": true,
"cancelled": true,
"adminRefund": true,
"platform": "api",
"fee": "<string>",
"risk": "<string>",
"win": "<string>",
"result": "<string>",
"pinnacleLine": {},
"game": {
"id": "<string>",
"league": "<string>",
"sport": "<string>",
"start": "2023-11-07T05:31:56Z",
"ended": true,
"eventName": "<string>",
"isFutures": true,
"participants": [
{
"id": "<string>",
"longName": "<string>",
"shortName": "<string>",
"mainPitcher": "<string>",
"rotationNumber": "<string>",
"futuresSide": "<string>",
"score": 123
}
]
}
}
]
}
}User
Get bet by user reference
Look up every bet tied to a client-defined identifier
GET
/
user
/
getBetByUserReference
Get bet by user reference
curl --request GET \
--url https://api.4casters.io/user/getBetByUserReference \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.4casters.io/user/getBetByUserReference"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.4casters.io/user/getBetByUserReference', 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/user/getBetByUserReference",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$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.4casters.io/user/getBetByUserReference"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.4casters.io/user/getBetByUserReference")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.4casters.io/user/getBetByUserReference")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"data": {
"unmatched": [
{
"id": "<string>",
"txID": "<string>",
"bet": 123,
"odds": 123,
"spread": 123,
"total": 123,
"participantID": "<string>",
"otherParticipantID": "<string>",
"expiry": "2023-11-07T05:31:56Z",
"filled": 123,
"offered": 123,
"remaining": 123,
"takenRatio": 123,
"createdAt": "2023-11-07T05:31:56Z",
"origin": "<string>",
"graded": true,
"closed": true,
"adminRefund": true,
"userReference": "<string>",
"wagerRequestID": "<string>",
"game": {
"id": "<string>",
"league": "<string>",
"sport": "<string>",
"start": "2023-11-07T05:31:56Z",
"ended": true,
"eventName": "<string>",
"isFutures": true,
"participants": [
{
"id": "<string>",
"longName": "<string>",
"shortName": "<string>",
"mainPitcher": "<string>",
"rotationNumber": "<string>",
"futuresSide": "<string>",
"score": 123
}
]
}
}
],
"matched": [
{
"id": "<string>",
"txID": "<string>",
"bet": 123,
"odds": 123,
"spread": 123,
"total": 123,
"participantID": "<string>",
"market": "<string>",
"side": "<string>",
"userReference": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"matchedTime": "2023-11-07T05:31:56Z",
"graded": true,
"closed": true,
"origin": "<string>",
"adminRefund": true,
"risk": "<string>",
"win": "<string>",
"fee": "<string>",
"game": {
"id": "<string>",
"league": "<string>",
"sport": "<string>",
"start": "2023-11-07T05:31:56Z",
"ended": true,
"eventName": "<string>",
"isFutures": true,
"participants": [
{
"id": "<string>",
"longName": "<string>",
"shortName": "<string>",
"mainPitcher": "<string>",
"rotationNumber": "<string>",
"futuresSide": "<string>",
"score": 123
}
]
}
}
],
"graded": [
{
"id": "<string>",
"txID": "<string>",
"ticketNumber": "<string>",
"bet": 123,
"odds": 123,
"spread": 123,
"total": 123,
"participantID": "<string>",
"market": "<string>",
"side": "<string>",
"matchedTime": "2023-11-07T05:31:56Z",
"settledAt": "2023-11-07T05:31:56Z",
"createdAt": "2023-11-07T05:31:56Z",
"graded": true,
"closed": true,
"cancelled": true,
"adminRefund": true,
"platform": "api",
"fee": "<string>",
"risk": "<string>",
"win": "<string>",
"result": "<string>",
"pinnacleLine": {},
"game": {
"id": "<string>",
"league": "<string>",
"sport": "<string>",
"start": "2023-11-07T05:31:56Z",
"ended": true,
"eventName": "<string>",
"isFutures": true,
"participants": [
{
"id": "<string>",
"longName": "<string>",
"shortName": "<string>",
"mainPitcher": "<string>",
"rotationNumber": "<string>",
"futuresSide": "<string>",
"score": 123
}
]
}
}
]
}
}Look up every bet tied to a
userReference. userReference is an optional client-defined string you can attach to an order at place time to track it on your side — this endpoint is the read counterpart.
The response separates results into three buckets:
unmatched— open offers from this reference that are still resting on the book.matched— matched (ungraded) bets from this reference.graded— graded (settled) bets from this reference, includingrisk,win,fee, andresult.
Request
GET /user/getBetByUserReference
string
required
Client-defined reference passed in at place time.
string
required
Scope the lookup to a single game.
curl "https://api.4casters.io/user/getBetByUserReference?userReference=my-order-1&gameID=67d1c942215edc7ee0c806ef" \
-H "Authorization: Bearer YOUR_TOKEN"
Response
array
Open orders — same shape as Get unmatched orders.
array
Matched (ungraded) bets — same shape as Get matched bets.
array
Graded (settled) bets — same shape as Get graded wagers.
Errors
| Status | Meaning |
|---|---|
408 | userReference or gameID missing. |
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.
Query Parameters
The client-defined reference passed in at place time.
A 4casters game id (ObjectID). Get game ids from GET /exchange/v2/getGames or GET /exchange/v2/getOrderbook.
Response
Three-bucket wager view: open (unmatched), filled-but-not-graded (matched), and settled (graded).
Show child attributes
Show child attributes
Was this page helpful?
⌘I