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 50.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)

Webhooks (recommended for large jobs)

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 0.1.0

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 0.1.0
File Size Uploaded
byebouncer-0.1.0.tar.gz 9.2 kB Details

Built distribution (wheel)

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

Total release size: 18.8 kB

Release files / byebouncer-0.1.0.tar.gz

Download URL byebouncer-0.1.0.tar.gz
Size 9.2 kB
Tags Source
SHA-256 checksum
How to use checksums
fff0eefbf02fb060dbe69cd72265e039620a8a07a6826f781cee549dfbd186ef
BLAKE2b-256 checksum
How to use checksums
83ae0d08c6f7de5c3ab164623db7c94c44dfb4f082eb3e93492ad1bfbf46b99b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.5

Release files / byebouncer-0.1.0-py3-none-any.whl

Download URL byebouncer-0.1.0-py3-none-any.whl
Size 9.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5e01058d1692d6704c46619c932f8e11a31d27adee323a26995a8c3e2c968ea3
BLAKE2b-256 checksum
How to use checksums
4abc5868bce0b4beb225c2c22547922a56c9ebadc3393f2a111b7e6f2fa01eac
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.5

Release history Release notifications | RSS feed

This release

0.1.0 This release

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