Skip to content
Splashify Pro
Email docsEmail

Python Quickstart

bash
pip install requests
export SPLASHIFY_API_KEY="pk_live_..."
python
import os, requests

r = requests.post(
    "https://api.splashifypro.com/api/v1/partner/email/send",
    headers={
        "Authorization": f"Bearer {os.environ['SPLASHIFY_API_KEY']}",
        "Content-Type": "application/json",
    },
    json={
        "from": "[email protected]",
        "to": ["[email protected]"],
        "subject": "Welcome to our app",
        "html_body": "<h1>Welcome 👋</h1>",
        "text_body": "Welcome.",
    },
)
r.raise_for_status()
print(r.json()["results"][0]["message_id"])

Handling errors

python
if not r.ok:
    err = r.json()
    raise RuntimeError(f"{err['error']}: {err['message']}")

Async (httpx)

python
import httpx, asyncio

async def send():
    async with httpx.AsyncClient() as c:
        r = await c.post(
            "https://api.splashifypro.com/api/v1/partner/email/send",
            headers={"Authorization": f"Bearer {API_KEY}"},
            json={...},
        )
        return r.json()

asyncio.run(send())

What's next