Info API, MCP and the Reader

API, MCP and the Reader

Programmatic access, assistant tools, and private document linking.

The reading site is the main product, but the same query layer is available to programs and assistants. All of these surfaces are read-only except the Reader, which stores your own documents privately.

JSON API

The read-only API lives under /api/v1. It exposes jurisdictions and instruments, instrument tables of contents, provisions, references and cited-by lists, cases and their paragraphs/citations, search, citation resolution and a document linker. The interactive reference is at /api/v1/docs, with the OpenAPI document at /api/v1/openapi.json.

  • Responses carry ETags and support If-None-Match; case-dependent resources revalidate.
  • Errors use the envelope {"error": {"code", "message"}}, scoped to /api/v1.
  • Licence metadata travels with the payloads; each corpus keeps its own terms.
  • Bearer tokens (hlk_…) are optional today. They raise the rate limit and carry a daily quota; anonymous requests are limited when the operator enables it.
  • POST /api/v1/link takes text or units and returns linked spans; it is the same linker the Reader uses.

MCP server

Assistants can connect to the streamable HTTP MCP endpoint at /mcp. It exposes nine read-only tools: search_law, resolve_citation, get_provision, get_case, get_case_text, get_case_paragraph, get_case_citations, get_cited_by and link_document. get_case returns a judgment's metadata and outline; get_case_text pages through the whole text; get_case_paragraph reads a pinpointed paragraph; each paragraph carries its citation links (surface, target, pinpoint and canonical URL). Outputs are bounded and carry licence metadata. A stdio build is available for local clients with python -m canlaw.mcp.

The Reader

/reader is an account-gated workspace for your own documents. Sign in, upload a Markdown, text, HTML, PDF or DOCX file (25 MB per file; 100 documents and 250 MB per account), and the worker extracts the text and links its citations against the corpus. The reading view renders the resolved links, keeps unresolved spans plain, and lets you update the subject Act and re-link.

You can export a linked document as Markdown from the reading view. Reader documents are private: they are noindex, never enter the shared render cache, and are stored under your account. The beta is free and metered.

Accounts

Accounts are optional for reading. Registration is open, sign-in uses a session cookie, and the first account on a new installation becomes the administrator. Roles gate the private citation editor; ordinary accounts can use the Reader and manage API tokens.