CanLII maintains an API that allows authorized developers to programmatically access metadata about the CanLII collection.
The API is a read-only REST HTTP API. All request parameters are specified in the URLs used to make the calls. Information will be returned in the form of JSON structures.
To apply for an API key, please send a message with your contact information to the feedback form.
Parameter | Description |
---|---|
language | {en} or {fr}. This impacts the language of the output. When retrieving a list of legislative text using legislationBrowse (see below), if using "en" as a parameter, the English name of statutes will be returned as output, and if using "fr", the French name will be returned. This functionality is restricted by what languages are available in the dataset. |
key | Your API key. |
https://api.canlii.org/v1/caseBrowse/{language}/?api_key={key}
See "Common parameters" above.
https://api.canlii.org/v1/caseBrowse/en/?api_key={key}
This will return the following list:
{
"caseDatabases": [
{
"databaseId": "oncicb",
"jurisdiction": "on",
"name": "Criminal Injuries Compensation Board"
},
{
"databaseId": "nlpc",
"jurisdiction": "nl",
"name": "Provincial Court of Newfoundland and Labrador"
},
{
"databaseId": "nbls",
"jurisdiction": "nb",
"name": "Law Society of New Brunswick"
},
... // other databases
https://api.canlii.org/v1/caseBrowse/{language}/{databaseId}/?offset={offset}&resultCount={resultCount}
Parameter | Description |
---|---|
databaseId | See above. |
offset | The record number from which to start returning results. Using 0 will return the records most recently added to that database, subject to optional parameters (see below). |
resultCount | The length of the list of results that will be returned. Max 10,000. |
Parameter | Description |
---|---|
[&publishedBefore=date] or [&publishedAfter=date] | The date when the decision was first published on CanLII. (Note: documents may be available only after this date. To get all current documents a two day lag is recommended.) |
[&modifiedBefore=date] or [&modifiedAfter=date] | The date when the content of the decision was last modified on CanLII. |
[&changedBefore=date] or [&changedAfter=date] | The date the metadata of the decision or its content was last modified on CanLII. |
[decisionDateBefore=date] or [&decisionDateAfter=date] | The date of the decision. |
Notes:
- "date" is a YYYY-MM-DD (ISO-8601) formatted date
- The conditions are inclusive i.e. publishedAfter=2012-12-12 will return decisions published on 2012-12-12
https://api.canlii.org/v1/caseBrowse/en/onca/?offset=0&resultCount=3&publishedBefore=2015-01-01&api_key={key}
This will return:
{
"cases": [
{
"databaseId": "onca",
"caseId": {
"en": "2014onca925"
},
"title": "Ariston Realty Corp. v. Elcarim Inc.",
"citation": "2014 ONCA 925 (CanLII)"
},
{
"databaseId": "onca",
"caseId": {
"en": "2014onca922"
},
"title": "Kassburg v. Sun Life Assurance Company of Canada",
"citation": "2014 ONCA 922 (CanLII)"
},
{
"databaseId": "onca",
"caseId": {
"en": "2014onca921"
},
"title": "Gutowski v. Clayton",
"citation": "2014 ONCA 921 (CanLII)"
}
]
}
https://api.canlii.org/v1/caseBrowse/{language}/{databaseId}/{caseId}/?api_key={key}
Parameter | Description |
---|---|
databaseId | See above. |
caseId | The case's unique identifier, as returned by the previous type of call. Generally corresponds to the CanLII citation. |
To fetch metadata for the Dunsmuir case (Dunsmuir v. New Brunswick, [2008] 1 SCR 190, 2008 SCC 9), you would use:
https://api.canlii.org/v1/caseBrowse/en/csc-scc/2008scc9/?api_key={key}
This will return:
{
"databaseId": "csc-scc",
"caseId": "2008scc9",
"url": "http://canlii.ca/t/1vxsm",
"title": "Dunsmuir v. New Brunswick",
"citation": "[2008] 1 SCR 190, 2008 SCC 9 (CanLII)",
"language": "en",
"docketNumber": "31459",
"decisionDate": "2008-03-07",
"keywords": "adjudicator — review — reasonableness — administrative — procedural fairness",
"concatenatedId": "2008csc-scc9"
}
https://api.canlii.org/v1/caseCitator/en/{databaseId}/{caseId}/metadataType?api_key={key}
Parameter | Description |
---|---|
language | For this type of call, only "en" is supported. |
databaseId | See above. |
caseId | See above. |
metadataType | citedCases or citingCases or citedLegislations |
https://api.canlii.org/v1/caseCitator/en/onca/1999canlii1527/citedCases?api_key={key}
This will return:
{
"citedCases": [
{
"databaseId": "onca",
"caseId": {
"en": "1998canlii2237"
},
"title": "Alper Development Inc. v. Harrowston Corp.",
"citation": "1998 CanLII 2237 (ON CA)"
},
{
"databaseId": "onca",
"caseId": {
"en": "1983canlii1820"
},
"title": "Berger v. Willowdale A.M.C. et al.",
"citation": "1983 CanLII 1820 (ON CA)"
}
... // other cases
https://api.canlii.org/v1/legislationBrowse/{language}/?api_key={key}
See "Common parameters" above.
https://api.canlii.org/v1/legislationBrowse/en/?api_key={key}
This will return the following list:
{
"legislationDatabases": [
{
"databaseId": "caa",
"type": "ANNUAL_STATUTE",
"jurisdiction": "ca",
"name": "Annual Statutes of Canada"
},
{
"databaseId": "ska",
"type": "ANNUAL_STATUTE",
"jurisdiction": "sk",
"name": "Annual Statutes of Saskatchewan"
},
{
"databaseId": "nur",
"type": "REGULATION",
"jurisdiction": "nu",
"name": "Regulations of Nunavut"
... // other databases
https://api.canlii.org/v1/legislationBrowse/{language}/{databaseId}/?api_key={key}
Parameter | Description |
---|---|
databaseId | The code for the database for which you want a list. Generally, this will be the provincial or territorial two-letter code, followed by either "s" (for statutes), "r" (for regulations), or "a" (for annual statutes, when available). These can be obtained with the previous API call. |
https://api.canlii.org/v1/legislationBrowse/en/ons/?api_key={key}
https://api.canlii.org/v1/{legislationBrowse}/{language}/{databaseId}/{legislationId}/?api_key={key}
This will return:
{
"legislations": [
{
"databaseId": "ons",
"legislationId": "rso-1990-c-a1",
"title": "Abandoned Orchards Act",
"citation": "RSO 1990, c A.1",
"type": "STATUTE"
},
{
"databaseId": "ons",
"legislationId": "rso-1990-c-a2",
"title": "Absconding Debtors Act",
"citation": "RSO 1990, c A.2",
"type": "STATUTE"
}
... // more statutes
Parameter | Description |
---|---|
databaseId | See above. |
legislationId | Specific ID for the piece of legislation that is being queried. Obtained with the previous API call. |
https://api.canlii.org/v1/legislationBrowse/en/ons/rso-1990-c-a1/?api_key={key}
This will return:
{
"legislationId": "rso-1990-c-a1",
"url": "http://canlii.ca/t/q",
"title": "Abandoned Orchards Act",
"citation": "RSO 1990, c A.1",
"type": "STATUTE",
"language": "en",
"dateScheme": "ENTRY_INTO_FORCE",
"startDate": "1990-12-31",
"endDate": "1997-03-01",
"repealed": "YES",
"content": [
{
"partId": "1",
"partName": "Main"
}
]
}
Finally, note that as in the examples above, all calls to the API must be made using HTTPS connections. HTTP is no longer supported.
In addition, transfers larger than 10MB are not supported. In the rare cases where such payloads need to be returned by the API, you will now receive the following error:
{
"contentLength": 36771905,
"error": "TOO_LONG",
"message": "This content is larger than 10MB. Payloads larger than 10MB are not supported by this API. Please download the file in chunks by using RFC-7233 Range request headers."
}