Build prediction market trading applications with our REST API. All endpoints require API key authentication.
Get started in 3 steps:
Authorization: Bearer YOUR_API_KEY
/api/v1/basketsEnter your API key to test endpoints interactively:
Don't have an API key? Create one here
http://localhost:5085/api/v1
All API requests require an API key passed in the Authorization header:
Authorization: Bearer bkt_live_your_api_key_here
Get your API key from the Developer Portal.
import requests
BASE_URL = "http://localhost:5085/api/v1"
API_KEY = "bkt_live_your_api_key_here"
headers = {
"Authorization": f"Bearer {API_KEY}",
"Content-Type": "application/json"
}
# Make a request
response = requests.get(f"{BASE_URL}/baskets", headers=headers)
data = response.json()
print(data)
const BASE_URL = 'http://localhost:5085/api/v1';
const API_KEY = 'bkt_live_your_api_key_here';
// Using fetch
const response = await fetch(`${BASE_URL}/baskets`, {
method: 'GET',
headers: {
'Authorization': `Bearer ${API_KEY}`,
'Content-Type': 'application/json'
}
});
const data = await response.json();
console.log(data);
curl -X GET "http://localhost:5085/api/v1/baskets" \
-H "Authorization: Bearer bkt_live_your_api_key_here" \
-H "Content-Type: application/json"
All responses are JSON. Success responses:
{
"success": true,
"message": "Success",
"data": { /* response data */ }
}
Error responses:
{
"success": false,
"message": "Error message",
"errors": { /* error details */ }
}
Success Response (List Baskets):
{
"success": true,
"message": "Success",
"data": [
{
"id": "election-hedge-2024",
"name": "Election Hedge 2024",
"description": "Hedge against election outcomes",
"current_price": 0.65,
"stats": {
"current_price": 0.65,
"change_1d": 2.5,
"underlyers_count": 3
}
}
],
"meta": {
"page": 1,
"per_page": 20,
"total": 5,
"pages": 1
}
}
Error Response (Unauthorized):
{
"success": false,
"message": "Invalid API key"
}
Error Response (Not Found):
{
"success": false,
"message": "Basket not found"
}
List all baskets with current prices and statistics. Returns paginated results.
import requests
BASE_URL = "http://localhost:5085/api/v1"
API_KEY = "bkt_live_your_api_key_here"
headers = {
"Authorization": f"Bearer {API_KEY}",
"Content-Type": "application/json"
}
# List baskets with pagination
response = requests.get(
f"{BASE_URL}/baskets",
params={"page": 1, "per_page": 20},
headers=headers
)
data = response.json()
print(data)
const BASE_URL = 'http://localhost:5085/api/v1';
const API_KEY = 'bkt_live_your_api_key_here';
const response = await fetch(`${BASE_URL}/baskets?page=1&per_page=20`, {
method: 'GET',
headers: {
'Authorization': `Bearer ${API_KEY}`,
'Content-Type': 'application/json'
}
});
const data = await response.json();
console.log(data);
curl -X GET "http://localhost:5085/api/v1/baskets?page=1&per_page=20" \
-H "Authorization: Bearer bkt_live_your_api_key_here" \
-H "Content-Type: application/json"
Get detailed information about a specific basket including current price and statistics.
import requests
BASE_URL = "http://localhost:5085/api/v1"
API_KEY = "bkt_live_your_api_key_here"
BASKET_ID = "election-hedge-2024"
headers = {
"Authorization": f"Bearer {API_KEY}",
"Content-Type": "application/json"
}
response = requests.get(
f"{BASE_URL}/baskets/{BASKET_ID}",
headers=headers
)
data = response.json()
print(data)
const BASE_URL = 'http://localhost:5085/api/v1';
const API_KEY = 'bkt_live_your_api_key_here';
const basketId = 'election-hedge-2024';
const response = await fetch(`${BASE_URL}/baskets/${basketId}`, {
method: 'GET',
headers: {
'Authorization': `Bearer ${API_KEY}`,
'Content-Type': 'application/json'
}
});
const data = await response.json();
console.log(data);
curl -X GET "http://localhost:5085/api/v1/baskets/election-hedge-2024" \
-H "Authorization: Bearer bkt_live_your_api_key_here" \
-H "Content-Type: application/json"
Get current price for a basket including last update timestamp and individual underlyer prices.
import requests
BASE_URL = "http://localhost:5085/api/v1"
API_KEY = "bkt_live_your_api_key_here"
BASKET_ID = "election-hedge-2024"
headers = {
"Authorization": f"Bearer {API_KEY}",
"Content-Type": "application/json"
}
response = requests.get(
f"{BASE_URL}/baskets/{BASKET_ID}/price",
headers=headers
)
data = response.json()
print(data)
const BASE_URL = 'http://localhost:5085/api/v1';
const API_KEY = 'bkt_live_your_api_key_here';
const basketId = 'election-hedge-2024';
const response = await fetch(`${BASE_URL}/baskets/${basketId}/price`, {
method: 'GET',
headers: {
'Authorization': `Bearer ${API_KEY}`,
'Content-Type': 'application/json'
}
});
const data = await response.json();
console.log(data);
curl -X GET "http://localhost:5085/api/v1/baskets/election-hedge-2024/price" \
-H "Authorization: Bearer bkt_live_your_api_key_here" \
-H "Content-Type: application/json"
Search markets across Polymarket and Kalshi. Markets are sorted by volume (highest first).
import requests
BASE_URL = "http://localhost:5085/api/v1"
API_KEY = "bkt_live_your_api_key_here"
headers = {
"Authorization": f"Bearer {API_KEY}",
"Content-Type": "application/json"
}
# Search markets
response = requests.get(
f"{BASE_URL}/markets/search",
params={
"platform": "all",
"category": "politics",
"expiration": "2024",
"limit": 100
},
headers=headers
)
data = response.json()
print(data)
const BASE_URL = 'http://localhost:5085/api/v1';
const API_KEY = 'bkt_live_your_api_key_here';
const params = new URLSearchParams({
platform: 'all',
category: 'politics',
expiration: '2024',
limit: '100'
});
const response = await fetch(`${BASE_URL}/markets/search?${params}`, {
method: 'GET',
headers: {
'Authorization': `Bearer ${API_KEY}`,
'Content-Type': 'application/json'
}
});
const data = await response.json();
console.log(data);
curl -X GET "http://localhost:5085/api/v1/markets/search?platform=all&category=politics&expiration=2024&limit=100" \
-H "Authorization: Bearer bkt_live_your_api_key_here" \
-H "Content-Type: application/json"