Developer Resources
Manage your API access and explore the documentation.
Petitions API Documentation
Access Canadian parliamentary petition data programmatically via the MyParliament GraphQL API.
This API provides read access to all petitions from the 45th Canadian Parliament. An API key is required for all requests. Generate your key from the API Dashboard tab above.
Authentication
All API requests require an API key passed via the Authorization header using the Bearer scheme. Generate your API key from the API Dashboard.
Getting your API key
1. Sign in to MyParliament. 2. Navigate to the API Dashboard tab above. 3. Click "Generate API Key". 4. Copy and securely store your key — it is only shown once.
Keep your API key secret. Do not expose it in client-side code, public repositories, or browser-accessible files. If your key is compromised, revoke it immediately from the dashboard and generate a new one.
Rate Limits
API requests are rate-limited per API key to ensure fair usage. Current limits are:
Rate limit headers
Every response includes rate limit information in the headers:
If you need higher rate limits for a production application, contact us — we can adjust limits on a case-by-case basis.
Endpoint
The API exposes a single GraphQL endpoint. All queries are sent as HTTP POST requests with a JSON body containing the query and optionally variables.
https://myparliament.ca/api/graphql/v1
Request format
cURL example
Query: petitions
Returns a paginated list of petitions, optionally filtered and sorted.
Arguments
Returns
A PetitionConnection with items (array of Petition) and pagination metadata.
Example query
Query: petition
Retrieves a single petition by its numeric database ID.
Arguments
Returns
A single Petition object, or null if not found.
Example query
Types
Petition
PetitionProvinceSignature
PetitionConnection
PaginationMeta
Filters & Enums
PetitionFiltersInput
All fields are optional and combined with AND logic. String filters use case-insensitive matching unless otherwise noted.
PetitionSortField (enum)
SortOrder (enum)
Examples
Fetch open e-petitions sorted by popularity
Filter by sponsoring party
Find petitions with signatures from Quebec
Full-text search
Example response
Example response headers
Error Handling
GraphQL errors are returned with HTTP status 200 in the standard errors array. HTTP-level errors are returned with appropriate 4xx/5xx status codes.
GraphQL error shape
Rate limit error (429)
HTTP status codes
Data is sourced from the Parliament of Canada and updated periodically. Signature counts and petition statuses reflect the most recent import and may not be real-time.
MyParliament Developer API · Data sourced from the Parliament of Canada · myparliament.ca