Game Theory
Seat apportionment API
Allocates seats to parties by D'Hondt, Sainte-Laguë (highest averages) or Hamilton (largest remainder), returning allocation plus seat/vote shares. Answers 'How are parliamentary seats divided under D'Hondt?', 'What does Sainte-Laguë vs Hamilton give for these vote totals?'.
Price$0.08per request
MethodPOST
Route/v1/gametheory/apportionment
StatusLive
MIME typeapplication/json
Rate limit120/minute
Cache0s public
social-choiceapportionmentdhondtsainte-laguehamiltonseatsproportionalelection
API URL
Integration docshttps://x402.hexl.dev/v1/gametheory/apportionmentExample request
{
"votes": {
"A": 100,
"B": 80,
"C": 30
},
"seats": 8,
"method": "dhondt"
}Example response
{
"method": "dhondt",
"seats": 8,
"totalVotes": 210,
"allocation": {
"A": 4,
"B": 3,
"C": 1
},
"seatShare": {
"A": 0.5,
"B": 0.375,
"C": 0.125
},
"voteShare": {
"A": 0.47619,
"B": 0.380952,
"C": 0.142857
},
"interpretation": "dhondt apportionment of 8 seats: A=4, B=3, C=1."
}Input schema
{
"type": "object",
"required": [
"votes",
"seats"
],
"properties": {
"votes": {
"type": "object",
"examples": [
{
"A": 100,
"B": 80,
"C": 30
}
]
},
"seats": {
"type": "integer",
"minimum": 1,
"examples": [
8
]
},
"method": {
"type": "string",
"enum": [
"dhondt",
"sainte-lague",
"hamilton"
],
"examples": [
"dhondt"
]
}
}
}Output schema
{
"type": "object",
"additionalProperties": true
}