This document specifies the RESTful API for the Quorum AI autonomous voting agent application. All endpoints follow REST conventions and return JSON responses.
- Development:
http://localhost:8716 - Production: Configured via environment variables
Currently, the API does not require authentication. Future iterations may add API key or OAuth2 authentication.
{
"data": {...},
"status": "success"
}{
"detail": "Error message",
"status": "error"
}200 OK: Successful request201 Created: Resource created successfully400 Bad Request: Invalid request parameters404 Not Found: Resource not found500 Internal Server Error: Server error
Returns the health status of the service.
Response:
{
"status": "healthy",
"timestamp": "2025-01-30T10:00:00Z",
"agent_active": true,
"version": "1.0.0"
}Search and filter proposals from Snapshot spaces.
Query Parameters:
space_id(required): The Snapshot space IDstate(optional): Filter by proposal state (active, closed, pending)limit(optional, default: 20): Number of results to returnoffset(optional, default: 0): Pagination offset
Response:
{
"proposals": [
{
"id": "0x123...",
"title": "Proposal Title",
"space": {
"id": "space.eth",
"name": "Space Name"
},
"state": "active",
"start": 1234567890,
"end": 1234567890,
"snapshot": "12345678",
"author": "0xabc...",
"choices": ["For", "Against", "Abstain"],
"scores": [100.5, 50.2, 10.1],
"scores_total": 160.8,
"quorum": 100.0
}
],
"total": 100,
"has_more": true
}Get detailed information about a specific proposal.
Path Parameters:
proposal_id: The proposal ID
Response:
{
"id": "0x123...",
"title": "Proposal Title",
"body": "Full proposal description...",
"space": {
"id": "space.eth",
"name": "Space Name"
},
"state": "active",
"author": "0xabc...",
"created": 1234567890,
"start": 1234567890,
"end": 1234567890,
"snapshot": "12345678",
"choices": ["For", "Against", "Abstain"],
"scores": [100.5, 50.2, 10.1],
"scores_total": 160.8,
"quorum": 100.0,
"votes": 42
}Generate AI summaries for multiple proposals.
Request Body:
{
"proposal_ids": ["0x123...", "0x456..."],
"space_id": "space.eth"
}Response:
{
"summaries": [
{
"proposal_id": "0x123...",
"title": "Proposal Title",
"summary": "AI-generated summary...",
"key_points": ["Point 1", "Point 2"],
"risk_assessment": "Low risk proposal that...",
"recommendation": "Consider voting FOR because..."
}
]
}Get the top voters for a specific proposal.
Path Parameters:
proposal_id: The proposal ID
Query Parameters:
limit(optional, default: 10): Number of top voters to return
Response:
{
"voters": [
{
"voter": "0xabc...",
"voting_power": 1000.5,
"choice": 1,
"reason": "I support this because..."
}
],
"total_voters": 150
}Trigger the autonomous voting agent to analyze and vote on proposals.
Request Body:
{
"space_id": "space.eth",
"dry_run": false
}Response:
{
"message": "Agent run completed successfully",
"run_id": "run_123456",
"proposals_analyzed": 15,
"votes_cast": 3,
"dry_run": false
}Get the current status of the autonomous voting agent.
Response:
{
"current_state": "idle",
"last_run_timestamp": "2025-01-30T10:00:00Z",
"is_active": false,
"current_space_id": "space.eth"
}Status Values:
current_state: One ofidle,fetching_proposals,analyzing,voting,erroris_active: Boolean indicating if agent is currently runninglast_run_timestamp: ISO 8601 timestamp of last completed runcurrent_space_id: The space ID from the most recent run
Get recent voting decisions made by the agent.
Query Parameters:
limit(optional, default: 10): Number of decisions to return
Response:
{
"decisions": [
{
"proposal_id": "0x123...",
"proposal_title": "Proposal Title",
"vote": "FOR",
"confidence": 0.85,
"timestamp": "2025-01-30T10:00:00Z",
"space_id": "space.eth",
"reasons": ["Aligns with DAO goals", "Low risk"]
}
]
}Get aggregated statistics about the agent's performance.
Response:
{
"total_runs": 42,
"total_proposals_reviewed": 256,
"total_votes_cast": 89,
"average_confidence": 0.78,
"success_rate": 0.95
}Statistics Definitions:
total_runs: Total number of agent runs executedtotal_proposals_reviewed: Sum of all proposals analyzedtotal_votes_cast: Sum of all votes submittedaverage_confidence: Average confidence score across all votessuccess_rate: Percentage of runs completed without errors
Retrieve the current user preferences for the autonomous voting agent.
Response:
{
"voting_strategy": "balanced",
"confidence_threshold": 0.7,
"max_proposals_per_run": 10,
"blacklisted_proposers": ["0x123...", "0x456..."],
"whitelisted_proposers": ["0x789..."]
}Status Codes:
200 OK: Preferences found and returned404 Not Found: No preferences configured (new user)
Update all user preferences. This is a full replacement operation.
Request Body:
{
"voting_strategy": "conservative",
"confidence_threshold": 0.8,
"max_proposals_per_run": 5,
"blacklisted_proposers": ["0x123..."],
"whitelisted_proposers": []
}Response:
{
"voting_strategy": "conservative",
"confidence_threshold": 0.8,
"max_proposals_per_run": 5,
"blacklisted_proposers": ["0x123..."],
"whitelisted_proposers": []
}Validation Rules:
voting_strategy: Must be one ofconservative,balanced,aggressiveconfidence_threshold: Must be between 0.0 and 1.0max_proposals_per_run: Must be between 1 and 10- Proposer addresses must be valid Ethereum addresses
All endpoints follow a consistent error response format:
{
"detail": "Descriptive error message",
"status": "error",
"code": "ERROR_CODE"
}VALIDATION_ERROR: Invalid request parametersNOT_FOUND: Resource not foundINTERNAL_ERROR: Server errorRATE_LIMITED: Too many requestsSERVICE_UNAVAILABLE: External service unavailable
{
"detail": "Invalid space_id format",
"status": "error",
"code": "VALIDATION_ERROR"
}{
"detail": "Proposal not found",
"status": "error",
"code": "NOT_FOUND"
}{
"detail": "Failed to connect to Snapshot API",
"status": "error",
"code": "SERVICE_UNAVAILABLE"
}The API implements rate limiting to prevent abuse:
- Default: 100 requests per minute per IP
- Agent runs: 10 requests per hour
- Bulk operations: 20 requests per hour
Rate limit headers are included in responses:
X-RateLimit-Limit: Maximum requests allowedX-RateLimit-Remaining: Requests remainingX-RateLimit-Reset: Unix timestamp when limit resets
Future versions may support webhooks for real-time notifications:
- Agent run completed
- Vote cast
- Error occurred
The complete OpenAPI schema is available at /openapi.json and can be viewed interactively at /docs (Swagger UI) or /redoc (ReDoc).
Frontend developers can generate a type-safe client:
cd frontend
npm run generate-apiThis uses the OpenAPI schema to create TypeScript types and a client in src/lib/api/.