API Reference
Complete API endpoint documentation
Base URL
https://api.senraio.comAuthentication
Use a Bearer token (your API key) in the Authorization header, or X-API-Key.
Authorization: Bearer sk_live_your_api_key_here
Endpoints
- GET /api/v1/predict/{bill_id} — Get all predictions for a bill (Royal Assent and risk models). When (schedule) from Parliament.
- POST /api/v1/predictions/batch — Predictions for multiple bills (up to 100 per request). POST /api/v1/predict/batch is also supported as an alias.
- POST /api/v1/alerts/thresholds — Create predictive alert thresholds (Pilot+).
Responses include risk predictions: stall_risk, amendment_risk, close_vote (experimental — rough indicator only), withdrawal_risk, plus risk_indicators (controversy_score, momentum_score, levels).
Error handling
| Code | Description |
|---|---|
| 200 | Success |
| 400 | Bad Request |
| 401 | Unauthorized |
| 403 | Forbidden |
| 404 | Not Found |
| 429 | Rate limit exceeded |
| 503 | Service Unavailable (models loading) |
Rate limits
| Tier | API calls/day | Batch/day |
|---|---|---|
| Free | 0 | 0 |
| Pilot | 1,000 | 10 |
| Pro | Unlimited | 100 |