Canadian Electoral Data API
Free, accurate electoral boundary data for all levels of Canadian government.
Base URL: https://ridingdesk.ca/api/v1/electoral
All responses are JSON. Dates use ISO 8601 format. GeoJSON follows the RFC 7946 specification.
Authentication
The API supports three access tiers. Anonymous access requires no credentials.
| Tier | Rate Limit | Price | Auth Required |
|---|---|---|---|
| Anonymous | 10 req/min | Free | No |
| Free API Key | 100 req/min | Free | Yes |
| Pro | 1,000 req/min | $29/month | Yes |
Pass your API key via the Authorization header or as a query parameter:
Authorization: Bearer ced_a1b2c3d4e5f6...
GET /api/v1/electoral/lookup?postalCode=K2P1L4&api_key=ced_a1b2c3d4e5f6...
Postal Code Lookup
Look up all electoral boundaries (federal, provincial, municipal) for a Canadian postal code.
/api/v1/electoral/lookup?postalCode=K2P1L4| Parameter | Type | Required | Description |
|---|---|---|---|
postalCode | string | required | Canadian postal code (e.g. K2P1L4 or K2P 1L4). Spaces are ignored. |
{
"postalCode": "K2P1L4",
"province": "ON",
"federal": {
"id": "clx9abc123...",
"name": "Ottawa Centre",
"code": "35079",
"boundaryUrl": "/boundaries/federal-electoral-districts-2023-representation-order/35079/"
},
"provincial": {
"id": "clx9def456...",
"name": "Ottawa Centre",
"code": "16",
"boundaryUrl": "/boundaries/ontario-electoral-districts/16/"
},
"municipal": {
"id": "clx9ghi789...",
"name": "Somerset Ward",
"code": "12",
"boundaryUrl": "/boundaries/ottawa-wards/12/"
}
}List Boundaries
Retrieve a paginated list of electoral boundaries, filtered by level and province.
/api/v1/electoral/boundaries?level=FEDERAL&province=ON&page=1&limit=20| Parameter | Type | Required | Description |
|---|---|---|---|
level | string | optional | FEDERAL, PROVINCIAL, or MUNICIPAL |
province | string | optional | Two-letter province code (e.g. ON, QC, BC) |
q | string | optional | Full-text search on boundary name (e.g. Ottawa) |
page | integer | optional | Page number (default: 1) |
limit | integer | optional | Results per page, max 100 (default: 20) |
{
"data": [
{
"id": "clx9abc123...",
"level": "FEDERAL",
"province": "ON",
"code": "35079",
"name": "Ottawa Centre",
"population": 108000,
"electorCount": 82000
}
],
"meta": {
"page": 1,
"limit": 20,
"total": 121,
"totalPages": 7
}
}Get Boundary
Retrieve full details for a single electoral boundary by ID.
/api/v1/electoral/boundaries/{id}{
"id": "clx9abc123...",
"level": "FEDERAL",
"province": "ON",
"code": "35079",
"name": "Ottawa Centre",
"nameEn": "Ottawa Centre",
"nameFr": "Ottawa-Centre",
"population": 108000,
"electorCount": 82000,
"centroidLat": 45.4215,
"centroidLng": -75.6972,
"spendingLimit": "120000.00",
"contributionLimit": "1725.00",
"validFrom": "2023-06-22T00:00:00.000Z",
"validUntil": null,
"sourceUrl": "https://www.elections.ca/...",
"confidence": "HIGH"
}Get Boundary Shape
Returns the boundary geometry as a GeoJSON Polygon or MultiPolygon.
/api/v1/electoral/boundaries/{id}/shape{
"type": "MultiPolygon",
"coordinates": [
[
[
[-75.7280, 45.3980],
[-75.6660, 45.3980],
[-75.6660, 45.4450],
[-75.7280, 45.4450],
[-75.7280, 45.3980]
]
]
]
}Get Candidates
List candidates for a boundary in a specific election.
/api/v1/electoral/boundaries/{id}/candidates?electionId=...| Parameter | Type | Required | Description |
|---|---|---|---|
electionId | string | required | The ID of an election event |
{
"data": [
{
"id": "clx9xyz...",
"name": "Yasir Naqvi",
"party": "Liberal Party of Canada",
"incumbent": true,
"elected": false,
"votesReceived": 22150,
"voteShare": 0.38
}
]
}Get Polling Divisions
List all polling divisions within a boundary.
/api/v1/electoral/boundaries/{id}/polls{
"data": [
{
"id": "clx9poll...",
"pollNumber": "001",
"name": "St. Luke's Church Hall",
"address": "760 Somerset St W, Ottawa, ON",
"registeredVoters": 432
}
]
}List Elections
Browse past and upcoming elections.
/api/v1/electoral/elections?level=FEDERAL&year=2025| Parameter | Type | Required | Description |
|---|---|---|---|
level | string | optional | FEDERAL, PROVINCIAL, or MUNICIPAL |
year | integer | optional | Filter by election year |
{
"data": [
{
"id": "clx9elec...",
"level": "FEDERAL",
"name": "2025 Federal General Election",
"electionDate": "2025-04-28T00:00:00.000Z",
"writsIssued": "2025-03-23T00:00:00.000Z"
}
]
}API Status
Check service health and data freshness.
/api/v1/electoral/status{
"status": "operational",
"version": "1.0.0",
"data": {
"federalBoundaries": 343,
"provincialBoundaries": 893,
"municipalBoundaries": 2150,
"lastUpdated": "2026-03-01T00:00:00.000Z"
}
}Register for API Key
Create a free API key to increase your rate limit from 10 to 100 requests per minute.
/api/v1/electoral/register{
"name": "My Civic App",
"email": "[email protected]"
}{
"apiKey": "ced_a1b2c3d4e5f6g7h8i9j0...",
"tier": "FREE",
"rateLimit": 100,
"message": "Store this key securely — it will not be shown again."
}Rate Limiting
Requests are rate-limited per minute based on your tier. When the limit is exceeded, the API returns 429 Too Many Requests.
| Tier | Limit |
|---|---|
| Anonymous | 10 req/min |
| Free API Key | 100 req/min |
| Pro ($29/mo) | 1,000 req/min |
Every response includes rate-limit headers:
X-RateLimit-Limit: 100 X-RateLimit-Remaining: 87
Data Coverage
Federal
343 ridings based on the Elections Canada 2023 Representation Order. Updated monthly.
Provincial
All 10 provinces covered. Updated monthly.
Municipal
Top 50+ Canadian cities. Updated quarterly.
Data Sources
- Elections Canada — federal riding boundaries, candidates, and results
- Provincial election agencies (Elections Ontario, Elections BC, etc.)
- Municipal open data portals
- Statistics Canada — population and postal code reference data