Skip to main content

Kaiwhakawhanake API
Developer API

Use our New Zealand Legislation API to access legislative data

Our application programming interface (API) allows developers to query legislation records and receive a response containing structured data describing the records. It provides links to HTML, PDF, and XML versions for each piece of legislation.

The API’s current functionality is equivalent to the search function on this website.

For more information on how to use XML documents available through the API, see the page on XML data.

API design

The conceptual design of our API is a three-tier hierarchy, inspired by the FRBR model:

  • Work: At the highest level are works, for example, a specific Act or Bill.

  • Version: Each work has one or more versions, for example, an Act as at a specific date, or the second reading version of a Bill.

  • Format: Each version has multiple formats, for example, the XML source file, a PDF file, the HTML page on the website. Different types of legislation will have different formats available, such as agency-drafted secondary legislation.

The domain for the API is https://api.legislation.govt.nz, and has three endpoints:

  • /v0/works: search for works

  • /v0/works/{work_id}/versions: get all versions of a work

  • /v0/versions/{version_id}: get a specific version

Format variations are retrieved by adding a format extension to the end of the legislation you are viewing. For example, to view the PDF file for the New Zealand Bill of Rights Act 1990, change the URL from https://legislation.govt.nz/act/public/1990/109/en/latest/ to https://legislation.govt.nz/act/public/1990/109/en/latest.pdf

API documentation

Read the full API documentation

How to access the API

You need an API key to use our API. To request an API key, please email contact@pco.govt.nz.

Terms of use

To use our API, you must agree to the terms of use.

Future development and support

Our first API release, a version 0 beta, is available now for developers to test and provide us with feedback. We hope it is already useful, but there’s a lot more we plan to develop in the future.

Feedback from your real-world use of version 0 will directly shape version 1. Options for version 1 include:

  • refining the metadata model of the records returned

  • improving the query parameters used, and

  • possibly adding more powerful querying options.

We’d love any feedback or thoughts you have after using our API: good or bad, big or small. To provide feedback on the API or to ask for support, email us at contact@pco.govt.nz.

Continued use of classic site web feeds

As the old legislation website did not include a developer API, many developers used its web feeds as a ‘de facto API’. We encourage developers to migrate to the website’s new API, and would like to hear from anyone who finds the new API does not meet their needs. See Use of classic site web feeds as de facto API for more information.

RSS feed link copied, you can now paste this link into your feed reader.