Legalize API

A REST API that turns legislation into structured, versioned data. Every law is clean Markdown with typed metadata. Every reform is a git commit you can travel back to. One Bearer token, one schema, multiple countries.

What you get

The API exposes four primary objects:

  • Laws — full text plus metadata (jurisdiction, type, status, dates). Searchable and paginated.
  • Reforms — every amendment to a law, with its own ID, date, and diff.
  • Commits — the git-style history of each law. You can fetch the exact text of any law at any past revision.
  • Webhooks — signed, retried HTTP deliveries the moment a law is created, updated or repealed.

How most readers land here

  1. Get an API key (free, no card, 5,000 calls/month for early adopters).
  2. Set it in your environment: export LEGALIZE_API_KEY=leg_….
  3. Install the SDK for your language — see Quickstart.
  4. Legalize() with no args, and you're done.
Three shapes of docs. You're reading the narrative guide. For runnable endpoint-by-endpoint reference, see the interactive API reference. For language-specific idiomatic examples, see the SDKs page and the README on each registry (PyPI, npm, pkg.go.dev).

Design principles

  • Typed end-to-end. Pydantic for Python, TypeScript .d.ts for Node, structs for Go — all generated from the same OpenAPI spec.
  • Zero-config when deployed. Kubernetes, Lambda, systemd — set LEGALIZE_API_KEY and the SDK picks it up.
  • Retries + backoff built in. Exponential jittered backoff, honors Retry-After in both RFC forms, never auto-retries POST/PATCH.
  • Webhook verification is a one-liner with constant-time HMAC and a five-minute replay window.