SDKs
Three official clients, same contract. Pick one, install, set
LEGALIZE_API_KEY in your environment, and
Legalize() just works — no constructor arguments.
Python
PyPI package legalize. Supports Python 3.10 through
3.13. Sync and async clients share the same resource API. Models
are Pydantic v2 generated from the OpenAPI spec.
Two client classes: Legalize (sync, wraps
httpx.Client) and AsyncLegalize (async,
wraps httpx.AsyncClient). Resource namespaces —
client.laws, client.webhooks, etc. —
look identical on both.
- Source: github.com/legalize-dev/legalize-sdks/python
- Registry: pypi.org/project/legalize
- Changelog: CHANGELOG.md
Node / TypeScript
npm package @legalize-dev/sdk. Requires Node 20+.
Zero runtime dependencies — uses built-in fetch,
AbortController, and crypto. Ships dual
ESM + CJS bundles with .d.ts files.
Promise-based client. Iterators are AsyncIterableIterator
so for await (const law of client.laws.iter(...))
just works. Tree-shaking friendly (named exports only,
sideEffects: false).
- Source: github.com/legalize-dev/legalize-sdks/node
- Registry: npmjs.com/package/@legalize-dev/sdk
- Changelog: CHANGELOG.md
Go
Module github.com/legalize-dev/legalize-sdks/go.
Requires Go 1.22+. Stdlib-only (net/http,
crypto/hmac, crypto/subtle). Every I/O
method takes context.Context as the first argument;
options are functional.
Typed errors implement a sealed legalize.Error
interface; check them with errors.As. Iterators use
the pull pattern iter.Next(ctx) (T, bool, error) —
no leaked goroutines on early exit.
- Source: github.com/legalize-dev/legalize-sdks/go
- Registry: pkg.go.dev
- Changelog: CHANGELOG.md
Contract parity
All three SDKs implement the same cross-language PARITY.md spec: operation list, error tree, retry semantics, webhook scheme, and the environment-variable contract. A change to any one of them requires the same change across the other two, guarded by parallel parity tests in each language's test suite.