Skip to main content

AI Law Tracker — Python SDK

PyPI Python License: MIT

Official Python client for the AI Law Tracker API — the audited dataset of AI regulation across US state + federal, the EU, and global jurisdictions. Laws, news, changelogs, obligations, penalties, compliance assessment, deadlines, and webhooks.

pip install ai-law-tracker

Quick start (3 lines)

from ai_law_tracker import Client

alt = Client()                          # anonymous tier; no key required
laws = alt.laws.list(scope="federal")   # -> a Page of records
for law in laws:
    print(law["identifier"], "—", law["title"])

Authentication

The API has a free anonymous tier (rate-limited by IP). For higher limits, richer fields, and the changelog/webhook endpoints, use a free API key (no card required):

from ai_law_tracker import Client

# 1) Issue a free key by email (anonymous call is fine)
Client().account.create_key("you@example.com")   # emails you a key

# 2) Use it — explicitly, or via the ALT_API_KEY env var
alt = Client(api_key="alt_live_...")
print(alt.account.get())   # your tier, limits, and live usage

Set ALT_API_KEY in your environment and Client() picks it up automatically. Paid tiers ($29 / $99 / $299 a month) raise quotas and unlock Pro-only endpoints — see https://ai-law-tracker.com/pricing.

Pagination

List endpoints return a Page you can iterate, index, and len(), plus .total, .limit, .offset, and .has_more:

page = alt.laws.list(scope="state", jurisdiction="colorado", limit=50)
print(page.total, "records match;", len(page), "on this page")

To sweep every matching record without managing offsets yourself, use .iterate(...) — it pages transparently and yields one record at a time:

for law in alt.laws.iterate(scope="eu", in_force=True):
    ...

for hit in alt.search.iterate("facial recognition", scope="state"):
    ...

Endpoints

Grouped as resources on the client:

Resource Methods
alt.laws list, iterate, get(id), history(id), sources(id), citations(id)
alt.search query(q, ...), iterate(q, ...)
alt.news list, iterate
alt.changes list, iterate (poll since= for what changed)
alt.feed list (lean recent-changes stream)
alt.jurisdictions list, countries, states
alt.sectors list, get(sector)
alt.compliance obligations, penalties, assess, report
alt.deadlines list (JSON or iCal via format="ical")
alt.bills list, get(slug)
alt.webhooks list, get(id), create, delete (Pro+)
alt.account get, revoke, create_key(email), create_token(email)
top level alt.health(), alt.accuracy(), alt.categories(), alt.openapi()

Examples:

# Poll the changelog for everything that moved since a timestamp
changes = alt.changes.list(since="2026-07-01T00:00:00Z", scope="federal")

# Compliance obligations for a sector + jurisdiction
obs = alt.compliance.obligations(jurisdiction="colorado", sector="hr")

# Risk assessment from a company profile
result = alt.compliance.assess(state="CA", sector="hr", aiUse="resume_screening")

# Upcoming compliance deadlines as an iCal feed (text/calendar)
ics = alt.deadlines.list(scope="eu", format="ical")

Error handling

Every non-2xx response raises a typed exception carrying .status, .code, .message, and .docs:

from ai_law_tracker import NotFoundError, RateLimitError, AuthenticationError

try:
    alt.laws.get("does-not-exist")
except NotFoundError as e:
    print(e.code, e.message)
except RateLimitError as e:
    print("retry after", e.retry_after, "seconds")

All inherit from ALTError. Transient failures (timeouts, 5xx, 429) on GET/DELETE are retried automatically with exponential backoff (configurable via Client(max_retries=...)).

Configuration

Client(
    api_key=None,        # or set ALT_API_KEY
    base_url="https://ai-law-tracker.com/api/v1",
    timeout=30.0,        # seconds
    max_retries=2,       # transient GET/DELETE retries
)

Client is a context manager (with Client() as alt: ...) and has .close() to release the connection pool.

Responsible use

This SDK is designed to be a well-behaved API citizen and does not provide any way to bypass the server's tier gating or rate limits:

  • Requests are sequential with a single connection — no parallel fan-out or concurrent request flooding.
  • Retries are conservative: a small default (max_retries=2), exponential backoff with jitter, and only on idempotent GET/DELETE. Writes/POSTs are never retried automatically.
  • 429 responses and their Retry-After header are respected; a persisted rate limit surfaces as a RateLimitError (with .retry_after) rather than being retried away.
  • iterate(...) pages one page at a time, in order, through the same rate-limited transport. It is a convenience for legitimate paging, not a bulk scraper — please honour your tier's quotas.

If you need high-volume or bulk access, use an appropriate paid tier or contact hello@ai-law-tracker.com rather than working around the limits.

License

MIT (SDK code). API data is CC BY 4.0 — attribution required, informational only, not legal advice.

Metadata

Release files for ai-law-tracker 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ai-law-tracker 0.1.0
File Size Uploaded Provenance
ai_law_tracker-0.1.0.tar.gz 12.8 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for ai-law-tracker 0.1.0
File Interpreter ABI Platform
ai_law_tracker-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 28.0 kB

Release files / ai_law_tracker-0.1.0.tar.gz

Download URL ai_law_tracker-0.1.0.tar.gz
Size 12.8 kB
Tags Source
SHA-256 checksum
How to use checksums
72c4d3c5ae154837ce0d3ce8f17ab90a787988609caf875101f0ef1af4611491
BLAKE2b-256 checksum
How to use checksums
50b1b2c2de9742acaef5e743e70c36068b1144e9ead99594a5e58a5bc0516851
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.15

Release files / ai_law_tracker-0.1.0-py3-none-any.whl

Download URL ai_law_tracker-0.1.0-py3-none-any.whl
Size 15.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
54c62601d7e5e98300a47bc29c3a1b6bfd4de22b7d6318281862e12f01895273
BLAKE2b-256 checksum
How to use checksums
99117a03d9cbdbfb45eaf9174758d768f0c48d13adab3a1a1381f1d80777bac2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.15

Security for ai-law-tracker 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page