Quickstart
Install the SDK for your language, export your API key, and make your first call. Under a minute.
1. Get an API key
Sign up at legalize.dev/dashboard. Keys
start with leg_. Free tier: 5,000 calls/month for
early adopters, no credit card.
2. Install the SDK
$ pip install legalize
$ npm install @legalize-dev/sdk
$ go get github.com/legalize-dev/legalize-sdks/go
3. Export your key
bash
export LEGALIZE_API_KEY=leg_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Every official SDK reads this variable at construction. No
apiKey argument needed in deployed environments.
More on authentication.
4. Your first call
from legalize import Legalize
client = Legalize()
# First page of Spanish laws
page = client.laws.list("es", per_page=5)
for law in page.results:
print(law.id, law.title)
import { Legalize } from "@legalize-dev/sdk";
const client = new Legalize();
// First page of Spanish laws
const page = await client.laws.list("es", { perPage: 5 });
for (const law of page.results) {
console.log(law.id, law.title);
}
import (
"context"
legalize "github.com/legalize-dev/legalize-sdks/go"
)
client, _ := legalize.New()
defer client.Close()
page, _ := client.Laws().List(ctx, "es", &legalize.LawsListOptions{
PerPage: legalize.Int(5),
})
for _, law := range page.Results {
fmt.Println(law.ID, law.Title)
}
Where to go next
- Paginate through large result sets lazily.
- React to law changes via webhooks.
- Fetch the text of any law at any past revision with time-travel.