API Quickstart
API playground:
🔑 Authentication
Include your API Key in every request header:
X-API-Key: your-api-key
📌 Endpoints & Usage Examples
1. Create an Event
Request:
POST /api/v2/events
JSON Body Example:
{
"title": "Bitcoin price prediction",
"description": "Will Bitcoin price exceed $50,000 by June 1st?",
"cutoff": "2025-05-31T23:59:00Z"
}
Example (curl):
curl -X POST "<https://api.example.com/api/v2/events>" \\
-H "X-API-Key: your-api-key" \\
-H "Content-Type: application/json" \\
-d '{"title":"Bitcoin price prediction","description":"Will Bitcoin price exceed $50,000 by June 1st?","cutoff":"2025-05-31T23:59:00Z"}'
Success Response (201):
{
"event_id": "987654321",
"market_type": "default",
}
Save the event_id in order to use it to get your prediction.
2. Get Event Details
You can use that to read an existing event or check that your previous event was indeed processed by the network. The latency here is the time for the event to reach the validator.
Request:
GET /api/v2/validator/events/{event_id}
Example (curl):
curl -X GET "<https://api.example.com/api/v2/validator/events/987654321>" \\
-H "X-API-Key: your-api-key"
Success Response (200):
{
"unique_event_id": "evt_987654321",
"event_id": "987654321",
"market_type": "default",
"description": "Will Bitcoin price exceed $50,000 by June 1st?",
"status": 1,
"metadata": "{}",
"created_at": "2025-04-02T10:00:00Z",
"cutoff": "2025-05-31T23:59:00Z"
}
3. Get Event Predictions
You will need to wait on average 5 minutes before getting a prediction from the network.
Request:
GET /api/v2/validator/events/{event_id}/predictions
Example (curl):
curl -X GET "<https://api.example.com/api/v2/validator/events/987654321/predictions>" \\
-H "X-API-Key: your-api-key"
Success Response (200):
{
"count": 1,
"predictions": [
{
"unique_event_id": "evt_987654321",
"minerHotkey": "hotkey123",
"minerUid": "miner001",
"predictedOutcome": "Yes",
"interval_start_minutes": 30,
"interval_agg_prediction": 0.78,
"submitted": "2025-04-05T15:00:00Z"
}
]
}
4. Get Community Prediction
Request:
GET /api/v2/validator/events/{event_id}/community_prediction
Example (curl):
curl -X GET "<https://api.example.com/api/v2/validator/events/987654321/community_prediction>" \\
-H "X-API-Key: your-api-key"
Success Response (200):
{
"event_id": "987654321",
"community_prediction": 0.62
}
🚩 Common API Errors
Status Code
Meaning
Solution
400
Bad Request
Check your request body (JSON syntax/fields).
401
Unauthorized
Verify your API key.
422
Validation Error
Check required parameters or their types.
500
Server Error
Try again later or contact support.
Last updated