Represent provides a REST API to a wealth of information about Canadian elected officials and electoral districts.
The base URL for all requests is
You can filter resources with query string parameters. For example, to find representatives named “Rodney,” send a request to
/representatives/?first_name=Rodney. Each resource below lists the fields you can filter on.
You can perform substring queries by appending
__querytype to the parameter name, where
querytype is one of
isnull. A leading
i makes the match case-insensitive. For example, to find representatives whose last name starts with “M” or “m”, send a request to
All resources output JSON. For a user-friendly HTML version of the JSON response, add
format=apibrowser to the query string. Add
pretty=1 to just indent the raw JSON. We support JSONP for client-side cross-domain requests – just add a
callback parameter to the query string.
Lists of resources are paginated. Under the
meta field, the
next field links to the next page, and
previous links to the previous page (if available).
total_count is the total number of items in the list. You can control the number of items returned by adding a
limit parameter to the query string, and the start offset by adding an
To download all representatives, send a request to http://represent.opennorth.ca/representatives/?limit=1000 and follow the
next link in
meta section until you reach the end. We host the digital boundary files and postal codeOM concordances which we have permission to distribute on GitHub.
If you make more than 60 requests per minute, you may receive a HTTP 503 Service Unavailable error. Please contact email@example.com if you expect high usage.
Not required, but consider adding:
District and politician data from <a href="http://represent.opennorth.ca/">Represent</a>
All our representative data comes from scrapers. If you’d like to improve our representative data, update our scrapers! Find the link to the scraper in the
scraperwiki_url field of the representative set resource, make a copy of the scraper on ScraperWiki, edit your copy, then email firstname.lastname@example.org. If you’d like to add a new representative set, use an existing scraper as an example.
A boundary set is a group of districts, like BC electoral districts or Toronto wards. Discover what boundary sets are available and get details on their source.
A boundary is a single district.
external_id field (which is not always present) is a numerical ID used in the source shapefile to identify districts. The
metadata field contains all attributes from the source shapefile; it is unmodified and may be out-of-date or erroneous.
To access spatial data, follow the links in the
simple_shape is the district’s shape simplified to a tolerance of 0.002, which looks fine and loads faster. The default output is GeoJSON. You may request KML or Well-Known Text by adding
format=wkt to the query string.
A Canadian postal code. URLs should include the code in uppercase with no spaces.
boundaries_centroid field lists boundaries that contain the postal code’s center point (centroid), provided by Geocoder.ca. A centroid is a point, but a postal code is a shape (a set of points), so the list of boundaries in
boundaries_centroid will sometimes be inaccurate.
boundaries_concordance field lists boundaries linked to the postal code according to official government data. Postal codes can cross electoral districts, therefore the
boundaries_concordance field may list, for example, multiple Ontario electoral districts for a single postal code like K0A 1K0.
If you are searching for a specific boundary, you must check both
The response also has
representatives_concordance fields that behave similarly.
If you are searching for a specific representative, check both
In most cases, the
centroid fields will be non-empty.
Postal CodeOM is an official mark of Canada Post Corporation.
A representative set is a group of elected officials, like the House of Commons or Toronto City Council. Discover what representative sets are available and get the URL to their scraper on ScraperWiki.
A representative is an elected official.
Only the “required” fields below are always present in the response. You can improve the data we provide by updating our scrapers.
|elected_office||Yes||MP, MLA, Mayor, Councillor, Alderman||Will be the same for all representatives at the federal and provincial levels|
|source_url||Yes||The URL at which the data is scraped||May be the same as
|first_name||Stephen||If you're writing a scraper, only set this field if the first name appears separately in the source. Don't parse it out yourself.|
|last_name||Harper||If you're writing a scraper, only set this field if the last name appears separately in the source. Don't parse it out yourself.|
|url||http://legislature.ca/stephen-harper||This should generally be the URL to the representative's page on the official legislature site|
|personal_url||http://stephenharper.blogspot.com/||A site run by the representative that's not on the official legislature site|
|district_id||24013||If there's an ID provided alongside the district name|
||A JSON array with basic contact information for the representative's offices. It should be an
array of JSON objects (hashes), with the optional keys:
||A JSON object with any extra data you think is worth collecting that doesn't fit in other fields|
An election is an event with a date, tied to a group of electoral candidates.
This resource behaves like the representative sets resource; see that resource for additional example queries.
Do not rely on this endpoint for an authoritative list of elections in Canada.
A candidate is a person running for office in an election.
This resource behaves like the representative resource; see that resource for additional example queries.
Candidate lists may be incomplete or incorrect, given the frequency of changes and the unreliability of sources. Independent and small-party candidates are especially likely to be missing.