Skip to main content

Python SDK for the Revenuebase Email Verification and Company Resolver API.

Project description

Revenuebase Python SDK

Python SDK for the Revenuebase API — email validation and company resolution.

Requirements

  • Python ≥ 3.8

Install

pip install revenuebase-sdk

Quickstart

from revenuebase_sdk import RevenuebaseClient

client = RevenuebaseClient(api_key="your-api-key")
# Or set REVENUEBASE_API_KEY in your environment and call RevenuebaseClient()

# Validate a single email
result = client.email_processing.validate_email(email="user@acme.com")
print(result.status)  # "Valid", "Invalid", or "Unknown"

# With full metadata
result = client.email_processing.validate_email(email="user@acme.com", metadata=True)
print(result.mx_record_present, result.email_provider)

# Check your credit balance
credits = client.user_operations.get_credits()
print(credits.credits)

Authentication

Pass your API key via the api_key parameter or the REVENUEBASE_API_KEY environment variable. The key is sent as the x-key header on every request.

export REVENUEBASE_API_KEY="your-api-key"

Resources

email_processing

Method Description
validate_email(*, email, metadata=False) Validate a single email. Returns Valid, Invalid, or Unknown.
batch_upload(*, file, filename, metadata=False) Upload a .csv or .json file for async batch validation.
get_batch_status(*, process_id) Poll the status of a batch job.
list_queued() List all active (queued or processing) batch jobs.
cancel_batch(*, process_id) Cancel a queued or in-progress batch job.
download_batch(*, process_id) Download the results of a completed job as bytes.
batch_start(*, filename, metadata=False) (Deprecated) Queue a pre-uploaded file. Use batch_upload instead.

user_operations

Method Description
get_credits() Get your remaining credit balance.
rotate_api_key() Generate a new API key (invalidates the previous one immediately).

company_resolver

Method Description
resolve(*, company_name, result_count=3, ...) Match a company name to verified records using semantic search.
discover(*, keyword, result_count=1000, ...) Discover companies matching a keyword or description.

Batch validation workflow

import time

# 1. Upload the file
with open("emails.csv", "rb") as f:
    job = client.email_processing.batch_upload(file=f, filename="emails.csv")

print(f"Job {job.process_id} queued")

# 2. Poll until complete
while True:
    status = client.email_processing.get_batch_status(process_id=job.process_id)
    print(status.current_status)
    if status.current_status in ("COMPLETED", "ERROR", "CANCELLED"):
        break
    time.sleep(5)

# 3. Download results
if status.current_status == "COMPLETED":
    data = client.email_processing.download_batch(process_id=job.process_id)
    with open("results.csv", "wb") as f:
        f.write(data)

Company resolution

# Match by name
result = client.company_resolver.resolve(
    company_name="Stripe",
    result_count=3,
    headquarters_country="US",
)
for company in result.companies:
    print(company.company_name, company.similar_score, company.headquarters_city)

# Discover by keyword
result = client.company_resolver.discover(
    keyword="enterprise cybersecurity SaaS",
    result_count=100,
    headquarters_country="US",
)

Async usage

import asyncio
from revenuebase_sdk import AsyncRevenuebaseClient

async def main():
    async with AsyncRevenuebaseClient(api_key="your-api-key") as client:
        result = await client.email_processing.validate_email(email="user@acme.com")
        print(result.status)

asyncio.run(main())

Error handling

from revenuebase_sdk import (
    AuthenticationError,
    BadRequestError,
    RateLimitError,
    APIConnectionError,
)

try:
    result = client.email_processing.validate_email(email="user@acme.com")
except AuthenticationError:
    print("Invalid API key")
except BadRequestError as e:
    print(f"Bad request: {e.message}")
except RateLimitError:
    print("Rate limited — slow down requests")
except APIConnectionError as e:
    print(f"Network error: {e.message}")

Per-request options

# Override timeout for a single call
result = (
    client
    .with_options(timeout=5.0, max_retries=0)
    .email_processing.validate_email(email="user@acme.com")
)

Development

pip install -e ".[dev]"
pytest
mypy src
ruff check src

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

revenuebase_sdk-0.1.0.tar.gz (22.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

revenuebase_sdk-0.1.0-py3-none-any.whl (18.3 kB view details)

Uploaded Python 3

File details

Details for the file revenuebase_sdk-0.1.0.tar.gz.

File metadata

  • Download URL: revenuebase_sdk-0.1.0.tar.gz
  • Upload date:
  • Size: 22.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for revenuebase_sdk-0.1.0.tar.gz
Algorithm Hash digest
SHA256 9313bae76a185c611ac0ef04a3672abf14974263d7ade7c2be5cb01f17224577
MD5 45a6c657d62cb16cbe760657fec05cb5
BLAKE2b-256 155e8e481ab0aea9e0249aa257aa7006b99ef206a059660efa85b21c387aecfd

See more details on using hashes here.

Provenance

The following attestation bundles were made for revenuebase_sdk-0.1.0.tar.gz:

Publisher: publish-pypi.yml on revenuebase/revenuebase-sdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file revenuebase_sdk-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for revenuebase_sdk-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7343c55a5e4bd1c654801bd15f66b54a1322128a390ef519d929faaa6e836d24
MD5 bdacb9f614bfee8f31e09efa2fa6fa1c
BLAKE2b-256 e613d773953442aaa1a81db20c2703cec0b7e61d2d458bf48b509e73f9943965

See more details on using hashes here.

Provenance

The following attestation bundles were made for revenuebase_sdk-0.1.0-py3-none-any.whl:

Publisher: publish-pypi.yml on revenuebase/revenuebase-sdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page