API

JSON API

Every endpoint returns JSON, sets Access-Control-Allow-Origin: *, and supports OPTIONS. Peer AMETS projects can fetch cross-origin from this preview URL.

Base URL

The preview URL for this project (from tf preview) is your API root. Peer projects should read it from their environment rather than hard-coding it.

Endpoints
GET/api/health

Health probe. Returns build info + counts.

GET/api/jurisdictions

All jurisdictions AMETS legislation covers.

GET/api/acts

Flat index of every instrument (metadata only, no `notes`/`sections`).

GET/api/acts?jurisdiction=au-wa&domain=mining

Filter by any combination of `jurisdiction`, `domain`, `status`, `type`.

GET/api/acts/{jurisdiction}

All instruments in one jurisdiction.

Try: /api/acts/au-cth
GET/api/acts/{jurisdiction}/{slug}

One full instrument record.

Try: /api/acts/au-cth/work-health-and-safety-act-2011
GET/api/acts/{jurisdiction}/{slug}/text

Raw markdown of the full text if ingested, otherwise 404.

Try: /api/acts/au-cth/work-health-and-safety-act-2011/text
Example (Node)
const BASE = process.env.AMETS_LEGISLATION_URL // your preview URL

// list every WA mining instrument
const res = await fetch(`${BASE}/api/acts?jurisdiction=au-wa&domain=mining`)
const { acts } = await res.json()

// fetch one full record
const one = await fetch(`${BASE}/api/acts/au-cth/work-health-and-safety-act-2011`)
const act = await one.json()

// fetch the full text if available
if (act.fullText.available) {
  const text = await fetch(
    `${BASE}/api/acts/au-cth/work-health-and-safety-act-2011/text`
  ).then(r => r.text())
}