
An API gives one computer program an agreed way to ask another for information or an action.
The letters stand for application programming interface. Think of the forms a service agrees to accept: which requests you can make, which details you must supply and how it will return the result.
For a legislation graph, APIs can connect the official source to your collection and connect your collection to the tools people use. Each connection has a different job.
Information coming in
The Parliamentary Counsel Office provides an API for discovering legislation. Its published structure is work → version → format. A work identifies the legislation. A version identifies a particular edition. A format is its HTML, PDF or XML representation.
Your importer requests those records, follows a returned file link and saves the source. It can then extract sections and create graph records. The API provides access to the material; your system supplies the organisation and review.
Source: PCO developer API guide, read on the official site on 18 November 2026. The API requires a key. Its guide describes the current service as version 0 beta.
Information going out
A separate research API can expose your graph to a website, a search tool or an AI assistant. A request might say: “Give me section 9 and the provisions connected to it.” The response can contain the section records, the relationships, their evidence and the limits of the collection.
Responses often use JSON, a text format with named fields that programs can read. The visible map and a written explanation can both be built from that same response.
Official source
Your server asks PCO for a legislation record, discovers the available versions and gets the link to a source file. An API key identifies the service making the request. The key stays on the server.
PCO supplies source records and file links. Your system must still interpret the file’s structure.
Ask for connected context
Choose a starting section. The sample below returns its saved neighbourhood, one connection away.
GET /research/context?seed=fta%3As9&depth=1Coverage: selected sample. Legal applicability: not established.
This demonstration runs locally in your browser on the supplied sample. The request is an example API design. It does not call PCO or a live research service.
The role of the AI assistant
When someone asks a question, an assistant can call the research API as a tool. The retrieval service finds a starting provision and gathers its recorded context. The assistant then writes from the returned evidence bundle, carrying the source links into its answer.
The service should return an explicit gap when a requested date or source is outside its coverage. The model needs that information to explain what remains unresolved. The sample in this guide has no historical applicability service.
Operating the connection
AccessKeep permissions with the service.
An API key identifies an authorised caller. Keep it on the server and out of the browser. A private knowledge collection also needs to check the user’s access to every record and relationship it returns.
Permission to read a collection should be separate from permission to add or change it.
UpdatesCheck new sources before they replace a reviewed record.
A scheduled process can use the source API to discover changes. Save new source files, compare versions and flag affected relationships for review. Keep the previous record available until the replacement passes the checks.
Record the date fetched separately from the date the legislation takes effect. A successful download establishes neither commencement nor applicability.
FailuresReturn a clear status when information is unavailable.
Allow for unavailable services, request limits, incomplete files and changed formats. Keep a record of the last successful update. Reject empty downloads and make stale or missing coverage visible to the reader.
The supplied prototype includes an API discovery client. Authenticated access and full official XML ingestion still need validation before it could support a maintained service.
Put it on a schedule
Once these connections work, a background job can repeat source discovery, process changed files and prepare an updated collection. Hosted software can make that collection available through a search page or a tool used by an assistant.
Follow the API-key walkthrough for a concrete PCO request, a downloadable source-capture starter and the steps for hosting and maintaining the system.
For implementation: PCO API documentation and the PCO XML data guide.