Skip to main content
Change of provenance

The repository or configuration that created this release differ from a previous release. View details.

ByteSend Python SDK

A minimal Python SDK for the ByteSend API, mirroring the structure of the JavaScript SDK.

Installation

Install via pip or Poetry:

pip install bytesend
# or
poetry add bytesend

Usage

from bytesend import ByteSend, types

# By default: raises ByteSendHTTPError on non-2xx.
client = ByteSend("bs_123")

# 1) TypedDict payload (autocomplete in IDEs). Use dict to pass 'from'.
payload: types.EmailCreate = {
    "to": "test@example.com",
    "from": "no-reply@example.com",
    "subject": "Hello",
    "html": "<strong>Hi!</strong>",
}
resp, _ = client.emails.send(payload=payload)

# 2) Or pass a plain dict (supports 'from')
resp, _ = client.emails.send(payload={
    "to": "test@example.com",
    "from": "no-reply@example.com",
    "subject": "Hello",
    "html": "<strong>Hi!</strong>",
})

# Idempotent retries: same payload + same key returns the original response
resp, _ = client.emails.send(
    payload=payload,
    options={"idempotency_key": "signup-123"},
)

# Works for batch requests as well
resp, _ = client.emails.batch(
    payload=[payload],
    options={"idempotency_key": "bulk-welcome-1"},
)
# If the same key is reused with a different payload, the API responds with HTTP 409.

# 3) Campaigns
campaign_payload: types.CampaignCreate = {
    "name": "Welcome Series",
    "subject": "Welcome to our service!",
    "html": "<p>Thanks for joining us!</p>",
    "from": "welcome@example.com",
    "contactBookId": "cb_1234567890",
}
campaign_resp, _ = client.campaigns.create(payload=campaign_payload)

# Schedule a campaign
schedule_payload: types.CampaignSchedule = {
    "scheduledAt": "2024-12-01T10:00:00Z",
}
schedule_resp, _ = client.campaigns.schedule(
    campaign_id=campaign_resp["id"],
    payload=schedule_payload
)

# Pause/resume campaigns
client.campaigns.pause(campaign_id="campaign_123")
client.campaigns.resume(campaign_id="campaign_123")

# Toggle behavior if desired:
# - raise_on_error=False: return (None, error_dict) instead of raising
# No model parsing occurs; methods return plain dicts following the typed shapes.
client = ByteSend("bs_123", raise_on_error=False)
raw, err = client.emails.get(email_id="email_123")
if err:
    print("error:", err)
else:
    print("ok:", raw)

Webhook Local Example

For a runnable webhook verification demo project, see:

  • example/webhook-test-project/README.md

Development

This package is managed with Poetry. Models are maintained in-repo under bytesend/types.py (readable names). Update this file as the API evolves.

It is published as bytesend on PyPI.

Available Resources

  • Emails: client.emails.send(), client.emails.get()
  • ContactBooks: client.contact_books.list(), client.contact_books.create(), client.contact_books.get(), client.contact_books.update()
  • Contacts: client.contacts.create(), client.contacts.list(), client.contacts.get(), client.contacts.bulk_create(), client.contacts.bulk_delete()
  • Domains: client.domains.create(), client.domains.get(), client.domains.verify()
  • Campaigns: client.campaigns.create(), client.campaigns.get(), client.campaigns.schedule(), client.campaigns.pause(), client.campaigns.resume(), client.campaigns.delete()

Notes

  • Human-friendly models are available under bytesend.types (e.g., EmailCreate, CampaignCreate, Contact, APIError).
  • Endpoint methods accept TypedDict payloads or plain dicts via the payload= keyword.

Metadata

Release files for bytesend 0.1.3

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

Change of provenance

The repository or configuration that created these release files differ from that of a previous release.

We recommend inspecting the repository and configuration before proceeding. View details.

Source distribution (sdist)

Source distribution for bytesend 0.1.3
File Size Uploaded Provenance Actions
bytesend-0.1.3.tar.gz 24.3 kB With provenance Details for bytesend-0.1.3.tar.gz

Built distribution (wheel)

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

Total release size: 51.4 kB

Release files / bytesend-0.1.3.tar.gz

Change of provenance

This file belongs to a release with changed provenance: the repository or configuration that created the release files differ from that of a previous release.

We recommend inspecting the repository and configuration before proceeding. View details.

Download URL bytesend-0.1.3.tar.gz
Size 24.3 kB
Tags Source
SHA-256 checksum
How to use checksums
2026a069fab4be1cff53abdfe4b7175fe913e8c707736eace03ef5d21f5ac8ac
BLAKE2b-256 checksum
How to use checksums
387d795be36ea93ad8d2825eb38461856ffa86a83f3c014e76712d31c1b00493
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 20, 2026.

Transparency log

Release files / bytesend-0.1.3-py3-none-any.whl

Change of provenance

This file belongs to a release with changed provenance: the repository or configuration that created the release files differ from that of a previous release.

We recommend inspecting the repository and configuration before proceeding. View details.

Download URL bytesend-0.1.3-py3-none-any.whl
Size 27.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a3d50ff89e47da3c73ecc9a488ed8b0dab65f8f4765fcaca5ce963d826174289
BLAKE2b-256 checksum
How to use checksums
36e3239291e963844884a43ec790d47a9313bab9f16da73760d65c0b9c6272fb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 20, 2026.

Transparency log

Security for bytesend 0.1.3

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.

Change of provenance

The repository and configuration that created this release differ from a previous release.

While this could reflect a routine change by the project maintainers, it may also indicate that the release files have been compromised.

Select from 2 files

Attestation for bytesend-0.1.3.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 20, 2026.

Transparency log

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