Skip to content

Repository files navigation

apier-no

Official Python client for Apier — Norwegian compliance infrastructure API.

  • Zero runtime dependencies. Pure Python stdlib (urllib, ssl, json).
  • HTTPS-only, with defence-in-depth against open redirects.
  • Typed (py.typed), mypy --strict clean.
  • Python 3.11+.

Install

pip install apier-no

Quickstart

fromapierimportClient, ApierError# Zero-auth — works against every Category-A endpoint# (/api/v1/tools/*, /api/v1/public/*, /api/v1/capabilities).client=Client()
data=client.get("/api/v1/tools/altinn-migration")
print(data["data"]["mappings"][0])

For Category-B endpoints (company data, accounting filings, etc.) pass an API key:

client=Client(api_key="apier_test_...") # explicitclient=Client() # or APIER_API_KEY env

Errors normalise to a structured ApierError:

try:
client.get("/api/v1/company/999999999/context")
exceptApierErrorase:
print(e.error_code) # e.g. "VALIDATION_FAILED"print(e.explanation) # short summaryprint(e.raw_explanation) # full {summary, why, fix_steps, legal_basis}print(e.status) # HTTP status (None on network errors)

Configuration

ArgumentDefaultNotes
api_keyAPIER_API_KEY env or NoneEmpty string treated as no key.
base_urlhttps://www.apier.noMust be https://. Non-https raises ValueError.
timeout30.0 (seconds)Per-call override: client.get(path, timeout=2.5).

Security posture

This library is intentionally conservative:

  • HTTPS only. Non-https base_url is rejected at construction time. Non-https redirects are refused by the client's redirect handler.
  • The system default SSL context (ssl.create_default_context()) is used unmodified. The library does not expose, accept, or expose a way to disable certificate verification or pass a custom CA bundle.
  • The API key never appears in repr(), str(), exception text, or any other surface the library emits. The repr masks it as ***.
  • Errors never leak raw response bodies, headers, or request URLs.

For the full threat model and disclosure process see SECURITY.md.

Discovery

The Apier discovery surface points at this package:

  • https://www.apier.no/llms.txt
  • https://www.apier.no/llms-full.txt
  • https://www.apier.no/docs/sdks

Versioning + releases

License

MIT — see LICENSE.

About

Official Python client for Apier — the Norwegian compliance API for AI agents and accounting software (Altinn, Brønnøysund, Skatteetaten).

Topics

Resources

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages