Get started
Complete integration guide
From a provider-free Test sandbox to production activation and verified Live delivery webhooks.
1. Create a Test project
Create your workspace and a Test project in the dashboard. No verified domain, DNS access, mailbox or production activation is required. Test keeps the real admission, queue, log and webhook flow while replacing provider delivery with local simulation.
2. Create a server-side Test key
Create an email:send key in API Keys. Store the one-time secret privately as RAVENRELAY_API_KEY on your server. rr_test_ keys never send real mail. Each key allows 300 accepted requests per minute and 100,000 simulated emails per UTC month within the workspace's 500,000-email sandbox ceiling. Do not put keys in browser bundles, public repositories or agent prompts.
3. Send from your server
curl https://api.getravenrelay.com/v1/emails \ -H "Authorization: Bearer $RAVENRELAY_API_KEY" \ -H 'Content-Type: application/json' \ -H 'Idempotency-Key: welcome-user-123' \ -d '{ "from": "hello@example.com", "to": ["user@example.com"], "subject": "Welcome", "text": "Hello from RavenRelay" }'The placeholder addresses can be used unchanged in Test. A 202 response contains id, status and test_mode. queued means accepted for asynchronous simulation. Ordinary recipients finish as simulated; use the reserved sandbox scenario addresses from Send your first email for deterministic outcomes. Use one stable Idempotency-Key per logical send and exactly the same payload when retrying it. Keys are printable ASCII, at most 128 characters; reuse with a different payload returns idempotency_conflict.
4. Read outcomes
curl https://api.getravenrelay.com/v1/emails/EMAIL_ID -H "Authorization: Bearer $RAVENRELAY_API_KEY"GET /v1/emails accepts limit (1–100, default 50), cursor, status and recipient filters. Follow next_cursor until it is null. Recipient filtering matches To addresses. A send key reads emails it created; an email:read key reads its project. sent means the delivery provider accepted the message; delivered means the receiving mail server accepted it. Neither guarantees inbox placement. The read API omits bodies and BCC. Message bodies are retained for seven days.
5. Receive signed webhooks
Create a public HTTPS endpoint on port 443 in the dashboard and subscribe to the events your application needs. Store its one-time signing secret privately. Read the original request bytes before JSON middleware. Verify RavenRelay-Timestamp and RavenRelay-Signature using HMAC-SHA256 with the literal UTF-8 secret and timestamp + a dot + the raw body. Compare signatures in constant time and reject timestamps more than five minutes away from your clock. The signature format is v1=<hex>. Only then parse and process the event.
import { createHmac, timingSafeEqual } from "node:crypto";export async function verifiedEvent(request: Request, secret: string) { const timestamp = request.headers.get("RavenRelay-Timestamp") ?? ""; const signature = request.headers.get("RavenRelay-Signature") ?? ""; if (!/^\d+$/.test(timestamp) || Math.abs(Date.now() / 1000 - Number(timestamp)) > 300) throw new Error("Invalid timestamp"); if (!/^v1=[a-f0-9]{64}$/.test(signature)) throw new Error("Invalid signature"); const raw = Buffer.from(await request.arrayBuffer()); const expected = createHmac("sha256", secret).update(timestamp + ".").update(raw).digest(); const received = Buffer.from(signature.slice(3), "hex"); if (!timingSafeEqual(expected, received)) throw new Error("Invalid signature"); return JSON.parse(raw.toString("utf8"));}Deduplicate the verified payload id in durable storage and acknowledge with 2xx after committing it. RavenRelay-Event-Id carries the stable ID; retries and manual replays keep the same ID and body but use a fresh timestamp/signature. Events can arrive out of order. Non-2xx, timeouts and network failures retry after 1 minute, 5 minutes, 15 minutes, 1 hour, 6 hours and 24 hours: seven attempts total per delivery. Redirects are not followed. Test outcomes generate webhooks with data.test_mode=true and data.simulated=true; an ordinary Test send emits email.simulated.
6. Respect suppressions
Live hard bounces and spam complaints automatically block the recipient across the workspace. Owners and administrators can also add manual blocks. Any blocked Live To, CC or BCC recipient prevents the whole request from sending. Test scenarios never create or consult live suppressions: use bounced@sandbox.getravenrelay.com, complained@sandbox.getravenrelay.com or suppressed@sandbox.getravenrelay.com as the sole recipient to exercise those application paths safely.
7. Activate production
Request workspace activation and complete the administrator review. Create a Live project, connect and verify its sender domains, then create a rr_live_ key. Switch your server configuration to that key and project. Live recipient domains are unrestricted, subject to workspace activation, suppressions and provider rules. Keep Test and Live secrets separate.
8. Budget and handle errors
The Live allowance is 5,000 accepted Live emails per workspace per UTC month. The separate Test allowance is 500,000 simulated emails per workspace, with 100,000 per key. Each To, CC and BCC address counts as one email. Unlimited Live domains and no added branding are included. There is no RavenRelay daily quota, but request rate limits and delivery provider limits apply to Live. Usage shows both modes separately.
| Failure | Action |
|---|---|
401 invalid_api_key | Check server configuration and key revocation. |
403 forbidden / production_not_enabled | Check permissions and workspace activation. |
422 domain_not_verified / validation_error | For Live, verify the exact project sender domain. In Test, use a scenario address only as the sole recipient. |
409 idempotency_conflict | Keep the payload unchanged or create a key for a genuinely new send. |
429 rate_limit_exceeded | Wait the number of seconds in the message and retry with the same idempotency key. |
429 quota_exceeded | Check the key and workspace monthly allowances; wait for the UTC reset or contact support. |
413 message_too_large | Keep the complete JSON request within 10 MiB. More than 50 total recipients returns validation_error. |