Skip to main content

normatia

Python client for the Normatia API: Spanish parcels with their constraints and planning, municipalities with their technical data, and regulations as data, article by article.

pip install normatia
from normatia import Normatia

client = Normatia()  # reads NORMATIA_API_KEY

parcel = client.get_parcel("6963301TG3466N", include=["constraints", "zoning"])
for layer in parcel["constraints"]["layers"]:
    if layer["affected"]:  # None is "no data", never "not affected"
        print(layer["layer"], layer["summary"])

place = client.get_place("ES-41091")
print(place["technical_data"]["climate_zone"])  # {'value': 'B4', 'source': {'citation': 'CTE DB-HE, Anejo B', ...}}

for regulation in client.iter_regulations(place="ES-41091", scope="municipal"):
    print(regulation["slug"], regulation["current_version"]["curated"])

Async, with the same methods:

from normatia import AsyncNormatia

async with AsyncNormatia() as client:
    me = await client.get_me()

Credits

Calls are paid with the credits of the key's organization, and only the calls that succeed are charged: ask costs 5 (nothing if it fails), get_parcel with constraints or zoning 1 (0.1 without them), and every other data method 0.1 (find_parcels_at_point, find_parcels_by_address, suggest_addresses, find_places, get_place and the regulations). The account, the keys, the layers, the coverage, the sandbox and the projects are free. A test key spends nothing, and the Team plan deducts nothing. The balance is in get_usage()["balance"] and get_me()["balance"]; without enough credits the API answers 402 and the client raises InsufficientCreditsError, before anything is charged.

from normatia import InsufficientCreditsError

try:
    answer = client.ask("¿Qué altura libre mínima exige la ordenanza?")
except InsufficientCreditsError as e:
    print(e.code, e.available, e.required)  # insufficient_credits 3.0 5.0

Addresses

find_parcels_by_address gives the parcels of a written address, from the entrances of the Cadastre and CartoCiudad, with what was understood (interpreted). exact is true when the address leads to one parcel without doubt; otherwise reason says why (ambiguous, no_candidates, not_understood...) and data holds the candidates, each with its confidence and match. Without the municipality it is never exact: write it, or pass province= (ES-28 or its name). suggest_addresses is the autocomplete while the user types (3 characters or more): streets and, once the text has a number, entrances with the reference of their parcel. Every call costs 0.1 credits, so call it when the user pauses (300 ms or so after the last keystroke), not on every key.

found = client.find_parcels_by_address("Calle Mayor 5, Madrid")
if found["exact"]:
    parcel = client.get_parcel(found["data"][0]["ref"], include=["zoning"])
else:
    print(found["reason"], [c["address"] for c in found["data"]], found["suggestions"])

for suggestion in client.suggest_addresses("Hermosilla 4", limit=5)["data"]:
    print(suggestion["type"], suggestion["text"], suggestion["ref"])  # "address" ones carry the parcel's ref

Sandbox keys

A sandbox key (sk-normatia-test-..., from Mi cuenta > Claves API > Clave de prueba) works with the same client and answers with about fifty fixed parcels and the public catalog, without spending credits. client.get_sandbox() lists the parcels; client.is_sandbox tells which kind of key the client has.

Errors

Every error is a NormatiaError with status_code, code (branch on it), message, request_id (send it to support), retry_after and body (the whole response, with the extra fields of each error). By status: AuthenticationError (401), InsufficientCreditsError (402, with available and required, or limit and spent on member_limit_reached), ForbiddenError (403), NotFoundError (404), RetiredEndpointError (410), ValidationError (422), RateLimitError (429), ServiceUnavailableError (503) and APIError (the rest). InsufficientCreditsError and RetiredEndpointError are also APIError.

from normatia import NotFoundError

try:
    client.get_parcel("4141412VG4444S")
except NotFoundError as e:
    print(e.code, e.request_id)  # parcel_not_found, req_...

GET requests are retried twice on 429 rate_limit_exceeded, 502, 503, 504 and network errors, waiting Retry-After when the API sends it (max_retries= to change it). ask is never retried: a retry would spend another 5 credits.

Besides the limits of each key, the data routes and the MCP server have one for the whole organization, adding up all its keys (get_me()["rate_limits"]["organization_per_minute"]). On a 429 rate_limit_exceeded, RateLimitError.group says which one was hit: the key's (data, intelligence, mcp) or organization.

Methods

Method Route
get_me(), get_usage(from_date=, to_date=), list_keys(), revoke_key(id) /v1/me, /v1/usage, /v1/keys
get_parcel(ref, include=[...]), find_parcels_at_point(lat, lon), get_sandbox() /v1/parcels, /v1/sandbox
find_parcels_by_address(address, province=), suggest_addresses(q, limit=) /v1/parcels?address=, /v1/addresses
list_layers(), get_coverage(place) /v1/layers, /v1/coverage
find_places(q, level=, within=), get_place(place) /v1/places
list_regulations(...), iter_regulations(...), get_regulation(slug), get_regulation_contents(slug), get_regulation_section(slug, section) /v1/regulations
list_projects(), get_project_info(project_id=) /api/v1/projects, /api/v1/project/info
ask(query, project_id=) /api/v2/ask (5 credits)

Responses are plain dicts, typed with TypedDict for editors (normatia.types).

verify() called POST /api/v1/verify, retired on 21 November 2026: it warns with DeprecationWarning and the API answers 410 (RetiredEndpointError). Ask the question with ask instead.

License

MIT

Metadata

Release files for normatia 0.2.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 normatia 0.2.0
File Size Uploaded Provenance Actions
normatia-0.2.0.tar.gz 18.8 kB With provenance Details for normatia-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for normatia 0.2.0
File Interpreter ABI Platform Actions
normatia-0.2.0-py3-none-any.whl Python 3 none any Details for normatia-0.2.0-py3-none-any.whl

Total release size: 36.0 kB

Release files / normatia-0.2.0.tar.gz

Download URL normatia-0.2.0.tar.gz
Size 18.8 kB
Tags Source
SHA-256 checksum
How to use checksums
23172554b596898b4e516ffc9de98562e3d5723f230d45fd549a70a1ee9ebbb0
BLAKE2b-256 checksum
How to use checksums
eb152a0860e06a54b185101fad210468276dd18c121afe716a28af324770f0cb
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 22, 2026.

Transparency log

Release files / normatia-0.2.0-py3-none-any.whl

Download URL normatia-0.2.0-py3-none-any.whl
Size 17.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b5724efdaaa19415cec7cb5fb109cf6e581dfa6682c25ecc6f3f13feb5ecaa5f
BLAKE2b-256 checksum
How to use checksums
d7ab36c0b4eaecac1347985577cd39d4429f7689f549cd0b280eb6081c417c0d
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 22, 2026.

Transparency log

Security for normatia 0.2.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.

Select from 2 files

Attestation for normatia-0.2.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 22, 2026.

Transparency log

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.2.0 This release

2 release files Full 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