Skip to main content

Companies House API Library

A Python client for interacting with the Companies House API.

PyPI version

Installation

This library is available on PyPI and can be installed with pip:

pip install companies-house-api-lib

Usage

To use the client, you need to have a Companies House API key. You can get one from the Companies House developer portal.

Once you have your key, you can either pass it to the client directly or set it as an environment variable named COMPANIES_HOUSE_API_KEY.

from companieshouse import CompaniesHouseClient

# Option 1: Pass the key directly
client = CompaniesHouseClient(api_key="YOUR_API_KEY")

# Option 2: Use an environment variable
# export COMPANIES_HOUSE_API_KEY="YOUR_API_KEY"
client = CompaniesHouseClient()

# Search for companies
search_results = client.search_companies("python")
print(search_results)

# Get a company profile
if search_results.get("items"):
    company_number = search_results["items"][0]["company_number"]
    company_profile = client.get_company_profile(company_number)
    print(company_profile)

Testing

A test file (test_library.py) is included in this repository. To run the tests, you will need to have your Companies House API key set as an environment variable.

export COMPANIES_HOUSE_API_KEY="YOUR_API_KEY"
python test_library.py

Available API Calls

Here is a list of the available API calls in this library:

  • search_all(query): Searches for all records in the Companies House API.
  • search_companies(query): Searches for companies.
  • get_company_profile(company_number): Gets the profile of a company.
  • get_company_officers(company_number): Gets the company officers.
  • get_company_filing_history(filing_history_url): Gets the company filing history.
  • get_company_registered_office_address(company_number): Gets the company office address.
  • get_company_registers(company_number): Gets the company registers details.
  • get_company_charges(company_number): Gets the company charges details.
  • get_company_insolvency(company_number): Gets the company insolvancy details.
  • get_company_exemptions(company_number): Gets the company exemptions details.
  • get_corporate_officer_disqualifications(officer_id): Gets the corporate officer disqualifications.
  • get_natural_officer_disqualifications(officer_id): Gets the natural officer disqualifications.
  • get_office_appointments(officer_id): Gets the officer appointments.
  • get_company_uk_establishments(company_number): Gets the company insolvancy details.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Metadata

Release files for companies-house-api-lib 0.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for companies-house-api-lib 0.4
File Size Uploaded
companies_house_api_lib-0.4.tar.gz 7.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for companies-house-api-lib 0.4
File Interpreter ABI Platform
companies_house_api_lib-0.4-py3-none-any.whl Python 3 none any Details

Total release size: 15.7 kB

Release files / companies_house_api_lib-0.4.tar.gz

Download URL companies_house_api_lib-0.4.tar.gz
Size 7.6 kB
Tags Source
SHA-256 checksum
How to use checksums
107a4b9727800e335f7a28c8638bb1a5792f46be797a11c9b5f7e7474fcac59e
BLAKE2b-256 checksum
How to use checksums
56438eca0f0973af1571f8e62a6e70b6ccad3a972658ca3b407b6a43401bcd1a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.13

Release files / companies_house_api_lib-0.4-py3-none-any.whl

Download URL companies_house_api_lib-0.4-py3-none-any.whl
Size 8.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e2effdd5abc87829d15fedd5e3564d2085b5eada77e622b2fb913a7c9f0f88c1
BLAKE2b-256 checksum
How to use checksums
2ed00a6ec6f922fc014ee528d32559717a723872fcbbb36384adbe1e0f9365cf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.13

Release history Release notifications | RSS feed

This release

0.4 This release

2 release files

0.3

2 release files

0.2

2 release files

0.1

2 release files

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