UniOne Python SDK 1.1.3
Web API 1.90
Official Python library for the UniOne transactional email API.
Quickstart guide: Send emails with Python · Docs for LLMs: llms.txt · API reference
Install
pip install unione-sdk
Requirements: Python 3.8+. No third-party dependencies.
Get an API key
- Sign up at cp.unione.io.
- Copy your API key from Settings → Security → API.
- Put it in an environment variable:
export UNIONE_API_KEY="your-api-key"
Server-side only. Use this SDK in backend code: API routes, server functions, workers. Never ship the API key to a browser or a mobile app, and never commit it.
Send your first email — no DNS setup
Every account can send test email right away from a sandbox domain: pre-verified, DKIM and SPF already set. It delivers only to addresses you confirm.
1. Get your sandbox domain (domain/get-sandbox-domain). The call creates the domain on first use and returns the same one afterwards.
import os
import unione
client = unione.client(os.environ["UNIONE_API_KEY"])
response = client.domain.get_sandbox_domain()
print(response.domain)
2. Confirm your inbox (confirmed-email/create). UniOne sends a confirmation email; click the link in it within 48 hours.
import os
import unione
from unione.api.confirmed_email import ConfirmedEmailRequest
client = unione.client(os.environ["UNIONE_API_KEY"])
response = client.confirmed_email.create(ConfirmedEmailRequest(
email="you@example.com",
))
print(response.confirmed_email)
Check the status with confirmed-email/list — your address should show "status": "confirmed".
3. Send the email (email/send) from any address on the sandbox domain to the confirmed address.
import os
import unione
from unione.api.email import EmailSendRequest, MessageObject, MessageObjectRecipientsItem
from unione.common import BodyObject
client = unione.client(os.environ["UNIONE_API_KEY"])
response = client.email.send(EmailSendRequest(
message=MessageObject(
recipients=[
MessageObjectRecipientsItem(
email="you@example.com",
),
],
body=BodyObject(
html="<p>It works!</p>",
),
subject="Hello from UniOne",
from_email="noreply@<sandbox-domain>",
),
))
print(response.job_id)
What you get back
{
"status": "success",
"job_id": "1ZymBc-00041N-9X",
"emails": [
"you@example.com"
]
}
On error the API returns status: "error", a message and a numeric code:
{
"status": "error",
"code": 102,
"message": "Error ID:83274F98-C7D5-11F1-B221-6214FF8707B1. Can not decode key wrongkey"
}
Same flow with curl
BASE=https://api.unione.io/en/transactional/api/v1
curl -s -X POST $BASE/domain/get-sandbox-domain.json \
-H "Content-Type: application/json" -H "X-API-KEY: $UNIONE_API_KEY" -d '{}'
curl -s -X POST $BASE/confirmed-email/create.json \
-H "Content-Type: application/json" -H "X-API-KEY: $UNIONE_API_KEY" \
-d '{"email": "you@example.com"}'
curl -s -X POST $BASE/email/send.json \
-H "Content-Type: application/json" -H "X-API-KEY: $UNIONE_API_KEY" \
-d '{
"message": {
"recipients": [
{
"email": "you@example.com"
}
],
"from_email": "noreply@<sandbox-domain>",
"subject": "Hello from UniOne",
"body": {
"html": "<p>It works!</p>"
}
}
}'
Sandbox limits
- Sends only to confirmed addresses: up to 10 per account.
- Up to 100 emails a day.
- The sandbox domain expires after 31 days; call
domain/get-sandbox-domainagain to get a new one. - Works only with the account API key, not a project key.
- Not listed in
domain/list; the otherdomain/*methods do not apply to it.
The sandbox is for development and testing. Do not use a sandbox domain as the sender in production.
Before production: verify your domain
-
domain/get-dns-records— returns the values for your DNS records. -
Add these records at your DNS provider (the domain page of the control panel shows them too):
Type Host Value TXT @the verification-recordvalue (unione-validate-hash=…)TXT <selector>._domainkey(the selector is on the domain page of the control panel, e.g.us)v=DKIM1; k=rsa; p=<dkim>TXT @v=spf1 include:spf.unione.io ~allCNAME _dmarcthe dmarcvalue -
domain/validate-verification-record, thendomain/validate-dkim. -
domain/list— wait until the verification record is confirmed and DKIM is active. -
Read
from_emailfrom your config, so switching from the sandbox needs no code change.
Sending reliably
- Retries: set
message.idempotence_keyon sends that may be retried, so a repeated request does not send twice. - Limits: up to 500 recipients and 10 MB per request; each attachment up to 7 MB.
- Body: always include
body.htmlorbody.plaintext. - Delivery status: register a webhook (
webhook/set) with a fast, idempotent HTTPS handler instead of polling. - Defaults: keep the default unsubscribe footer and tracking; changing them requires UniOne support.
- Errors: retry
429and5xxwith backoff; do not retry other errors unchanged.
Links
- Send emails with Python and other integration guides
- Web API reference
- llms.txt for AI coding agents
- UniOne MCP server and agent setup
- Support
For SDK contributors
See AGENTS.md: how this SDK is generated from the OpenAPI spec, built, tested and released.
SDK reference
API host
The second argument selects the API host (datacenter) or a full base URL.
import unione
from unione.client import HOST_US1
client = unione.client("YOUR_API_KEY", "us1.unione.io")
client = unione.client("YOUR_API_KEY", HOST_US1)
Custom HTTP client / headers
headers adds HTTP headers to every request. transport replaces the HTTP layer: any object with send(method, url, headers, body, timeout) -> (status, body) (body: bytes; or such a function). Wrap the default UrllibTransport for retries or logging, or call requests / httpx in your own one; an exception of the transport becomes ApiError.
import time
import unione
from unione.client import UrllibTransport
class RetryTransport:
"""Logs every request and retries network failures and HTTP 5xx."""
def __init__(self, inner=None, attempts=3):
self.inner = inner or UrllibTransport()
self.attempts = attempts
def send(self, method, url, headers, body, timeout):
for attempt in range(1, self.attempts + 1):
print(method, url)
try:
status, raw = self.inner.send(method, url, headers, body, timeout)
except unione.ApiError:
if attempt == self.attempts:
raise
else:
if status < 500 or attempt == self.attempts:
return status, raw
time.sleep(attempt)
client = unione.client("YOUR_API_KEY", transport=RetryTransport(), headers={"X-Request-Id": "42"})
Models with free-form keys (HeadersObject) have an extra dict: its keys go next to the named fields.
from unione.common import HeadersObject
headers = HeadersObject(extra={
"X-MyHeader": "some data",
"CC": "copy@example.com",
"List-Unsubscribe": "<mailto:unsubscribe@example.com>",
})
Error handling
Every method raises ApiError when the API returns an error; it carries the API error code and the HTTP status.
Sections
| Section | Methods | Description |
|---|---|---|
send, subscribe |
This group of methods is related with email sending. | |
| EmailValidation | single |
Email validation methods. As a result of the check, you’ll get detailed information on email validity. It will help eliminate nonexistent emails, decrease the number of complaints, clean up the subscribers list and eventually enhance your sender reputation score. For example, you may add validation to a subscription form on your site to let users know they’ve just entered an invalid address. |
| ConfirmedEmail | create, list, delete |
Manage email addresses confirmed for sandbox-domain sending. These methods are available only with a main account API key. |
| Template | set, get, list, delete |
You have the option of storing a template on the UniOne side and then using it by id, which is highly recommended for sending repetitive messages or high volume traffic. UniOne supports two different template engines. |
| Webhook | set, get, list, delete |
UniOne lets you recieve notifications about email status changes or spam blocks. You provide an URL and every time a watched event occurs we will notify you by submitting a request with JSON data to this URL. |
| Suppression | set, get, list, delete |
Methods for managing suppression lists. An email can be added to suppression list because of unsubscription, bounce or complain. |
| Domain | get_dns_records, validate_verification_record, validate_dkim, list, get_sandbox_domain, delete |
You can use these methods to setup sender domains and check their statuses. They might be useful in case you want to automate adding domains for your own clients. |
| EventDump | create, get, list, delete |
These methods are used to obtain a list of events for a given period of time. The data is stored for up to 45 days, depending on your tariff, i. e. you may fetch all event data starting from 00:00:00 31 days ago and up to current time. For custom tarifs with big sending volumes event dumps are available only for the last 7 days. |
| Tag | list, delete |
This family of methods is used to manage user-defined tags. Tags are used to categorize letters based on your own criteria, e. g. to create a distinction between marketing and transactional letters or group together all notifications for a particular order type. UniOne allows you to assign tags to all outgoing emails, and the tags you’ve set may then be used to filter and analyze delivery statistics. |
| Project | create, update, list, delete |
Projects allow you to group several independent domains, webhooks, templates, and unsubscription lists together. It's very useful if you have your own clients and manage their data from a single UniOne account. Each project receives its own API key, and all API calls with that API key only deal with the data of that project. This way, you can assign a separate project for each client and be sure that they won't conflict; e.g. unsubscribing from one project won't affect another. |
| System | ping, info |
System operations. |
| Obsolete | unsubscribed_set, unsubscribed_check, unsubscribed_list |
Obsolete methods dealing with unsubscribes. We recommend using the more flexible suppression methods instead. Note that you can't resubscribe an unsubscribed recipient using WebAPI, but you can send him an email with subscription link using email/subscribe method. |
Metadata
Release files for unione-sdk 1.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| unione_sdk-1.1.3.tar.gz | 51.4 kB | With provenance | Details for unione_sdk-1.1.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| unione_sdk-1.1.3-py3-none-any.whl | Python 3 | none | any | Details for unione_sdk-1.1.3-py3-none-any.whl |
Total release size: 119.0 kB
Release files / unione_sdk-1.1.3.tar.gz
| Download URL | unione_sdk-1.1.3.tar.gz |
|---|---|
| Size | 51.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
40515fa06f98442fed19d4e8d75645af75b605a1c5678dc950ff630699cfaa65
|
|
BLAKE2b-256 checksum How to use checksums |
96de0296f52b478f1d055b1fb784c4a2f8adcdf7f31ded25e587cfcf5a4fde25
|
| 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 logRelease files / unione_sdk-1.1.3-py3-none-any.whl
| Download URL | unione_sdk-1.1.3-py3-none-any.whl |
|---|---|
| Size | 67.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0fbb10493280b53b1c1be4d1720163c4dd32ad24d981ae94a1b6512fd2eb11d9
|
|
BLAKE2b-256 checksum How to use checksums |
324de8ec1ee75e2e074d0e5d7cc7491c0f46f7ef406ba7628adbda4ed5450e6f
|
| 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 logSecurity for unione-sdk 1.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.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for unione_sdk-1.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 logA 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.