Documentation Index
Fetch the complete documentation index at: https://docs.ub.bitbros.in/llms.txt
Use this file to discover all available pages before exploring further.
POST /api/mail/send
Sends transactional email from your project.
For the complete Mail Platform documentation (BYOK, batch sending, logs, audiences, contacts, broadcasts, webhooks, and dashboard workflows), see Mail Platform guide.
Required headers
| Header | Value |
|---|---|
x-api-key | Your sk_live_... secret key |
Content-Type | application/json |
Request body
Recipient email address.
Required in direct mode.
Optional HTML body. In direct mode, provide at least one of
html or text.Optional text body. In direct mode, provide at least one of
html or text.Template ObjectId (24 hex chars). Use either
templateId or templateName.Template key or name. Use either
templateId or templateName.Optional template variables.
Validation rules
- Template mode:
templateIdortemplateName - Direct mode:
subject+ (htmlortext) - Do not pass both
templateIdandtemplateName. - If rendered subject/body becomes empty after variable interpolation, request is rejected with
400.
Template resolution order
When usingtemplateName, urBackend resolves in this order:
- Project template override
- Global/system template
- Legacy embedded template fallback (older projects only)
Placeholder syntax
- Escaped:
{{name}} - Raw:
{{{htmlSnippet}}}(use carefully) - Nested:
{{user.name}}
{{appUrl}}. URL-like variables are sanitized to safe http/https values.
How to use
Get your Secret Key
Log in to the urBackend Dashboard, create a new project, and copy your Secret Key (
sk_live_...) or you can get it from rotating it from project overview page.Copy the Code
Copy your preferred language snippet from below. Use Direct Mode if you just want to send a quick HTML/Text email without setting up templates or use welcome template for fast test.
The Java examples use the native
java.net.http.HttpClient (requires Java 11+) and Text Blocks for JSON formatting (requires Java 15+).Success response
Errors
| Status | Cause |
|---|---|
400 Bad Request | Invalid payload, invalid template ID, or empty rendered subject/body |
401 Unauthorized | Missing project context |
403 Forbidden | Non-secret key used |
404 Not Found | Template or project not found |
429 Too Many Requests | Monthly mail limit exceeded |
