Skip to main content

byebouncer

Official Python SDK for the ByeBouncer email verification API.

Sync and async clients, real-time single-email verification, bulk CSV verification (up to 50k emails per job), HMAC-signed webhooks.

Install

pip install byebouncer

Requires Python 3.9+.

Quickstart

import os
from byebouncer import ByeBouncer

with ByeBouncer(api_key=os.environ["BB_API_KEY"]) as client:
    result = client.verify("user@gmail.com")
    print(result.status)             # "deliverable" | "undeliverable" | "risky" | "unknown"
    print(result.action)             # "allow" | "review" | "block"
    print(result.signals)            # ["valid_syntax", "mx_found", ...]
    print(result.credits_remaining)

Get your BB_API_KEY from https://byebouncer.com/dashboard (format bb_live_...).

Async

import asyncio
from byebouncer import AsyncByeBouncer

async def main():
    async with AsyncByeBouncer(api_key="bb_live_...") as client:
        result = await client.verify("user@gmail.com")
        print(result.status)

asyncio.run(main())

Bulk verification

created = client.bulk(
    emails=["a@gmail.com", "b@outlook.com"],  # up to 5.000
    filename="my_list.csv",
    webhook_url="https://api.myapp.com/hooks/byebouncer",  # optional
)
job = created.job
print(f"Job {job.id}, {job.total_emails} emails")
print(f"Estimated duration: {created.estimated_seconds}s")

# Present when webhook_url is supplied (generated or supplied).
# Store it now: it is never returned by later job reads.
webhook_secret = created.webhook_secret

Polling for completion

final = client.bulk_wait_for_completion(
    job.id,
    interval_seconds=3,
    on_progress=lambda j: print(f"{j.processed}/{j.total_emails}"),
)

if final.status == "completed":
    download = client.bulk_download_url(final.id)
    csv = httpx.get(download.url).text
    open("results.csv", "w").write(csv)

Prefer webhooks over polling. On completion ByeBouncer POSTs to your URL with:

X-ByeBouncer-Event: bulk.completed
X-ByeBouncer-Signature: <hex HMAC-SHA256(body, webhook_secret)>

Attach or rotate the webhook after creating the job:

result = client.bulk_set_webhook(
    job.id,
    webhook_url="https://api.myapp.com/hooks/byebouncer",
)
webhook_secret = result.webhook_secret  # store it NOW, returned only once

Cancel

cancelled = client.bulk_cancel(job.id)
print(f"Refunded {cancelled.credits_refunded} credits")

Error handling

Non-2xx responses raise ByeBouncerError or a subclass with code, status, detail.

from byebouncer import InsufficientCreditsError, RateLimitError, ByeBouncer

with ByeBouncer(api_key="bb_live_...") as client:
    try:
        client.verify("user@gmail.com")
    except InsufficientCreditsError as e:
        print(f"Out of credits (remaining: {e.credits_remaining})")
    except RateLimitError as e:
        print(f"Rate limited, retry after {e.retry_after_seconds}s")

API reference

Every method mirrors the OpenAPI spec.

Method Endpoint Description
verify(email) POST /verify Verify a single email
credits() GET /credits Get balance
bulk(emails, ...) POST /bulk Enqueue a bulk job
bulk_status(job_id) GET /bulk/{id} Fetch job
bulk_cancel(job_id) DELETE /bulk/{id} Cancel
bulk_download_url(job_id) GET /bulk/{id}/download Signed CSV URL
bulk_set_webhook(job_id, ...) POST /bulk/{id}/webhook Attach/rotate webhook
bulk_wait_for_completion(job_id, ...) polls Convenience helper
bulk_and_wait(emails, ...) create+poll+download Available in sync and async clients

Support

License

MIT © ByeBouncer

Metadata

Release files for byebouncer-sdk 0.2.1

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

Source distribution (sdist)

Source distribution for byebouncer-sdk 0.2.1
File Size Uploaded Provenance
byebouncer_sdk-0.2.1.tar.gz 12.3 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for byebouncer-sdk 0.2.1
File Interpreter ABI Platform
byebouncer_sdk-0.2.1-py3-none-any.whl Python 3 none any Details

Total release size: 23.7 kB

Release files / byebouncer_sdk-0.2.1.tar.gz

Download URL byebouncer_sdk-0.2.1.tar.gz
Size 12.3 kB
Tags Source
SHA-256 checksum
How to use checksums
426e1f9f1cea517f2236584dd9cb2d684abde4583aeeb729e82ea38b7882687f
BLAKE2b-256 checksum
How to use checksums
5d0eb3c68cd39b4c40751d3bd5b5f2f8cdcd4e95bfbb6e287c77cacf5ad5dd89
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.15

Release files / byebouncer_sdk-0.2.1-py3-none-any.whl

Download URL byebouncer_sdk-0.2.1-py3-none-any.whl
Size 11.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2d0daf12b959d878080a5291eff4496cc82ea06760a7a359d928eabe4b398ff5
BLAKE2b-256 checksum
How to use checksums
ad87dcc6a279ff2e87fd0c362f4592acd33ba72d4ae98135c2af5eda41cc00b7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.15

Security for byebouncer-sdk 0.2.1

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.

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