RimbraDocs

The Emails API

Create a key and send email from your server.

Create a key

  1. 1Open Emails → API Keys and choose Create key.
  2. 2Name it after the app that uses it, like Checkout service.
  3. 3Pick the access: Send only for apps that just send, Full access for tools that also read the log, Read only for dashboards.
  4. 4Pick Live to deliver, or Test to log emails without delivering them while you build.
  5. 5Copy the key. It is shown once.

Send an email

POST https://api.rimbra.app/api/marketing/emails/send with your key as a Bearer token.

javascript
const res = await fetch("https://api.rimbra.app/api/marketing/emails/send", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.RIMBRA_EMAILS_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    from: "Yourcompany <receipts@yourcompany.com>",
    to: ["ada@example.com"],
    subject: "Your receipt",
    html: "<p>Thanks for your order.</p>",
    text: "Thanks for your order.",
  }),
})
const message = await res.json() // { id, status: "queued", ... }

Fields

FieldRequiredNotes
fromYesAn address at a verified domain. "Name <address>" works too
toYesOne address, or an array of addresses
subjectYes, unless template_idUp to 998 characters
html or textOne of them, unless template_idSend both for the best inbox placement
template_idNoSend a saved template instead of subject and body
variablesWith template_idValues for the template’s {{variables}}

Responses

CodeMeaning
202Accepted and queued. Follow it in the email log
400A field is missing or invalid
401The key is missing, wrong or revoked
403The key is read only
422Test key, unverified from address, unknown template or missing variable
429Over 60 sends per minute for this key