Skip to main content

🔍 Handelsregister Python SDK

PyPI version Python Versions License: MIT

A modern Python client for the Handelsregister.ai API. Structured, reliable, and fast access to the German commercial register (Handelsregister): company master data, financials, management, shareholders, UBOs, person profiles, and official PDF documents.

✨ Features

  • 🔎 Company lookupfetch-organization with configurable feature flags
  • 👤 Person profilesfetch-person (Handelsregister roles + web data)
  • 🗂️ Search — query or filters-only search with geo, registry, size, and financial filters
  • 📊 Financial data — KPIs, balance sheet, P&L, full annual reports (MD/HTML)
  • 👥 Management — current and past related persons with roles
  • 🤝 Shareholders, UBOs, shareholdings — who owns the company, who the company owns
  • 🔀 Mergers & acquisitions — transactions, succession, enterprise agreements, and control relationships
  • ✍️ Representation schemes — current and historical company- and person-role representation rules
  • 📰 News, publications, insolvency publications
  • 🌐 Website content — structured Markdown, optimized for LLMs
  • 📄 Document downloads — Gesellschafterliste, Gesellschaftsvertrag, AD/CD PDFs, and SI XML
  • 🔐 Authx-api-key header or Bearer token, plus token management
  • 📚 Batch enrichment — resilient CSV/JSON/XLSX enrichment with snapshots
  • Live mode — opt-in realtime lookups against the Handelsregister

📦 Installation

pip install handelsregister

🔑 Authentication

You can authenticate in two ways:

API key (recommended for server-to-server):

export HANDELSREGISTER_API_KEY=your_api_key_here
from handelsregister import Handelsregister

client = Handelsregister(api_key="your_api_key_here")

Bearer token (fine-grained control, expiration):

export HANDELSREGISTER_BEARER_TOKEN=your_token_here
client = Handelsregister(bearer_token="your_token_here")

When both are provided, the bearer token wins.

🚀 Quick Start

Company lookup

from handelsregister import Handelsregister

client = Handelsregister()

result = client.fetch_organization(
    q="KONUX GmbH München",
    features=["related_persons", "financial_kpi", "shareholders"],
    ai_search="on-default",          # optional: enable AI search
    # realtime_mode="handelsregister-default",  # +10 credits for live data
)

print(result["name"], result["registration"]["register_number"])

Object-oriented Company interface

from handelsregister import Company

company = Company(
    "OroraTech GmbH München",
    features=[
        "related_persons",
        "financial_kpi",
        "balance_sheet_accounts",
        "shareholders",
        "ubos",
        "shareholdings",
        "mergers_and_acquisitions",
        "annual_financial_statements",
        "news",
    ],
)

print(company.name, company.is_active)
print(company.formatted_address)

# Management
for person in company.current_related_persons:
    print(person["name"], "-", person["role"]["en"]["long"])

# Shareholders (who owns the company)
for entry in company.shareholders.entries:
    print(entry.display_name, entry.percentage)

# Ultimate beneficial owners
for ubo in company.ubos.resolved:
    print(ubo.name, ubo.percentage)

# Outbound shareholdings (what the company owns)
for holding in company.shareholdings.current:
    print(holding.organization_name, holding.percentage)

# Company- and person-level representation rules
for rule in company.representation_scheme.active:
    print(rule)

for director in company.related_person_entries.current:
    print(director.display_name, director.role_representation_scheme.active)

# M&A transactions
for transaction in company.mergers_and_acquisitions.transactions:
    print(transaction.date, transaction.headline_text("en"))

# News
for article in company.news:
    print(article["publication_date"], article["title"])

Person profiles

The /v1/fetch-person endpoint merges Handelsregister records with public web data. ai_search is always on for this endpoint (the 15-credit base cost includes the AI enrichment). organization_q is required to disambiguate common names.

from handelsregister import Person

person = Person(
    person_q="Max Mustermann",
    organization_q="Beispielwerk Analytics GmbH",
    features=["shareholdings"],  # +5 credits, only if data is returned
)

print(person.canonical_name, "-", person.home_city)
print(person.bio)

for role in person.handelsregister_roles:
    print(role["name"], role["label"], role.get("start_date"), role.get("end_date"))

for holding in person.shareholdings.current:
    print(holding.organization_name, holding.percentage, holding.as_of)

Search

from handelsregister import Handelsregister, RangeFilter, SearchFilters

client = Handelsregister()

page = client.search_organizations(
    limit=10,
    skip=0,
    filters=SearchFilters(
        city="München",
        legal_form_code=["GmbH", "AG"],
        active=True,
        pl_revenue=RangeFilter(gte=1_000_000, lte=5_000_000),
    ),
    ai_mode="on-default",  # optional; makes the search cost 5 credits
)

print(page["total"])
for item in page["results"]:
    print(item["name"], item["registration"]["register_number"])

q may be omitted when at least one filter is supplied. filters may also be an ordinary dictionary. Supported keys cover registration dates, legal forms, WZ/NACE industries, active status, postal code/city/state, radius search, register court/type/number, company size, employee ranges, seven balance-sheet ranges, and revenue/net-income/EBIT ranges. Range dictionaries use {"gte": minimum, "lte": maximum}; either bound may be omitted. The SDK automatically translates these documented flat financial keys to the live API's nested financial_filters wire format.

📄 Document Downloads

from handelsregister import Handelsregister, Company

client = Handelsregister()

# Get the company's entity_id
result = client.fetch_organization(q="KONUX GmbH München")
entity_id = result["entity_id"]

# Download documents directly from the client
client.fetch_document(
    company_id=entity_id,
    document_type="shareholders_list",       # Gesellschafterliste
    output_file="konux_shareholders.pdf",
)

client.fetch_document(
    company_id=entity_id,
    document_type="articles_of_association", # Gesellschaftsvertrag / Satzung
    output_file="konux_articles.pdf",
)

client.fetch_document(
    company_id=entity_id,
    document_type="AD",                      # Aktueller Ausdruck
    output_file="konux_current.pdf",
)

pdf_bytes = client.fetch_document(
    company_id=entity_id,
    document_type="CD",                      # Chronologischer Ausdruck
)

xml_bytes = client.fetch_document(
    company_id=entity_id,
    document_type="SI",                      # Structured information (XML)
    output_file="konux_structured.xml",
)

# Or via the Company helper
company = Company("OroraTech GmbH München")
company.fetch_document(
    document_type="shareholders_list",
    output_file="ororatech_shareholders.pdf",
)

Available document types

Document Type Description
shareholders_list Gesellschafterliste
articles_of_association Gesellschaftsvertrag / Satzung / Statut
AD Aktuelle Daten (current excerpt)
CD Chronologische Daten (historical excerpt)
SI Strukturierter Inhalt (XML)

🔐 Bearer Token Management

If you prefer managing bearer tokens over sharing an API key:

client = Handelsregister(api_key="your_api_key_here")

# Create a new token
created = client.create_token(
    token_name="My Application",
    abilities=["*"],
    expires_at="2026-01-01 00:00:00",
)
print(created)

# List / revoke
tokens = client.list_tokens()
client.revoke_token(token_id=42)
client.revoke_all_tokens()

📊 Data Enrichment

Enrich a CSV/JSON/XLSX file of companies with Handelsregister data. Intermediate snapshots let you resume long-running jobs.

from handelsregister import Handelsregister

client = Handelsregister()

client.enrich(
    file_path="companies.csv",
    input_type="csv",
    query_properties={
        "name": "company_name",   # map 'company_name' column to query
        "location": "city",       # map 'city' column to query
    },
    snapshot_dir="snapshots",
    params={
        "features": ["related_persons", "financial_kpi", "ubos"],
        "ai_search": "on-default",
    },
    output_format="csv",
)

There is also a DataFrame convenience:

import pandas as pd
from handelsregister import Handelsregister

client = Handelsregister()
df = pd.read_csv("companies.csv")
enriched = client.enrich_dataframe(
    df,
    query_properties={"name": "company_name", "location": "city"},
    params={"features": ["financial_kpi"]},
)

🖥️ Command Line Interface

Installing the package exposes the handelsregister CLI. If the optional rich dependency is installed, commands render colorful tables.

# Company lookup (defaults: all standard features + AI search)
$ handelsregister fetch "KONUX GmbH München"

# Raw JSON
$ handelsregister fetch json "KONUX GmbH München"

# Opt-in to realtime mode for live register data
$ handelsregister fetch "KONUX GmbH München" --realtime-mode handelsregister-default

# Person profile
$ handelsregister person \
    --person "Max Mustermann" \
    --organization "Beispielwerk Analytics GmbH" \
    --feature shareholdings

# Search
$ handelsregister search "tech" --postal-code 80992 --limit 20

# Filters-only search (JSON or repeated key=value)
$ handelsregister search \
    --filters '{"city":"München","pl_revenue":{"gte":1000000}}' \
    --ai-mode on-default

# Enrich a file
$ handelsregister enrich companies.csv --input csv \
    --query-properties name=company_name location=city \
    --snapshot-dir snapshots \
    --feature related_persons --feature financial_kpi \
    --output-format csv

# Download documents
$ handelsregister document "KONUX GmbH München" \
    --type shareholders_list --output konux_shareholders.pdf

$ handelsregister document "KONUX GmbH München" \
    --type articles_of_association --output konux_articles.pdf

$ handelsregister document "KONUX GmbH München" \
    --type SI --output konux_structured.xml

📋 Available Features (fetch-organization)

Feature Flag Description
related_persons Current and past management
financial_kpi Yearly revenue, net income, employees, …
balance_sheet_accounts Hierarchical balance sheet data
profit_and_loss_account Profit & loss statements
annual_financial_statements Full annual reports as Markdown
annual_financial_statements__html Full annual reports as HTML
publications Official Handelsregister publications
insolvency_publications Insolvency court publications
news News articles about the company
website_content Company website as structured Markdown (AI mode, 0 credits)
shareholders (beta) Shareholders with capital contribution and ratio
ubos (beta) Ultimate beneficial owners (resolved / unresolved / coverage)
shareholdings (beta) Outbound shareholdings (what the company owns in others)
mergers_and_acquisitions (beta) M&A transactions, succession, agreements, and control

realtime_mode="handelsregister-default" forces a live Handelsregister lookup (+10 credits), independent of the feature flags above. It cannot be combined with related_persons or publications.

The base response includes representation_scheme. Entries in related_persons may include both organization_representation_scheme and role_representation_scheme. Historical person records can expose their last applicable rules as latest; the SDK normalizes current and latest through the .active property.

🔍 Company properties

# Basic
company.name
company.entity_id
company.status
company.is_active
company.purpose
company.representation_scheme          # RepresentationScheme

# Registration
company.registration_number
company.registration_court
company.registration_type
company.registration_date

# Contact & address
company.address
company.formatted_address
company.coordinates
company.website
company.phone_number
company.email

# Financial
company.financial_kpi
company.financial_years
company.balance_sheet_accounts
company.profit_and_loss_account
company.annual_financial_statements
company.annual_financial_statements_html
company.get_financial_kpi_for_year(2023)
company.get_balance_sheet_for_year(2023)
company.get_profit_and_loss_for_year(2023)
company.get_annual_financial_statement_for_year(2023)  # Markdown
company.get_annual_financial_statement_for_year(2023, html=True)

# People & ownership
company.current_related_persons
company.past_related_persons
company.get_related_persons_by_role("MANAGING_DIRECTOR")
company.related_person_entries         # typed persons + representation schemes
company.shareholders           # ShareholderInfo
company.ubos                   # UBOInfo
company.shareholdings          # ShareholdingsInfo
company.mergers_and_acquisitions  # MergersAndAcquisitions

# News & publications
company.publications
company.insolvency_publications
company.news
company.website_content

👤 Person properties

person.entity_id
person.name
person.canonical_name
person.given_name
person.family_name
person.maiden_name
person.previous_names
person.birth_date
person.home_city
person.home_location
person.bio
person.expertise
person.emails
person.phones
person.linkedin
person.github
person.other_profiles

person.handelsregister_roles
person.current_handelsregister_roles
person.get_handelsregister_roles_by_label("MANAGING_DIRECTOR")
person.affiliations

person.shareholdings           # PersonShareholdings (requires feature flag)

Error handling

All API exceptions inherit from HandelsregisterError. Documented HTTP responses are mapped to RequestValidationError (HTTP 400/422), AuthenticationError, InsufficientCreditsError, ForbiddenError / SubscriptionRequiredError, NotFoundError, RateLimitError, and RequestTimeoutError / ServerError. API exceptions preserve status_code, the raw JSON payload, and billing metadata through .meta.

Only network failures, HTTP 408/429, and server errors are retried. When supplied, the API's Retry-After header controls the delay.

📜 License

MIT — see LICENSE.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

handelsregister-0.5.0.tar.gz (56.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

handelsregister-0.5.0-py3-none-any.whl (39.3 kB view details)

Uploaded Python 3

File details

Details for the file handelsregister-0.5.0.tar.gz.

File metadata

  • Download URL: handelsregister-0.5.0.tar.gz
  • Upload date:
  • Size: 56.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for handelsregister-0.5.0.tar.gz
Algorithm Hash digest
SHA256 1ba46f71c9b7f79b92e46881e94db71dc0bf786976d116928b059314138e02d8
MD5 808e172c13650e0a37a137fb3fd7d5d4
BLAKE2b-256 78e3b490739bfd012c8bcc2fd3638f8e0099bc453536c907d524a16fd72756d5

See more details on using hashes here.

Provenance

The following attestation bundles were made for handelsregister-0.5.0.tar.gz:

Publisher: publish.yml on Handelsregister-AI/handelsregister

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file handelsregister-0.5.0-py3-none-any.whl.

File metadata

  • Download URL: handelsregister-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 39.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for handelsregister-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f7c5803a08426421a6cbd0de0e232f6bb8d068fb2bd005a371ec631bd7e60d9b
MD5 da1acfdf5177fb4e935e48fd3bab9597
BLAKE2b-256 42f77c6575a6e1b2b2b6c6e9ea83d0b2e74408e3f830342232ab8508c327d0dd

See more details on using hashes here.

Provenance

The following attestation bundles were made for handelsregister-0.5.0-py3-none-any.whl:

Publisher: publish.yml on Handelsregister-AI/handelsregister

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

0.8.0

2 files

0.7.1

2 files

0.5.1

2 files

This release

0.5.0 This release

2 files

0.4.0

2 files

0.3.0

2 files

0.2.0

2 files

0.1.0

2 files

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