API Docs
Dokumentasi lengkap untuk dashboard API, public API, dan inbound endpoint dari Cloudflare Worker.
Base URLs
Authentication
`/api/inbound-email` memakai `Authorization: Bearer INBOUND_EMAIL_SECRET`.
Public API memakai Bearer API key dari tabel `api_keys`.
Dashboard API memakai session login dashboard.
Public Permissions
`addresses:create` untuk membuat random atau custom email dari platform lain.
`emails:read` untuk membaca messages, latest message, dan latest OTP.
Cloudflare Worker Env
INBOUND_API_URL=https://mail.siapdigital.web.id/api/inbound-email INBOUND_EMAIL_SECRET=<same value as Next.js> VERCEL_AUTOMATION_BYPASS_SECRET=<optional if deployment protection is enabled>
Jika project Vercel memakai Deployment Protection, Worker harus mengirim header x-vercel-protection-bypass dengan secret automation bypass dari Vercel.
Inbound Endpoint
{
"message_id": "<message-id>",
"from_email": "sender@example.com",
"from_name": "Sender Name",
"to_email": "lead@siapdigital.web.id",
"subject": "Test Email",
"text_body": "Hello from email",
"html_body": "<p>Hello from email</p>",
"raw_headers": {},
"raw_payload": {},
"attachments": []
}curl -X POST "https://mail.siapdigital.web.id/api/inbound-email" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer INBOUND_EMAIL_SECRET" \
-d '{
"message_id": "<message-id>",
"from_email": "sender@example.com",
"from_name": "Sender Name",
"to_email": "lead@siapdigital.web.id",
"subject": "Test Email",
"text_body": "Hello from email",
"html_body": "<p>Hello from email</p>",
"raw_headers": {},
"raw_payload": {}
}'{
"success": true,
"email_id": "uuid"
}Public API
curl -X POST "https://mail.siapdigital.web.id/api/public/email-addresses" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"local_part": "support-project-a",
"project": "project-a",
"label": "Support Project A",
"purpose": "Fixed address for support testing"
}'{
"email_address": {
"id": "uuid",
"email": "support-project-a@siapdigital.web.id",
"local_part": "support-project-a",
"label": "Support Project A",
"project": "project-a",
"status": "active",
"created_at": "2026-05-13T10:00:00Z"
}
}curl -X POST "https://mail.siapdigital.web.id/api/public/email-addresses/random" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prefix": "otp-test",
"project": "automation-tool",
"label": "OTP Test"
}'{
"email": "otptest42@siapdigital.web.id"
}curl "https://mail.siapdigital.web.id/api/public/email-addresses/otptest42@siapdigital.web.id/messages" \ -H "Authorization: Bearer YOUR_API_KEY"
{
"messages": [
{
"id": "uuid",
"from_email": "noreply@example.com",
"from_name": "No Reply",
"subject": "Verify your email",
"text_body": "Click the button below",
"html_body": "<a href=\"https://example.com\">Verify</a>",
"received_at": "2026-05-13T10:00:00Z",
"status": "unread"
}
]
}curl "https://mail.siapdigital.web.id/api/public/email-addresses/otptest42@siapdigital.web.id/latest" \ -H "Authorization: Bearer YOUR_API_KEY"
{
"message": {
"id": "uuid",
"subject": "Your OTP Code",
"text_body": "Your code is 123456",
"html_body": "<p>Your code is <b>123456</b></p>",
"received_at": "2026-05-13T10:00:00Z",
"from_email": "noreply@example.com",
"from_name": null,
"status": "unread"
}
}curl "https://mail.siapdigital.web.id/api/public/email-addresses/otptest42@siapdigital.web.id/latest-otp" \ -H "Authorization: Bearer YOUR_API_KEY"
{
"otp": "123456",
"source_message_id": "uuid",
"received_at": "2026-05-13T10:00:00Z"
}curl "https://mail.siapdigital.web.id/api/public/email-addresses/otptest42@siapdigital.web.id/latest-links" \ -H "Authorization: Bearer YOUR_API_KEY"
{
"message_id": "uuid",
"subject": "Verify your email",
"received_at": "2026-05-13T10:00:00Z",
"links": [
{
"url": "https://example.com/verify?token=abc",
"text": "Verify Email"
}
]
}curl "https://mail.siapdigital.web.id/api/public/email-addresses/otptest42@siapdigital.web.id/latest-primary-link" \ -H "Authorization: Bearer YOUR_API_KEY"
{
"message_id": "uuid",
"subject": "Verify your email",
"received_at": "2026-05-13T10:00:00Z",
"link": {
"url": "https://example.com/verify?token=abc",
"text": "Verify Email"
}
}Dashboard API
`POST /api/email-addresses/random` untuk create random address dari dashboard.
`POST /api/email-addresses` untuk create custom address.
`GET /api/email-addresses` untuk list seluruh address.
`GET /api/email-addresses/:id/messages` untuk list messages per address.
`GET /api/emails/:id` dan `PATCH /api/emails/:id` untuk detail dan update status/label.
`GET /api/api-keys`, `POST /api/api-keys`, `PATCH /api/api-keys/:id` untuk manajemen API key.