Enrich customer data

Add company data to your customer list.

1

Match companies

curl -G "https://handelsregister.ai/api/v1/fetch-organization" \
  -H "x-api-key: YOUR_API_KEY" \
  --data-urlencode 'q=Hetzner Online GmbH Gunzenhausen'
1{2  "entity_id": "94eb910fef13f94585c48c263fa446d4",3  "name": "Hetzner Online GmbH",4  "status": "ACTIVE",5  "registration": {6    "court": "Ansbach",7    "register_type": "HRB",8    "register_number": "6089"9  },10  "address": {11    "house_number": "25",12    "street": "Industriestraße",13    "postal_code": "91710",14    "city": "Gunzenhausen",15    "county": "Weißenburg-Gunzenhausen",16    "state": "Bayern",17    "country": "DEU",18    "coordinates": {19      "latitude": 49.12483,20      "longitude": 10.7805221    }22  },23  "meta": {24    "request_credit_cost": 5,25    "credits_remaining": 14526  }27}
200 · Example response: match for name and city (excerpt)
If the API finds no company, you get HTTP 404. Without AI Mode, this costs nothing. Flag the customer for review. Use AI Mode (ai_search=on-default) selectively for fuzzy entries; it costs an extra 20 credits, even without a match.
2

Fetch many companies

Python script
import csv
import time

import requests

API = "https://handelsregister.ai/api/v1/fetch-organization"
HEADERS = {"x-api-key": "YOUR_API_KEY", "Accept": "application/json"}
PER_MINUTE = 60  # limit of fetch-organization


def lookup(row):
    # Register court plus register number is unique; otherwise name and city
    q = row["register"] or f'{row["name"]} {row["city"]}'
    headers = {**HEADERS, "Idempotency-Key": f'customer-{row["id"]}'}
    for attempt in range(5):
        response = requests.get(API, params={"q": q}, headers=headers, timeout=120)
        if response.status_code == 429:
            time.sleep(int(response.headers.get("Retry-After", "10")))
        elif response.status_code in (408, 500, 502, 503, 504):
            time.sleep(30 * (attempt + 1))
        else:
            break
    return response


spent = 0
with open("customers.csv", newline="") as source, open("customers_enriched.csv", "w", newline="") as target:
    reader = csv.DictReader(source)
    writer = csv.DictWriter(target, fieldnames=reader.fieldnames + ["entity_id", "register_court", "register_number"])
    writer.writeheader()
    for row in reader:
        response = lookup(row)
        if response.status_code == 402:
            print("Not enough credits, run stopped")
            break
        data = response.json()
        spent += data.get("meta", {}).get("request_credit_cost", 0)
        if response.status_code == 200:
            registration = data.get("registration") or {}
            row["entity_id"] = data["entity_id"]
            row["register_court"] = registration.get("court")
            row["register_number"] = f'{registration.get("register_type")} {registration.get("register_number")}'
        writer.writerow(row)
        time.sleep(60 / PER_MINUTE)

print(f"Used: {spent} credits")
1{2  "entity_id": "94eb910fef13f94585c48c263fa446d4",3  "name": "Hetzner Online GmbH",4  "meta": {5    "request_credit_cost": 0,6    "credits_remaining": 1457  }8}
200 · Example response: repeated request with the same Idempotency-Key (excerpt)
The Python SDK comes with enrich, a ready-made enrichment for CSV, JSON and Excel files.
3

Keep an eye on costs

Costs and limits
What Credits
Company profile with the basic data 5
Each feature, only when it returns data 1 to 80
AI Mode, even without a match +20
Realtime, for every successful live fetch +10

Limit: 60 requests per minute. What a request actually cost is in every response under meta.request_credit_cost.

Common pitfalls

Next