Skip to main content
POST
https://api-dev.weir.ai/
/
console
/
mail
/
send
curl -X POST 'https://api.weir.ai/console/mail/send' \
  -H 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
  -H 'Content-Type: application/json' \
  -H 'x-source: console' \
  -d '{
    "to": "[email protected]",
    "subject": "Welcome to the team",
    "body": "Welcome message...",
    "templateId": "tpl_123456789"
  }'
{
  "data": {
    "emailId": "email_123456789",
    "to": "[email protected]",
    "status": "sent",
    "sentAt": "2024-01-22T15:30:00Z"
  },
  "message": "Email sent successfully",
  "status": "success"
}

Send Email

Send email notifications to users from your organization.
curl -X POST 'https://api.weir.ai/console/mail/send' \
  -H 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
  -H 'Content-Type: application/json' \
  -H 'x-source: console' \
  -d '{
    "to": "[email protected]",
    "subject": "Welcome to the team",
    "body": "Welcome message...",
    "templateId": "tpl_123456789"
  }'
{
  "data": {
    "emailId": "email_123456789",
    "to": "[email protected]",
    "status": "sent",
    "sentAt": "2024-01-22T15:30:00Z"
  },
  "message": "Email sent successfully",
  "status": "success"
}

Request Body

to
string
required
Recipient email address.
subject
string
required
Email subject line.
body
string
Email body content (plain text or HTML).
templateId
string
Email template ID to use (optional).

Usage Examples

const sendEmail = async (emailData, accessToken) => {
  const response = await fetch('https://api.weir.ai/console/mail/send', {
    method: 'POST',
    headers: {
      'Authorization': `Bearer ${accessToken}`,
      'Content-Type': 'application/json',
      'x-source': 'console'
    },
    body: JSON.stringify(emailData)
  });
  if (!response.ok) throw new Error(`HTTP error! status: ${response.status}`);
  return await response.json();
};