Messaging

Send email

Send an email message to one or more recipients. Accepts: OrgBearerAuth (for admin users), ProjectBearerAuth (JWT for authenticated users), or ApiKeyAuth (X-API-Key for programmatic access). Both ProjectBearerAuth and ApiKeyAuth are fully implemented.

AuthJWT or API Key
GroupMessaging
Rate limitSee Rate Limits
POST/api/messaging/projects/{projectId}/messaging/email

SDK setup

Create a client and set credentials (JWT and/or API key) before calling the API. Match the authentication type shown above.

import { Configuration, MessagingApi } from 'mudbase-sdk';

const configuration = new Configuration({
  basePath: 'https://cloud.mudbase.dev',
  apiKey: 'sk_live_mudbase_doc_Xk9mP2qR7vN4wL8jH3tY6uE',
  accessToken: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJ1c3JfbW9yZ2FuX2RlIiwiZW1haWwiOiJtb3JnYW4uY2hlbkBub3J0aHdpbmQuZGV2IiwiZXhwIjoxODI1MTI5NjAwfQ.doc_preview_sig',
});
// This endpoint accepts either credential — apiKey or accessToken alone is enough.

const messaging = new MessagingApi(configuration);
import { Configuration, MessagingApi } from 'mudbase-sdk';

const configuration = new Configuration({
  basePath: 'https://cloud.mudbase.dev',
  apiKey: 'sk_live_mudbase_doc_Xk9mP2qR7vN4wL8jH3tY6uE',
  accessToken: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJ1c3JfbW9yZ2FuX2RlIiwiZW1haWwiOiJtb3JnYW4uY2hlbkBub3J0aHdpbmQuZGV2IiwiZXhwIjoxODI1MTI5NjAwfQ.doc_preview_sig',
});
// This endpoint accepts either credential — apiKey or accessToken alone is enough.

const messaging = new MessagingApi(configuration);

Example request

Call this endpoint using the client from SDK setup. Use View HTTP for a raw cURL example.

const { data: result } = await messaging.sendEmail(
  "proj_SfLoxLeJ17co",
  {
    to: "array quantify",
    subject: "capacitor override",
    html: "feed override",
    text: "pixel generate",
    templateId: "rDNQNNiiFRXGsj71",
    templateData: "card reboot"
  }
);
const { data: result } = await messaging.sendEmail(
  "proj_SfLoxLeJ17co",
  {
    to: "array quantify",
    subject: "capacitor override",
    html: "feed override",
    text: "pixel generate",
    templateId: "rDNQNNiiFRXGsj71",
    templateData: "card reboot"
  }
);

Playground

live

Test this endpoint with your own credentials. Your requests will be sent to the live API.

Get your API key from the console
Use the auth endpoints to obtain a JWT.

No Request Yet

Send a request to see the full inspector

Authentication

Requires JWT Requires API Key JWT or API Key
Note
This endpoint accepts either JWT Bearer token or API Key. Use Authorization: Bearer YOUR_TOKEN for user context, or X-API-Key: YOUR_KEY for server-to-server. View authentication guide →Include your JWT in the Authorization: Bearer YOUR_TOKEN header (user-facing apps, RBAC). View authentication guide →Include your API key in the X-API-Key: YOUR_KEY header (server-to-server, SDKs). View authentication guide →

Path Parameters

NameTypeRequiredDescription
projectIdstringYes

Request Body

json
{
  "to": "port back up",
  "subject": "hard drive program",
  "html": "array calculate",
  "text": "hard drive reboot",
  "templateId": "AScVSoKoVzbR28Ps",
  "templateData": {}
}
{
  "to": "port back up",
  "subject": "hard drive program",
  "html": "array calculate",
  "text": "hard drive reboot",
  "templateId": "AScVSoKoVzbR28Ps",
  "templateData": {}
}

Responses

201Email sent
json
{
  "success": true,
  "data": {
    "_id": "65a1b2c3d4e5f6789012345d",
    "type": "email",
    "status": "sent",
    "to": "user@example.com",
    "sentAt": "2024-01-15T10:00:00.000Z"
  }
}
{
  "success": true,
  "data": {
    "_id": "65a1b2c3d4e5f6789012345d",
    "type": "email",
    "status": "sent",
    "to": "user@example.com",
    "sentAt": "2024-01-15T10:00:00.000Z"
  }
}
403
429Per-project messaging send rate limit exceeded
json
{
  "success": true,
  "error": "messaging_rate_limited",
  "message": "Stylish Keyboard designed to make you stand out with lively looks"
}
{
  "success": true,
  "error": "messaging_rate_limited",
  "message": "Stylish Keyboard designed to make you stand out with lively looks"
}

Errors

CodeMeaning
403
429Per-project messaging send rate limit exceeded
Edit this page on GitHub