Skip to content

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

SDKs // Python // Get started

First call

Last verified

Make your first Reverse Contact API call in Python, read typed data and credit usage, and handle a lookup that returns no matching profile.

Follow Install and configure to create an API key. Then enrich a person and inspect the response.

Enrich a person

This call enriches a person from a work email. It costs 2 credits when a person is found, and nothing when no profile matches.

Python SDK

Enrich a person

import os

from reversecontact import ReverseContact

with ReverseContact(api_key=os.environ["RC_API_KEY"]) as client:
    result = client.enrich.person(email="jane.doe@acme.com")
    if result is None:
        print("No confident match: nothing was charged")
    elif result.data is not None and result.data.person is not None:
        person = result.data.person
        print(person.first_name, person.last_name, person.current_position_title)
        print("Credits used:", result.quotas.credits_consumed if result.quotas else None)
        print("Request id:", result.metadata.request_id if result.metadata else None)

A JSON API call returns a Result, Page or Job with these four attributes. CSV downloads return text, and iterators yield items instead:

  • data: the data field of the API response, as a Pydantic model. Enrich nests the profile in data.person or data.company. A cached fetch returns the profile directly in data, while Usage returns data as None. For a search page, data holds the results. For a job, it holds the acknowledgement.
  • quotas: your credits and rate limits after this call, with credits_consumed for the call itself.
  • metadata: request_id and execution_time_ms. Quote the request_id when you contact support.
  • http_response: the original httpx.Response, headers included.

Arguments and model attributes use snake_case (full_name, first_name). You can also pass arguments with the API's camelCase names. model.to_dict() returns the API shape with its camelCase names. You can read fields the API adds later through model.model_extra. Check fields before use, since any field can be None.

Lookups that find nothing

enrich.person, enrich.company, fetch.person and fetch.company return None when the API answers 404 because nothing matched. A no-match response costs no credits and needs no retry. Check for None and move on. Other 404 responses, such as an unknown job id or a wrong base URL, raise NotFoundError.

See client.enrich for lookup parameters and client.fetch to retrieve profiles by URL or id. Errors and retries explains how to handle failed requests.

Return to the Python SDK overview.

FAQ

How do I enrich a person from an email in Python?

Call client.enrich.person(email="jane.doe@acme.com"). A match is in result.data.person and costs 2 credits. If no profile matches, the call returns None and costs no credits.

Does the Python SDK use snake_case or camelCase?

SDK arguments and typed model attributes use snake_case. API camelCase arguments also work, and model.to_dict() returns camelCase API fields.

Where can I find the request id and credits consumed?

Check that metadata and quotas are present, then read result.metadata.request_id and result.quotas.credits_consumed.

What does a Python lookup return when no profile matches?

enrich.person, enrich.company, fetch.person and fetch.company return None for no-match responses. Other 404 responses raise NotFoundError.