Quickstart
This guide walks you through sending your first email with the RelayPost REST API.
Prerequisites
Section titled “Prerequisites”- A RelayPost account — sign up free
- A domain you control (for production sending)
1. Create an organization
Section titled “1. Create an organization”After signing up, you’ll be prompted to create an organization. This is your workspace — all API keys, domains, and emails are scoped to it.
2. Generate an API key
Section titled “2. Generate an API key”Go to Settings → API Keys and create a new key. Copy it immediately — it’s only shown once.
Your key looks like: rp_live_aBcDeFgHiJkLmNoPqRsT...
3. Send your first email
Section titled “3. Send your first email”curl -X POST https://relaypost.dev/api/v1/emails/send \ -H "Content-Type: application/json" \ -H "Authorization: Bearer YOUR_API_KEY" \ -d '{ "from": { "email": "[email protected]", "name": "Your App" }, "to": [{ "email": "[email protected]" }], "subject": "Hello from RelayPost", "html": "<h1>It works!</h1><p>Your email delivery is set up.</p>" }'const response = await fetch("https://relaypost.dev/api/v1/emails/send", { method: "POST", headers: { "Content-Type": "application/json", Authorization: "Bearer YOUR_API_KEY", }, body: JSON.stringify({ subject: "Hello from RelayPost", html: "<h1>It works!</h1><p>Your email delivery is set up.</p>", }),});
const result = await response.json();console.log(result.data.message_id);import requests
response = requests.post( "https://relaypost.dev/api/v1/emails/send", headers={ "Content-Type": "application/json", "Authorization": "Bearer YOUR_API_KEY", }, json={ "subject": "Hello from RelayPost", "html": "<h1>It works!</h1><p>Your email delivery is set up.</p>", },)
result = response.json()print(result["data"]["message_id"])4. Check the response
Section titled “4. Check the response”A successful send returns:
{ "data": { "message_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890", "status": "queued", "queued_at": "2025-01-15T10:30:00.000Z" }}What’s next
Section titled “What’s next”- Verify your domain for better inbox placement
- Set up webhooks to track delivery events
- Create templates for reusable email layouts
- Send via SMTP if your app uses SMTP