Skip to content

MaintenanceThe former company search endpoint goes into maintenance on November 9Migration guide

SDKs // Python // Get started

Install and configure

Last verified

Install the Reverse Contact Python SDK, configure your API key, and create sync or async clients with Python 3.11 or later and typed responses.

reversecontact is the official Python client for the Reverse Contact API, distributed under the Apache-2.0 license. These pages describe the published 0.3.0 package.

Runtime requirements

The SDK needs Python 3.11 or later, with httpx>=0.27,<1 and pydantic>=2.7,<3. The package includes type hints for mypy and your editor.

Install

Install

pip install reversecontact

API key

Pass your API key to the client as api_key, or set the RC_API_KEY environment variable. When you omit api_key, the client reads RC_API_KEY.

The examples in these guides use the environment variable. You can use any server-side source, such as a secret manager. If you serve several workspaces, create one client per key. Keep the key on your server, out of your code and anything a browser loads. See Authentication to create a key.

Terminal

Terminal

export RC_API_KEY="your-api-key"

Create and close a client

Use a context manager to close the SDK's HTTP connection pool when your work ends. With RC_API_KEY set, create the client without passing a key:

Python SDK

Python SDK

from reversecontact import ReverseContact

with ReverseContact() as client:
    print(client.usage.retrieve().quotas)

You can also pass the key explicitly with ReverseContact(api_key=your_server_side_key), then call client.close() when finished. A missing or empty key raises ReverseContactError before the SDK sends an HTTP request. The SDK sends the key in an Authorization: Bearer header.

For asyncio applications, use async with AsyncReverseContact() or await client.close(). See the example in Async client.

Close any custom http_client yourself. Client options covers base URLs, connection pools, logging and per-client defaults. Once your client is configured, make your first call.

Return to the Python SDK overview.

FAQ

Which Python versions does reversecontact support?

The reversecontact package requires Python 3.11 or later, httpx 0.27 or later below 1, and Pydantic 2.7 or later below 3.

How do I set the API key for the Python SDK?

Set the RC_API_KEY environment variable or pass api_key to ReverseContact or AsyncReverseContact. Keep the key on your server.

Do I need to close the Python SDK client?

Use with ReverseContact() or async with AsyncReverseContact() to close the SDK-owned connection pool. Close any custom http_client yourself.