Companies House API Python Client
Async Python client for the Companies House API with type-safe Pydantic models, automatic pagination, and comprehensive error handling.
Features
- Async-first with
httpx - Type-safe Pydantic models
- Automatic pagination handling
- Optional rate limiting
- 98%+ test coverage
Installation
pip install ch-api
Quick Start
Example of getting company information:
>>> async def get_company_example(client):
... company = await client.get_company_profile("09370755")
... return company is not None
>>> run_async_func(get_company_example)
True
Key Endpoints
- Company:
get_company_profile(),get_officer_list(),get_company_psc_list(),get_company_charges(),get_company_filing_history() - Search:
search_companies(),search_officers(),search_disqualified_officers() - Sandbox:
create_test_company()(TEST_API_SETTINGS only)
Pagination
List endpoints return a MultipageList[T] with .data (tuple) and .pagination
metadata. Pass result_count to collect more items per call, and advance with
client.fetch_next_page(page.pagination.next_page):
>>> async def search_example(client):
... results = await client.search_companies("tech")
... return len(results.data) >= 1
>>> run_async_func(search_example)
True
pagination.next_page is a self-contained cursor — it embeds the endpoint and
its arguments, so a fresh process can resume with just the token via
await client.fetch_next_page(token) (ideal for stateless servers or agent tools).
Rate Limiting
The API allows 600 requests per 5 minutes. Use an async rate limiter:
>>> from asyncio_throttle import Throttler # doctest: +SKIP
Error Handling
>>> import httpx # doctest: +SKIP
Advanced Usage
Sandbox Environment
>>> from ch_api import Client, api_settings # doctest: +SKIP
Custom HTTP Session
>>> import httpx # doctest: +SKIP
Requirements
- Python 3.11+
- httpx >= 0.28.1
- pydantic >= 2.12.5
Documentation
License
MIT License - See LICENSE file for details
Contributing
Please see CONTRIBUTING for development guidelines.
Metadata
Release files for ch-api 2.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 |
|---|---|---|---|---|
| ch_api-2.0.0.tar.gz | 413.6 kB | Without provenance | Details for ch_api-2.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ch_api-2.0.0-py3-none-any.whl | Python 3 | none | any | Details for ch_api-2.0.0-py3-none-any.whl |
Total release size: 500.2 kB
Release files / ch_api-2.0.0.tar.gz
| Download URL | ch_api-2.0.0.tar.gz |
|---|---|
| Size | 413.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a85774a7d1dab5d4c002156ed8ce3be6c4bb16edfc43ffe39dc54882ef162830
|
|
BLAKE2b-256 checksum How to use checksums |
6c284d9bb6e961e702a7e26cab2fc7509056b99927b820db1cebd79ca2f6f59f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
pdm/2.27.0 CPython/3.13.14 Linux/6.17.0-1018-azure
|
Release files / ch_api-2.0.0-py3-none-any.whl
| Download URL | ch_api-2.0.0-py3-none-any.whl |
|---|---|
| Size | 86.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
964766ea0fb3d959e3b380b8dabeeec88044e4b9a0c523587fd174d8b5417782
|
|
BLAKE2b-256 checksum How to use checksums |
387aac9435d6bbc27b88b8f558cb6d5fe481e16a6b656595f12c1c44475e96cb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
pdm/2.27.0 CPython/3.13.14 Linux/6.17.0-1018-azure
|
Security for ch-api 2.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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
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.