curl --request GET \
--url https://api.orbscan.com/v1/orderbook/events \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.orbscan.com/v1/orderbook/events"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.orbscan.com/v1/orderbook/events', 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.orbscan.com/v1/orderbook/events",
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.orbscan.com/v1/orderbook/events"
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.orbscan.com/v1/orderbook/events")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.orbscan.com/v1/orderbook/events")
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{
"message": "OK",
"status_code": "1",
"data": {
"items": [
{
"cursor": "AAABoMfIdTSZ95XfHI2JY3xDPBEiM-NgpOm-DblE2HiRi5Ny98xn0g",
"marketId": "573656",
"conditionId": "0x02deb9538f5c123373adaa4ee6217b01745f1662bc902e46ac92f3fe6f8741e8",
"tokenId": "93694900555669388759405753550770573998169287228984912881955464376232163096213",
"outcome": "Yes",
"eventType": "book",
"timestamp": 1790058198324,
"indexedTimestamp": 1790058204527,
"side": null,
"price": null,
"sizeAfter": null,
"bids": [
[
"0.48",
"12500"
],
[
"0.47",
"20000"
]
],
"asks": [
[
"0.49",
"8000"
],
[
"0.5",
"15000"
]
],
"sourceHash": "db60d216be1f61bfe63c4c9a92a2d42fd30e319c"
},
{
"cursor": "AAABoIUSUAm3qt444MRDsUeszsPPlC2V4ijGB4PrCvlQPcNHl9XYGg",
"marketId": "573656",
"conditionId": "0x02deb9538f5c123373adaa4ee6217b01745f1662bc902e46ac92f3fe6f8741e8",
"tokenId": "93694900555669388759405753550770573998169287228984912881955464376232163096213",
"outcome": "Yes",
"eventType": "price_change",
"timestamp": 1788938965001,
"indexedTimestamp": 1788938967881,
"side": "SELL",
"price": "0.79",
"sizeAfter": "6",
"bids": null,
"asks": null,
"sourceHash": "7bbd3aff3cc9a5b22c69a6a4f3c2ce8c2fb4b6ab"
}
],
"nextCursor": null
}
}{
"message": "tokenId, marketId, or conditionId is required",
"status_code": "0",
"data": null
}{
"message": "Missing or invalid API key",
"status_code": "0",
"data": null
}{
"message": "Rate limit exceeded",
"status_code": "0",
"data": null
}Get Order Book Events
Get the L2 snapshots and price changes needed to reconstruct an outcome token’s order book over time.
curl --request GET \
--url https://api.orbscan.com/v1/orderbook/events \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.orbscan.com/v1/orderbook/events"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.orbscan.com/v1/orderbook/events', 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.orbscan.com/v1/orderbook/events",
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.orbscan.com/v1/orderbook/events"
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.orbscan.com/v1/orderbook/events")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.orbscan.com/v1/orderbook/events")
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{
"message": "OK",
"status_code": "1",
"data": {
"items": [
{
"cursor": "AAABoMfIdTSZ95XfHI2JY3xDPBEiM-NgpOm-DblE2HiRi5Ny98xn0g",
"marketId": "573656",
"conditionId": "0x02deb9538f5c123373adaa4ee6217b01745f1662bc902e46ac92f3fe6f8741e8",
"tokenId": "93694900555669388759405753550770573998169287228984912881955464376232163096213",
"outcome": "Yes",
"eventType": "book",
"timestamp": 1790058198324,
"indexedTimestamp": 1790058204527,
"side": null,
"price": null,
"sizeAfter": null,
"bids": [
[
"0.48",
"12500"
],
[
"0.47",
"20000"
]
],
"asks": [
[
"0.49",
"8000"
],
[
"0.5",
"15000"
]
],
"sourceHash": "db60d216be1f61bfe63c4c9a92a2d42fd30e319c"
},
{
"cursor": "AAABoIUSUAm3qt444MRDsUeszsPPlC2V4ijGB4PrCvlQPcNHl9XYGg",
"marketId": "573656",
"conditionId": "0x02deb9538f5c123373adaa4ee6217b01745f1662bc902e46ac92f3fe6f8741e8",
"tokenId": "93694900555669388759405753550770573998169287228984912881955464376232163096213",
"outcome": "Yes",
"eventType": "price_change",
"timestamp": 1788938965001,
"indexedTimestamp": 1788938967881,
"side": "SELL",
"price": "0.79",
"sizeAfter": "6",
"bids": null,
"asks": null,
"sourceHash": "7bbd3aff3cc9a5b22c69a6a4f3c2ce8c2fb4b6ab"
}
],
"nextCursor": null
}
}{
"message": "tokenId, marketId, or conditionId is required",
"status_code": "0",
"data": null
}{
"message": "Missing or invalid API key",
"status_code": "0",
"data": null
}{
"message": "Rate limit exceeded",
"status_code": "0",
"data": null
}book snapshot (full bids and asks) or a price_change delta (a single side, price, and sizeAfter).
Provide at least one of marketId, conditionId, or tokenId. The API combines values in the same parameter with OR. It combines different parameters with AND.
Reconstructing a book
To rebuild a token’s book at a target time:- For one
tokenId, fetch the latestbookat or before the target time witheventType=book,to=<target_time>,order=desc, andlimit=1. - Start a new query from that event’s
cursor. SeteventType=price_change, keepto=<target_time>, and useorder=asc. - Page through the results with the same filters and
order, passing eachnextCursorinto the next request. - Apply
BUYdeltas to bids andSELLdeltas to asks. AsizeAftervalue of0removes the price level. Any other value replaces its size.
book snapshot to start reconstruction. If none exists at or before the target time, the later price changes are not enough to rebuild the book.
timestamp from indexedTimestamp to estimate total indexing latency, including WebSocket delivery, queueing, batching, and insertion. Historical rows created before timestamp_ingested do not have a reliable original ingestion timestamp.order unchanged while paging through one result set. When reconstructing a book, you can use the snapshot cursor to start the new ascending price_change query described above.Authorizations
Paste your Orbscan API key here. The Bearer prefix is added automatically.
Query Parameters
Market IDs to include. You can provide up to 20 as comma-separated values, repeated parameters, or both.
20["12345"]
Condition IDs to include. You can provide up to 20 as comma-separated values, repeated parameters, or both. Input is case-insensitive.
20[
"0x0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef"
]
Outcome token IDs to include. You can provide up to 50 as comma-separated values, repeated parameters, or both.
50["123456789"]
Event types to include: book, price_change, or both. The endpoint returns both when you omit this parameter.
2book, price_change Inclusive lower bound on source time, Unix milliseconds.
1788852000000
Inclusive upper bound on source time, Unix milliseconds. Must be greater than or equal to from.
Sort by source time. Defaults to asc. Case-insensitive.
asc, desc Page size. Defaults to 1,000. Values outside 1 to 10,000 return 400.
1 <= x <= 10000Opaque cursor from the last item's cursor or the response's nextCursor. Keep the filters and order unchanged while paging one result set. To reconstruct a book, you can use a snapshot cursor to start a new ascending price_change query.