API Reference
Integrate with StarBeto programmatically. Fetch real-time prices, browse markets, and place trades via REST and WebSocket.
Quick Start
Base URL
https://api.starbeto.com
WebSocket
wss://api.starbeto.com/ws
Authentication — include the JWT token in the Authorization header
Authorization: Bearer eyJhbGciOiJIUzI1NiIs...
Example: Place a Trade
1. Log in
curl -X POST https://api.starbeto.com/api/auth/login \
-H "Content-Type: application/json" \
-d '{"email": "[email protected]", "password": "secret"}'
# Response includes "token": "eyJ..."
2. List open markets
curl https://api.starbeto.com/api/markets?status=open
3. Place a bet
curl -X POST https://api.starbeto.com/api/bets \
-H "Content-Type: application/json" \
-H "Authorization: Bearer eyJ..." \
-d '{"marketId": "MARKET_ID", "side": "YES", "amount": 25}'4. Stream live prices via WebSocket
const ws = new WebSocket("wss://api.starbeto.com/ws");
ws.onmessage = (event) => {
const msg = JSON.parse(event.data);
if (msg.type === "price_update") {
console.log(msg.data.asset, msg.data.price);
// BTC 96523.45
}
if (msg.type === "market_settled") {
console.log("Winner:", msg.data.winningSide);
}
};POST
/api/auth/signupCreate a new account. Returns a JWT token and user object.
Request Body
emailstringUser email addresspasswordstringPassword (min 6 chars)displayNamestringPublic display nameResponse
{
"user": {
"id": "uuid",
"email": "[email protected]",
"displayName": "Trader1",
"balance": 1000
},
"token": "eyJhbGciOiJIUzI1NiIs..."
}POST
/api/auth/loginAuthenticate and receive a JWT token.
Request Body
emailstringUser email addresspasswordstringUser passwordResponse
{
"user": { "id": "uuid", "email": "...", "displayName": "...", "balance": 1000 },
"token": "eyJhbGciOiJIUzI1NiIs..."
}GET
/api/auth/meAuth RequiredGet the current authenticated user.
Response
{
"user": { "id": "uuid", "email": "...", "displayName": "...", "balance": 1000 }
}