GetAPI voor Python
Officiële client voor GetAPI.nl: Nederlandse bedrijfs-, adres-, pand- en controlegegevens via één API-key. KVK, BAG, BTW (VIES), WOZ, energielabel, RDW en meer.
GetAPI verzamelt en publiceert de data zelf, onder een eigen domein, API en account. Eén key is genoeg.
- Synchroon (
GetApi) en asynchroon (AsyncGetApi) - Volledig getypeerd (
py.typed,mypy --strict), Python 3.8 of hoger - Eén afhankelijkheid: httpx
Installeren
pip install getapi
Gebruiken
import os
from getapi import GetApi
getapi = GetApi(os.environ["GETAPI_KEY"])
bedrijf = getapi.kvk.get("53743792")
print(bedrijf.data["naam"])
print(bedrijf.credits_remaining) # alleen gevuld als de API X-Credits-Remaining meestuurt
Elke aanroep geeft een Response met data, status_code, credits_remaining en headers. response["naam"] is een afkorting voor response.data["naam"].
# Bedrijf zoeken op naam
getapi.kvk.search(naam="bol", size=10)
# Adres opzoeken. Splits het adres in losse delen:
# "Hooidrift 161C-03" wordt huisnummer 161, letter C en toevoeging 03.
getapi.address.lookup("3023KN", 161, house_letter="C", house_number_addition="03")
# BTW-nummer controleren: een ongeldig nummer geeft valid=False, geen fout.
getapi.validation.vat("NL820646660B01")
# WOZ-waarde en energielabel
getapi.property.woz_value("3023KN", 161)
getapi.property.energy_label("3023KN", 161)
# WOZ-waarde via BAG-id in plaats van adres
getapi.property.woz_value(bag_id="0363200000218908")
# Kenteken
getapi.vehicle.get("AB-123-C")
# KVK-gegevens met coördinaten en BAG-id's van het adres
getapi.kvk.get("53743792", geo=True)
# E-mailadressen uit een webpagina halen
getapi.scraping.email("https://example.nl/contact")
Asynchroon
Dezelfde methodes, met await:
import asyncio
from getapi import AsyncGetApi
async def main():
async with AsyncGetApi("ga_live_...") as getapi:
bedrijf = await getapi.kvk.get("53743792")
print(bedrijf["naam"])
asyncio.run(main())
Overzicht
| Resource | Methodes |
|---|---|
kvk |
search, get, validate |
address |
lookup, suggest, by_id, postcode |
property |
woz_value, energy_label, details, details_lite |
validation |
vat, iban, email, email_batch, disposable_email, dnsbl |
lookup |
ip, dns_nameservers, dns_records |
vehicle |
get |
sbi |
index, search, get |
dso |
documents, plans |
ndw |
charge_points, charge_point, emission_zones, emission_zone, truck_parking, truck_parking_site |
scraping |
email |
De volledige API-documentatie staat op getapi.nl/docs.
Opties
GetApi(
"ga_live_...",
base_url="https://api.getapi.nl", # standaard, moet https zijn
timeout=15.0, # seconden, standaard
client_name="mijn-app/2.1", # optioneel, voor herkenning in je logs
http_client=httpx.Client(...), # optioneel, voor proxy of tests
)
Geef je zelf een http_client mee, dan gelden zijn time-out en instellingen en sluit jij hem ook zelf.
Alle GET-aanroepen accepteren idempotency_key=. Dezelfde key binnen 10 minuten geeft hetzelfde antwoord en rekent hooguit één keer af. Handig als je een aanroep opnieuw doet na een time-out:
getapi.property.woz_value("3023KN", 161, idempotency_key="order-4711")
Fouten afhandelen
Alle fouten erven van GetApiError.
| Klasse | Wanneer |
|---|---|
AuthError |
401 of 403: key ontbreekt of is ongeldig |
CreditsExhaustedError |
402: credits op, met topup_url |
NotFoundError |
404: bijvoorbeeld een onbekend KVK-nummer |
ValidationError |
422: ongeldige invoer, met errors per veld |
RateLimitError |
429: te veel verzoeken, met retry_after (seconden) |
UpstreamUnavailableError |
503: een bron achter de API is tijdelijk niet beschikbaar |
ConnectionError |
netwerkfout of time-out |
InvalidArgumentError |
ongeldige invoer, gemeld voordat er iets is verstuurd |
from getapi import NotFoundError, CreditsExhaustedError
try:
getapi.kvk.get("00000000")
except NotFoundError:
... # onbekend KVK-nummer
except CreditsExhaustedError as e:
print(e.topup_url)
Let op: getapi.ConnectionError is een eigen klasse en vervangt dus niet de ingebouwde ConnectionError. Importeer hem met een alias als je beide gebruikt.
Ontwikkelen
pip install -e ".[dev]"
pytest # tests, inclusief controle tegen tests/openapi.json, vereist 100% dekking
ruff check . # lint
ruff format . # opmaak
mypy # typecontrole (strict)
tests/openapi.json is een momentopname van getapi.nl/openapi.json. Vernieuw hem met
curl -o tests/openapi.json https://getapi.nl/openapi.json; een nieuw endpoint laat de contracttest dan falen tot de SDK het ondersteunt.
Totstandkoming
Deze package is met behulp van AI geschreven en voor zover mogelijk door GetApi.nl beoordeeld. De code wordt gecontroleerd door een testsuite met 100% dekking, door een contracttest tegen de OpenAPI-spec en door ruff en mypy --strict. Zie je iets dat niet klopt? Open een issue.
Over GetAPI
GetAPI is een label van WD Noord.
Licentie
Metadata
Release files for getapi 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| getapi-1.0.0.tar.gz | 47.5 kB | With provenance | Details for getapi-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| getapi-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for getapi-1.0.0-py3-none-any.whl |
Total release size: 64.4 kB
Release files / getapi-1.0.0.tar.gz
| Download URL | getapi-1.0.0.tar.gz |
|---|---|
| Size | 47.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b7e2524d7cd85e51c01e5b40a6e8ab6098a9b3b0502db2ecb916593ddcb0affb
|
|
BLAKE2b-256 checksum How to use checksums |
e6c417368039ff45e5398b421d58339d0fc4d52f73ea26bc285f8002aada7292
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 26, 2026.
Transparency logRelease files / getapi-1.0.0-py3-none-any.whl
| Download URL | getapi-1.0.0-py3-none-any.whl |
|---|---|
| Size | 17.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d233fa0f442253c58c0cf5dd5a5d530034a84ec462768fe2a9e2426ead83307c
|
|
BLAKE2b-256 checksum How to use checksums |
fed45a9f4e1ef5f9569aadb3504cafdc0f6ed49e397c0d8db5eec0258e0fcbab
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 26, 2026.
Transparency logSecurity for getapi 1.0.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.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for getapi-1.0.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 26, 2026.
Transparency logA 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.