Installation
Get started with Sendmator in just a few steps. Choose your preferred method below.
Get Your API Key
- Sign up for a Sendmator account
- Navigate to your API settings
- Generate a new API key
- 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
| Parameter | Type | Required | Description |
|---|---|---|---|
channel | array | No | Communication channels to use. Options: ["email"], ["sms"], ["push"], ["whatsapp"], or combinations like ["email", "sms"]. Defaults to ["email"]. |
recipient_type | string | Yes | How to identify the recipient. Options: direct_email, direct_sms, direct_whatsapp, direct_push, contact, tag, segment, all. |
direct_email | string | Conditional | Recipient's email address. Required when recipient_type is direct_email. |
direct_phone | string | Conditional | Recipient's phone number in E.164 format (e.g., +1234567890). Required when recipient_type is direct_sms. |
direct_whatsapp | string | Conditional | Recipient's WhatsApp number in E.164 format. Required when recipient_type is direct_whatsapp. |
direct_device_token | string | Conditional | Device FCM token for push notifications. Required when recipient_type is direct_push. |
contact_external_id | string | Conditional | Contact's external ID from your system. Required when recipient_type is contact. |
tag | array | Conditional | Array of tag names (e.g., ["premium", "vip"]). Required when recipient_type is tag. |
segment_id | string | Conditional | Segment UUID. Required when recipient_type is segment. |
from_email | string | Yes | Verified sender email address (e.g., noreply@yourdomain.com). Must be verified in your Sendmator account. |
from_name | string | No | Sender's display name (e.g., Your App). Shows as the friendly name in email clients. |
subject | string | Conditional | Email subject line. Required when not using a template. |
content | string | Conditional | HTML or plain text email content. Required when not using a template. Supports variable substitution like {{contact_first_name}}. |
template_key | string | No | Template identifier to use instead of inline content. If provided, subject and content are loaded from the template. |
variables | object | No | Custom variables for template substitution (e.g., {"company": "Acme Corp", "discount": "20%"}). |
attachment_ids | array | No | Array of file UUIDs to attach to the email. Files must be uploaded first via the Files API. |
metadata | object | No | Custom metadata to store with the message (e.g., {"campaign_id": "summer-2024"}). |
message_category | string | No | Message category for queue routing. Options: transactional (OTP, alerts - priority queue) or promotional (marketing - normal queue). Defaults to transactional. |
triggerAt | string | No | Schedule 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 contactdirect_sms: Send SMS to a single phone numberdirect_whatsapp: Send WhatsApp message to a single numberdirect_push: Send push notification to a single devicecontact: Send to a stored contact using theirexternal_idtag: Send to all contacts with specific tagssegment: Send to all contacts in a segmentall: 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
- Authentication - Learn about API authentication
- Quick Start - Send your first email
- API Overview - Explore all available endpoints