Comment on page
This describes the Laws.Africa Content API. The latest version of the API is version 2.
This guide is for developers who want to use the Laws.Africa Content API to fetch legislative content and metadata from Laws.Africa. We assume that you have a basic understanding of REST APIs and the Akoma Ntoso standard for legislation (acts in particular).
The API is a read-only API for listing and fetching published versions of legislative works. Using it, you can:
- get a list of countries and localities
- get a list of all works by country and year
- get a JSON description of a work
- get Akoma Ntoso XML for a work
- get a human-friendly HTML version of a work
When we use a URL such as
/v2/frbr-uri/in this guide, the
frbr-uripart is a full FRBR URI, such as
The latest version of the API is version 2. It is available at the endpoint:
Calls to the API must be authenticated using your API token. To get a token,
Include your API token in your API calls by including an
Authorization: Token YOUR_AUTH_TOKEN
API calls that return lists will be paginated and return a limited number of items per page. The response includes information on the total number of items and the URLs to use to fetch the next and previous pages of items.
Here's an example of the first page of a paginated response with 250 total items and two pages:
"results": [ "..." ]
In this case, fetching the
nextURL will return the second (and final) page.
Some API calls can return content in multiple formats. You can specify the required content of your request by placing
.formatat the end of the URL. In most cases the default response type is JSON.
Accept: application/json: return JSON
Accept: application/xml: return Akoma Ntoso XML
Accept: text/html: return human friendly HTML
Accept: application/epub+zip: return an ePUB (ebook) document
Accept: application/pdf: return a PDF document
Accept: application/zip: return a ZIP file with the document XML and media attachments
Not all responses support all formats, the documentation will be explicit about what is supported.
Laws.Africa transforms Akoma Ntoso XML into HTML5 content that looks best when styled with Indigo Web stylesheets. You can link to the stylesheets provided by that package, or you can pull them into your website.