The repository or configuration that created this release differ from a previous release. View details.
Ideal Postcodes Python SDK
Client for every current API operation: address search and lookup, place search, email and phone validation, and key, licensee and configuration management. Requires Python 3.12 or later; tested on 3.12, 3.13 and 3.14.
pip install ideal-postcodes
from ideal_postcodes import IdealPostcodes
with IdealPostcodes("ak_test") as client:
for address in client.postcodes("BR8 7RE"):
print(address.line_1, address.post_town)
ak_test is the public test key. The client returns Pydantic models from the API's result field. Read fields as attributes and use model_dump() for a dictionary. Reuse one client and close it with a context manager. Production keys belong in environment variables.
Search and resolve
from ideal_postcodes import IdealPostcodes
with IdealPostcodes("ak_test") as client:
hits = client.find_address(query="9 Malyons Road", limit=5).hits
if hits:
address = client.resolve_address(hits[0].id)
print(address.postcode)
Resolve the suggestion the user chooses. An empty suggestion list is a normal result.
Methods
| Method | Purpose |
|---|---|
postcodes(postcode, ...) |
Addresses at a postcode |
addresses(query=..., ...) |
Paginated address search; filters can be used without query text |
address_cleanse(query=..., ...) |
Cleanse a freeform address, with optional postcode and post town |
find_address(query=..., ...) |
Autocomplete suggestions |
resolve_address(address, ...) |
Resolve a suggestion using the spec's GBR endpoint |
find_place(query=..., ...) |
Place search |
resolve_place(place, ...) |
Resolve a place suggestion |
email_validation(query=..., ...) |
Validate an email address |
phone_number_validation(query=..., ...) |
Validate a phone number |
key_availability(key) |
Public availability and licensed contexts |
key_details(key, user_token=...) |
Private settings and remaining lookups |
update_key_details(key, user_token=..., ...) |
Update selected key settings |
key_usage(key, user_token=..., ...) |
Usage totals and daily breakdown |
key_logs(key, user_token=..., ...) |
Paid lookup logs as CSV text |
list_licensees, create_licensee, retrieve_licensee, update_licensee, delete_licensee, regenerate_licensee_key |
Licensee management |
list_configs, create_config, retrieve_config, update_config, delete_config |
Saved configurations |
Methods expose every supported input in their signatures. Required keyword arguments must be supplied. Optional None values are omitted, leaving defaults to the server. Dataset lists are comma-joined. String flags use "true" and "false", as declared by the API. Parameter constraints appear in each method's docstring; scalar ranges, lengths and enums are checked before sending. |
Use help(IdealPostcodes.find_address) or inspect ideal_postcodes/client.py for parameters. Response definitions live in ideal_postcodes/types.py. examples/ has a runnable script for each method.
Keys
from ideal_postcodes import IdealPostcodes
with IdealPostcodes("ak_test") as client:
availability = client.key_availability("ak_test")
print(availability.available)
The key argument identifies the key to inspect or update. Availability and retrieve_config need no Management Key. Other key, licensee and configuration methods require your Management Key as the keyword user_token; the client sends it as Authorization: Bearer, in place of the API key, never in the URL. Load it from your application's secret storage. Usage and logs accept start and end as UNIX timestamps in milliseconds. key_logs returns CSV text rather than a response model.
Update only the settings you want to change. Nested settings accept typed dictionaries from ideal_postcodes.requests. For example, daily_limit={"limit": None} disables the daily limit, notifications={"enabled": False} disables notifications and allowed_urls=[] clears the URL restriction. Omitted top-level settings remain unchanged. Nested None values are sent as JSON null.
Errors and retries
All SDK request failures derive from ClientError:
APIError: unsuccessful HTTP response, withstatus,code,message,bodyand rawretry_afterAuthenticationError,PaymentRequiredError,NotFoundError,RateLimitErrorandServerError: API error subclassesTransportError: connection or timeout failure before a responseProtocolError: unexpected success status, malformed envelope or a result of the wrong JSON type
A result that does not match the response schema, such as one missing a required field, is returned unvalidated with a ResponseValidationWarning naming the field paths. Matching fields stay typed. warnings.simplefilter("error", ResponseValidationWarning) makes it raise instead.
NotFoundError.suggestions contains postcode suggestions when supplied by the API. HTTP 429 and HTTP 503 with API code 5030 raise RateLimitError. Other 5xx responses raise ServerError. Exception strings include the API's message, for example API request failed (HTTP 404, code 4040): Postcode not found, and omit credentials and request URLs. body may contain caller input.
There are no automatic retries. A timeout may occur after a lookup was processed. Choose retry behaviour in the application and bound attempts; Retry-After can be seconds or an HTTP date. Inputs are checked against the spec before the network call: a missing argument, wrong type or unknown settings key raises TypeError, and an out-of-range number, string length or pattern raises ValueError. Option values the SDK does not list yet pass through to the API.
Testing and limits
Pass transport=httpx.MockTransport(handler) to test without network access, or override base_url. The default timeout is 10 seconds.
Response models validate required fields, types, lists and unions from the checked-in OpenAPI contract, and accept normal API growth: extra fields survive in model_dump(), option fields are plain strings so new values come through, and a native record from a dataset the SDK does not know yet arrives as a dictionary. An explicit filter returns address dictionaries containing the requested fields; paginated address search returns a model whose hits are dictionaries. The client is synchronous; run it in a worker thread when calling from an async application.
Signup is not included.
Development
Run uv sync --frozen, then make ci and make build. make generate rebuilds the client, transport and response types from the shared generator and this brand's spec. make check-generated detects drift without rewriting committed files. make format applies Ruff fixes and formatting; make ci checks both. Run commands from this package directory.
Licence
SEE LICENSE IN LICENSE
Metadata
Release files for ideal-postcodes 0.4.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Change of provenance
The repository or configuration that created these release files differ from that of a previous release.
We recommend inspecting the repository and configuration before proceeding. View details.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| ideal_postcodes-0.4.0.tar.gz | 63.6 kB | With provenance | Details for ideal_postcodes-0.4.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ideal_postcodes-0.4.0-py3-none-any.whl | Python 3 | none | any | Details for ideal_postcodes-0.4.0-py3-none-any.whl |
Total release size: 128.7 kB
Release files / ideal_postcodes-0.4.0.tar.gz
Change of provenance
This file belongs to a release with changed provenance: the repository or configuration that created the release files differ from that of a previous release.
We recommend inspecting the repository and configuration before proceeding. View details.
| Download URL | ideal_postcodes-0.4.0.tar.gz |
|---|---|
| Size | 63.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
af24fecdb6a3e2b28b0d376e25865517f0accfa6aee6af7851a3b950d30643ab
|
|
BLAKE2b-256 checksum How to use checksums |
e92438b27b57114fe1e6ce11ad641dff9f6bc2d19a3679caa3335c4c2d446990
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 / ideal_postcodes-0.4.0-py3-none-any.whl
Change of provenance
This file belongs to a release with changed provenance: the repository or configuration that created the release files differ from that of a previous release.
We recommend inspecting the repository and configuration before proceeding. View details.
| Download URL | ideal_postcodes-0.4.0-py3-none-any.whl |
|---|---|
| Size | 65.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c9ba9fcc0ef494f5c64d0639c6a195855dff3c0ec4eb5b291aef0e87743fdfb1
|
|
BLAKE2b-256 checksum How to use checksums |
48e965c27c25294fa0e994f9205ad0aef347e2129c07027d9cce0db6606e2e05
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 ideal-postcodes 0.4.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.
Change of provenance
The repository and configuration that created this release differ from a previous release.
While this could reflect a routine change by the project maintainers, it may also indicate that the release files have been compromised.
Repository
- Removed 0.3.0 github.com/ideal-postcodes/atlas
- Added 0.4.0 github.com/ideal-postcodes/python-sdk
Attestation for ideal_postcodes-0.4.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.