Python email API
Send email from Python in one HTTP call.
No SDK to install and no mail server to run. Aslio is a plain REST endpoint, so requests — or httpx, or the standard library — is all you need; there is no Aslio SDK to install. You pay ₹0.02 a message — about $0.21 per 1,000 emails, with no monthly platform fee, no per-seat charge and no minimum commitment.
In short
To send transactional email from Python, POST to `https://aslio.asli.one/v1/email/send` with an Authorization: Bearer API key and a JSON body containing from, to, subject and html. Aslio charges ₹0.02 a message — about $0.21 per 1,000 — with no monthly fee. Add an Idempotency-Key header and the request is safe to retry.
Facts and prices last checked .
- $0.21
- per 1,000 emails
- ₹0
- monthly platform fee
- 0
- seats to buy
- 587
- SMTP relay, same price
Code
Sending one email from Python
The example uses requests, but any HTTP client works: there is no SDK and no vendor package in your dependency tree. The from address must be on a domain you have verified, so the message is signed with your own DKIM rather than a shared pool.
import os
import requests
res = requests.post(
"https://aslio.asli.one/v1/email/send",
headers={
"Authorization": f"Bearer {os.environ['ASLIO_API_KEY']}",
# Safe to retry: a duplicate replays the original response.
"Idempotency-Key": f"invoice-{invoice_id}",
},
json={
"from": "Acme <billing@acme.com>",
"to": ["customer@example.com"],
"subject": "Your invoice is ready",
"html": "<p>Hello — your invoice is attached.</p>",
"statusCallbackUrl": "https://acme.com/hooks/aslio",
},
timeout=10,
)
res.raise_for_status()
message = res.json()Code
Receiving delivery events in Flask
Aslio posts SENT, DELIVERED, BOUNCED, COMPLAINED and FAILED events to your statusCallbackUrl. Read request.get_data() rather than request.json, so you verify the bytes exactly as they arrived. In Django the equivalent is request.body.
import hashlib
import hmac
import json
import os
import time
from flask import Flask, abort, request
app = Flask(__name__)
@app.post("/hooks/aslio")
def aslio_hook():
raw = request.get_data()
timestamp = request.headers.get("X-Aslio-Timestamp", "")
signature = request.headers.get("X-Aslio-Signature", "")
expected = hmac.new(
os.environ["ASLIO_WEBHOOK_SECRET"].encode(),
timestamp.encode() + b"." + raw,
hashlib.sha256,
).hexdigest()
if not hmac.compare_digest(expected, signature):
abort(401)
# The timestamp is in milliseconds. Refuse anything older than five minutes.
if not timestamp.isdigit() or abs(time.time() * 1000 - int(timestamp)) > 300_000:
abort(401)
event = json.loads(raw)
if event["status"] == "BOUNCED":
mark_address_bad(event["toAddress"])
return "", 200Code
Sending to a list
The same key and the same wallet. Merge variables are per recipient.
POST /v1/email/send-batch
{
"from": "Acme <news@acme.com>",
"subject": "Hi {{firstName}}, your invoice is due",
"html": "<p>Hi {{firstName}} — {{plan}}</p>",
"recipients": [
{ "email": "priya@example.com",
"variables": { "firstName": "Priya", "plan": "Pro" } }
]
}
// Up to 1,000 recipients per call. Each gets its own message
// row, its own charge and its own unsubscribe link. Suppressed
// addresses are skipped and reported, never silently dropped.What you get
Common problems when sending from Python
What usually goes wrong in this language, and what to do about it.
requests never times out by default
Always pass timeout=10. Without it, one stalled connection can hang a web worker indefinitely.
Blocking a Django or Flask request
Send from Celery or RQ so a slow network call does not hold up the page. Put the Idempotency-Key in the task arguments so every retry reuses it.
Celery retries that send twice
This happens when the key is generated inside the task. Derive it from your own record, such as invoice-1042, so it is identical on each attempt.
Async applications
In FastAPI, use httpx.AsyncClient rather than requests, which would block the event loop. The URL, headers and JSON body do not change.
Honestly
Before you pick this
- We hold no SOC 2 report and no ISO 27001 certification. If your procurement requires one, we will not pass it today and would rather say so now.
- SMS and WhatsApp are still in build. Email is the channel that ships today. Do not pick Aslio this week for a multi-channel launch next week.
- Support runs 09:30–18:30 IST (UTC+5:30). That overlaps European and Gulf afternoons and the edges of the North American day. There is no 24/7 desk.
- We are a young, small company — Asli One Global was incorporated in February 2026. That is a legitimate thing to weigh for a critical dependency.
FAQ
Frequently asked questions
How do I send an email from Python?
POST to https://aslio.asli.one/v1/email/send with an Authorization: Bearer header carrying your API key, and a JSON body of from, to, subject and html. The example uses requests, but any HTTP client works: there is no SDK and no vendor package in your dependency tree. The full example is above.
Do I need to install a package?
No. Aslio is a plain REST API, so requests — or httpx, or the standard library — is all you need; there is no Aslio SDK to install. There is no SDK to keep up to date and no dependency to audit.
Does it work with FastAPI and asyncio?
Yes. Aslio is plain HTTPS and JSON, so use httpx.AsyncClient with the same URL, headers and body as the example above.
Can I use Django's email backend?
Yes. Set EMAIL_HOST to aslio.asli.one, EMAIL_PORT to 587, EMAIL_USE_TLS to True and EMAIL_HOST_PASSWORD to your API key. Existing send_mail calls keep working.
How much does it cost?
₹0.02 per email, which is roughly $0.21 per 1,000 messages, with no monthly platform fee, no per-seat charge and no minimum commitment. You top up a prepaid wallet and spend it down. An optional Pro plan at ₹999 a month raises the API rate limit to 100 requests a second and adds priority support.
Send your first Python email in ten minutes.
Top up a wallet and send. No monthly platform fee, no seat charge, no minimum commitment — a hundred test emails costs about two rupees.
Asli One Global Private Limited · CIN U62011TN2026PTC190105