Skip to main content

Installation

Get started with Sendmator in just a few steps. Choose your preferred method below.

Get Your API Key

  1. Sign up for a Sendmator account
  2. Navigate to your API settings
  3. Generate a new API key
  4. Keep your API key secure - never expose it in client-side code. If you want to use in client-side projects, create a publishable key instead (limited permissions - can manage contacts and preferences but cannot trigger messages).
Security

Your API key provides full access to your Sendmator account. Keep it secure and never commit it to version control.

Using the REST API

Sendmator provides a REST API that can be called from any programming language that supports HTTP requests. No SDK installation required - just make HTTP requests to our endpoints.

Example API Call

Here's how to send your first email:

curl -X POST https://api.sendmator.com/api/v1/messages/send \
-H "X-API-KEY: your-api-key" \
-H "Content-Type: application/json" \
-d '{
"recipient_type": "direct_email",
"direct_email": "user@example.com",
"from_email": "noreply@yourdomain.com",
"from_name": "Your App",
"subject": "Hello from Sendmator",
"content": "<h1>Hello World!</h1><p>Welcome to Sendmator!</p>"
}'

Request Parameters

ParameterTypeRequiredDescription
recipient_typestringYesHow to identify the recipient. Options: direct_email, contact, tag, segment, all.
direct_emailstringConditionalRecipient's email address. Required when recipient_type is direct_email.
contact_external_idstringConditionalContact's external ID from your system. Required when recipient_type is contact.
tagarrayConditionalArray of tag names (e.g., ["premium", "vip"]). Required when recipient_type is tag.
segment_idstringConditionalSegment UUID. Required when recipient_type is segment.
from_emailstringYesVerified sender email address (e.g., noreply@yourdomain.com). Must be verified in your Sendmator account.
from_namestringNoSender's display name (e.g., Your App). Shows as the friendly name in email clients.
subjectstringConditionalEmail subject line. Required when not using a template.
contentstringConditionalHTML or plain text email content. Required when not using a template. Supports variable substitution like {{contact_first_name}}.
template_keystringNoTemplate identifier to use instead of inline content. If provided, subject and content are loaded from the template.
variablesobjectNoCustom variables for template substitution (e.g., {"company": "Acme Corp", "discount": "20%"}).
attachment_idsarrayNoArray of file UUIDs to attach to the email. Files must be uploaded first via the Files API.
metadataobjectNoCustom metadata to store with the message (e.g., {"campaign_id": "summer-2024"}).
message_categorystringNoMessage category for queue routing. Options: transactional (OTP, alerts - priority queue) or promotional (marketing - normal queue). Defaults to transactional.
triggerAtstringNoSchedule message for future delivery. ISO 8601 timestamp (e.g., 2024-12-01T10:00:00Z).

Recipient Types Explained

  • contact: Send to a stored contact using their external_id
  • tag: Send to all contacts with specific tags
  • segment: Send to all contacts in a segment
  • all: Send to all active contacts
  • direct_email: Send to a single email address without storing as a contact
  • direct_sms: Send to a single phone number without storing as a contact
  • direct_whatsapp: Send to a single WhatsApp number without storing as a contact
  • direct_push: Send to a single device token without storing as a contact

Response

Success Response (201 Created):

{
"success": true,
"trigger_id": "550e8400-e29b-41d4-a716-446655440000",
"job_id": "660f9511-f39c-52e5-b827-557766551111",
"message": "Message queued successfully"
}

Error Response (400 Bad Request):

{
"statusCode": 400,
"message": [
"from_email must be an email",
"direct_email is required when not using template_key"
],
"error": "Bad Request"
}

Error Response (401 Unauthorized):

{
"statusCode": 401,
"message": "Unauthorized",
"error": "Unauthorized"
}

Environment Variables

For security, we recommend storing your API key in environment variables:

# .env file
SENDMATOR_API_KEY=your-api-key-here

Multi-Channel Messages

The /messages/send endpoint is for email-only messages. To send messages across multiple channels (Email, SMS, WhatsApp, Push) simultaneously, use the Multi-Channel Trigger API.

Next Steps