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
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 works with any programming language. 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 '{
"channel": ["email"],
"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
channelarrayNoCommunication channels to use. Options: ["email"], ["sms"], ["push"], ["whatsapp"], or combinations like ["email", "sms"]. Defaults to ["email"].
recipient_typestringYesHow to identify the recipient. Options: direct_email, direct_sms, direct_whatsapp, direct_push, contact, tag, segment, all.
direct_emailstringConditionalRecipient's email address. Required when recipient_type is direct_email.
direct_phonestringConditionalRecipient's phone number in E.164 format (e.g., +1234567890). Required when recipient_type is direct_sms.
direct_whatsappstringConditionalRecipient's WhatsApp number in E.164 format. Required when recipient_type is direct_whatsapp.
direct_device_tokenstringConditionalDevice FCM token for push notifications. Required when recipient_type is direct_push.
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

  • direct_email: Send to a single email address without storing as a contact
  • direct_sms: Send SMS to a single phone number
  • direct_whatsapp: Send WhatsApp message to a single number
  • direct_push: Send push notification to a single device
  • 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

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

Next Steps