boundry.
RegionSydney, Australia

Python SDK

boundry is the synchronous typed client for Boundry’s regional API. It ships a py.typed marker so type checkers can use its generated models.

Install

terminalShell
Shell
pip install boundry

Quickstart

Set BOUNDRY_API_KEY, then send from a domain verified in this project. The display-name form is valid; an unverified sending domain returns 422.

send.pyPython
Python
import os
from boundry import Boundry

boundry = Boundry(api_key=os.environ["BOUNDRY_API_KEY"], region="au")

email = boundry.emails.send({
    "from": "Acme <hello@acme.com>",
    "to": ["ava@northwind.com.au"],
    "subject": "Welcome to Acme",
    "html": "<p>It works.</p>",
})

print(email["id"])

Client options

OptionTypePurpose
api_keystrProject API key. Defaults to BOUNDRY_API_KEY when available.
regionstrRegional endpoint selector. Sydney is the current supported region.
base_urlstrFull API base URL. Takes precedence over region when explicitly supplied.
timeoutfloat | httpx.TimeoutPer-request deadline in seconds. Defaults to 30.0.
max_retriesintRetries after the first attempt. Defaults to 2.
http_client / transporthttpx.Client / httpx.BaseTransportInject an HTTP client or transport for advanced use and tests.

Resources and methods

These rows are derived from the public OpenAPI operations and link to the generated endpoint reference. Request dictionaries are generated TypedDict models; where appropriate, the Python client also accepts documented keyword arguments.

SDK methodWhat it doesAPI reference
boundry.api_keys.list()List API keysView endpoint
boundry.api_keys.create(params)Create an API keyView endpoint
boundry.api_keys.delete(key_id)Delete an API keyView endpoint
boundry.domains.list()List domainsView endpoint
boundry.domains.create(params)Create a domainView endpoint
boundry.domains.delete(domain_id)Delete a domainView endpoint
boundry.domains.get(domain_id)Get a domainView endpoint
boundry.domains.update(domain_id, params)Update domain trackingView endpoint
boundry.domains.verify_action(domain_id)Verify a domain (compatibility action)View endpoint
boundry.domains.verify(domain_id)Verify a domainView endpoint
boundry.emails.list()List sent emailsView endpoint
boundry.emails.send(params, *, idempotency_key=None)Send an emailView endpoint
boundry.emails.get(email_id)Get a sent emailView endpoint
boundry.emails.list_attachments(email_id)List email attachmentsView endpoint
boundry.emails.get_attachment(email_id, attachment_id)Download an email attachmentView endpoint
boundry.emails.send_batch(params, *, idempotency_key=None)Send a batch of emailsView endpoint
boundry.events.list()List project eventsView endpoint
boundry.events.get(event_id)Get a project eventView endpoint
boundry.inbound.list(*, id=None)List received emailsView endpoint
boundry.inbound.get(email_id)Get a received emailView endpoint
boundry.inbound.ingest(params)Ingest an inbound emailView endpoint
boundry.logs.list()List event logsView endpoint
boundry.openapi.get()Get the OpenAPI documentView endpoint
boundry.webhooks.list()List webhooksView endpoint
boundry.webhooks.create(params)Create a webhookView endpoint
boundry.webhooks.delete(webhook_id)Delete a webhookView endpoint
boundry.webhooks.get(webhook_id)Get a webhookView endpoint
boundry.webhooks.update(webhook_id, params)Update a webhookView endpoint
boundry.webhooks.list_deliveries(webhook_id, *, id=None)List webhook deliveriesView endpoint
boundry.webhooks.get_delivery(webhook_id, delivery_id)Get webhook delivery detailView endpoint
boundry.webhooks.retry_delivery(webhook_id, delivery_id)Retry a webhook deliveryView endpoint
boundry.webhooks.rotate_secret(webhook_id, params)Rotate a webhook signing secretView endpoint
boundry.webhooks.test(webhook_id, params)Send a synthetic webhook eventView endpoint
boundry.webhooks.verify(webhook_id)Send a webhook ownership challengeView endpoint

Errors

Non-success responses raise BoundryAPIError, which carries status, code, message, and request_id. Transport failures raise BoundryConnectionError; timeouts raise BoundryTimeoutError. Both inherit from BoundryError.

send.pyPython
Python
import os
from boundry import Boundry, BoundryAPIError

boundry = Boundry(api_key=os.environ["BOUNDRY_API_KEY"])

try:
    boundry.emails.send({
        "from": "Acme <hello@acme.com>",
        "to": ["ava@northwind.com.au"],
        "subject": "Welcome to Acme",
        "html": "<p>It works.</p>",
    })
except BoundryAPIError as error:
    print(error.status, error.code, error.request_id)
finally:
    boundry.close()

Retries, idempotency, and context managers

The client retries connection failures and 408, 429, and 5xx responses with exponential backoff and jitter, up to max_retries (2 by default), while honouring Retry-After. emails.send and emails.send_batch automatically send an idempotency key; pass idempotency_key="..." to make it stable across your own retry.

send.pyPython
Python
import os
from boundry import Boundry

with Boundry(api_key=os.environ["BOUNDRY_API_KEY"], region="au") as boundry:
    email = boundry.emails.send({
        "from": "Acme <hello@acme.com>",
        "to": ["ava@northwind.com.au"],
        "subject": "Welcome to Acme",
        "text": "It works.",
    })
    print(email["id"])

Regions and local development

region="au" resolves to https://api.au.boundry.dev. Set base_url explicitly only when you need to override region.

local.pyPython
Python
import os
from boundry import Boundry

boundry = Boundry(
    api_key=os.environ["BOUNDRY_API_KEY"],
    base_url="https://api.au.boundry.dev",
)