Skip to main content

vaartix

Official Python SDK for Vaartix, the email API for Indian developers.

Vaartix is in private beta. Request early access.

pip install vaartix

Python 3.10 or newer. No dependencies.

Send an email

from vaartix import Vaartix

vaartix = Vaartix()  # reads the VAARTIX_API_KEY environment variable

email = vaartix.emails.send(
    {
        "from": "Acme <onboarding@acme.in>",
        "to": ["priya@example.com"],
        "subject": "Hello from Vaartix",
        "html": "<strong>It works!</strong>",
    }
)
print(email["id"])  # em_...

Emails are plain dicts because from is a Python keyword. Keys can be snake_case (reply_to, scheduled_at) or the API's camelCase (replyTo, scheduledAt). Responses are the API's JSON as dicts, exactly as in the API reference.

# Retry safely: the same key within 24 hours returns the first email instead of sending twice.
vaartix.emails.send(email, idempotency_key=f"welcome-{user.id}")

# Send later (up to 30 days ahead), and cancel if plans change.
scheduled = vaartix.emails.send({**email, "scheduled_at": "2026-11-01T09:00:00+05:30"})
vaartix.emails.cancel(scheduled["id"])

# Up to 100 emails in one request.
vaartix.batch.send([email_1, email_2])

# Look up an email and its delivery events, or list recent bounces.
vaartix.emails.get("em_...")
vaartix.emails.list(status="bounced", days=7)

# Try it without a domain: test addresses simulate delivery, bounces and complaints.
vaartix.emails.send(
    {
        "from": "onboarding@test.vaartix.com",
        "to": "delivered@test.vaartix.com",
        "subject": "Hello",
        "text": "It works!",
    }
)

Django

Send all of Django's email through Vaartix, including send_mail, EmailMessage and built-in emails such as password resets:

pip install "vaartix[django]"
# settings.py
VAARTIX_API_KEY = os.environ["VAARTIX_API_KEY"]
DEFAULT_FROM_EMAIL = "Acme <noreply@acme.in>"  # on a domain verified in Vaartix

# Django 6.1 and newer
MAILERS = {"default": {"BACKEND": "vaartix.django.EmailBackend"}}
# Django 4.2 to 6.0
EMAIL_BACKEND = "vaartix.django.EmailBackend"

With MAILERS you can also pass the key as an option instead: {"BACKEND": "vaartix.django.EmailBackend", "OPTIONS": {"api_key": "vx_live_..."}}.

from django.core.mail import EmailMultiAlternatives

message = EmailMultiAlternatives("Order confirmed", "Thanks!", to=["priya@example.com"])
message.attach_alternative("<p>Thanks!</p>", "text/html")
message.tags = [{"name": "type", "value": "order"}]  # optional
message.send()
print(message.vaartix_id)  # em_...

HTML alternatives, attachments, inline images (Content-ID), cc, bcc, reply-to and custom headers are all supported. Errors raise VaartixError unless you pass fail_silently=True.

Errors

API and network errors raise VaartixError:

from vaartix import VaartixError

try:
    vaartix.emails.send(email)
except VaartixError as err:
    print(err.type, err.status_code, err.message)  # e.g. rate_limited 429 Too many requests...

err.type is a stable code; the full list is in Errors. Network failures have type == "network_error" and status_code is None.

Webhooks

Check that a webhook request really came from Vaartix before trusting it. Pass the raw body.

import os

from flask import Flask, request
from vaartix import verify_webhook, WebhookVerificationError

app = Flask(__name__)


@app.post("/webhooks/vaartix")
def vaartix_webhook():
    try:
        event = verify_webhook(
            request.get_data(),  # raw bytes, not request.json
            request.headers,
            os.environ["VAARTIX_WEBHOOK_SECRET"],
        )
    except WebhookVerificationError:
        return "", 400
    if event["type"] == "email.bounced":
        ...  # stop emailing event["data"]["recipient"]
    return "", 200

In Django use request.body and request.headers. Signatures follow the Standard Webhooks spec.

Manage endpoints with vaartix.webhooks.create(url=..., events=[...]), list(), get(), update(), remove(), rotate_secret(), deliveries() and retry_delivery().

Docs

Full API reference and guides: vaartix.com/docs.

Contributing and security

Issues and pull requests are welcome: see CONTRIBUTING.md. Please report security problems privately as described in SECURITY.md.

License

MIT

Metadata

Release files for vaartix 0.2.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 vaartix 0.2.0
File Size Uploaded Provenance Actions
vaartix-0.2.0.tar.gz 13.8 kB With provenance Details for vaartix-0.2.0.tar.gz

Built distribution (wheel)

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

Total release size: 26.6 kB

Release files / vaartix-0.2.0.tar.gz

Download URL vaartix-0.2.0.tar.gz
Size 13.8 kB
Tags Source
SHA-256 checksum
How to use checksums
9c117259b91cb6047c54d1a25a17433fa29821d1110a4954c819c6d7af2167a0
BLAKE2b-256 checksum
How to use checksums
ee92c3395bf01dccb8775913d95286e86940761b526dbea9cbe138e1cf1bce11
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 29, 2026.

Transparency log

Release files / vaartix-0.2.0-py3-none-any.whl

Download URL vaartix-0.2.0-py3-none-any.whl
Size 12.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f6838e9eca0e59c45aa3cd88afa46e33fb6da0efc758cbbcc58bea08815a1be6
BLAKE2b-256 checksum
How to use checksums
81173cac580f8bfdfce98b1136f8641f708b62aecc1f0566a63191e3b93f2586
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 29, 2026.

Transparency log

Security for vaartix 0.2.0

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

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for vaartix-0.2.0.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 29, 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