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.

TierRate LimitPriceAuth Required
Anonymous10 req/minFreeNo
Free API Key100 req/minFreeYes
Pro1,000 req/min$29/monthYes

Pass your API key via the Authorization header or as a query parameter:

Header (recommended)
Authorization: Bearer ced_a1b2c3d4e5f6...
Query parameter
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.

GET/api/v1/electoral/lookup?postalCode=K2P1L4
ParameterTypeRequiredDescription
postalCodestringrequiredCanadian postal code (e.g. K2P1L4 or K2P 1L4). Spaces are ignored.
Response 200
{
  "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.

GET/api/v1/electoral/boundaries?level=FEDERAL&province=ON&page=1&limit=20
ParameterTypeRequiredDescription
levelstringoptionalFEDERAL, PROVINCIAL, or MUNICIPAL
provincestringoptionalTwo-letter province code (e.g. ON, QC, BC)
qstringoptionalFull-text search on boundary name (e.g. Ottawa)
pageintegeroptionalPage number (default: 1)
limitintegeroptionalResults per page, max 100 (default: 20)
Response 200
{
  "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.

GET/api/v1/electoral/boundaries/{id}
Response 200
{
  "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.

GET/api/v1/electoral/boundaries/{id}/shape
Response 200
{
  "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.

GET/api/v1/electoral/boundaries/{id}/candidates?electionId=...
ParameterTypeRequiredDescription
electionIdstringrequiredThe ID of an election event
Response 200
{
  "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.

GET/api/v1/electoral/boundaries/{id}/polls
Response 200
{
  "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.

GET/api/v1/electoral/elections?level=FEDERAL&year=2025
ParameterTypeRequiredDescription
levelstringoptionalFEDERAL, PROVINCIAL, or MUNICIPAL
yearintegeroptionalFilter by election year
Response 200
{
  "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.

GET/api/v1/electoral/status
Response 200
{
  "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.

POST/api/v1/electoral/register
Request body
{
  "name": "My Civic App",
  "email": "[email protected]"
}
Response 201
{
  "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.

TierLimit
Anonymous10 req/min
Free API Key100 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