API Guide
Overview
Section titled “Overview”The Kirim.Email SMTP API provides programmatic access to email sending, domain management, credentials, logs, and more. All API requests are made over HTTPS to https://smtp-app.kirim.email.
Authentication
Section titled “Authentication”All API requests require Basic Authentication with your API credentials. Your username serves as username, and the API key serves as password.
curl -X GET "https://smtp-app.kirim.email/api/domains" \ -u "username:your-api-key"Replace your-api-key with your actual API key from the dashboard.
Base URL
Section titled “Base URL”All API endpoints are relative to:
https://smtp-app.kirim.emailDomains
Section titled “Domains”List Your Domains
Section titled “List Your Domains”Retrieve all domains associated with your account.
curl -X GET "https://smtp-app.kirim.email/api/domains" \ -u "username:your-api-key"Response:
{ "success": true, "data": [ { "id": "dm_xxxxx", "domain": "example.com", "status": "verified", "created_at": "2024-01-15T10:30:00Z" } ]}Create a Domain
Section titled “Create a Domain”Add a new domain to your account.
curl -X POST "https://smtp-app.kirim.email/api/domains" \ -u "username:your-api-key" \ -H "Content-Type: application/json" \ -d '{"domain": "example.com"}'Verify Domain DNS
Section titled “Verify Domain DNS”After creating a domain, you need to verify your DNS records:
# Verify mandatory DNS records (SPF, DKIM, MX)curl -X POST "https://smtp-app.kirim.email/api/domains/example.com/verify-mx" \ -u "username:your-api-key"
# Setup and verify authentication domain (SPF, DKIM)curl -X POST "https://smtp-app.kirim.email/api/domains/example.com/setup-auth" \ -u "username:your-api-key"
# Setup and verify tracking domain (CNAME for click/open tracking)curl -X POST "https://smtp-app.kirim.email/api/domains/example.com/setup-tracking" \ -u "username:your-api-key"Credentials
Section titled “Credentials”SMTP credentials allow you to send emails through specific domains.
List Credentials
Section titled “List Credentials”curl -X GET "https://smtp-app.kirim.email/api/domains/example.com/credentials" \ -u "username:your-api-key"Create a Credential
Section titled “Create a Credential”curl -X POST "https://smtp-app.kirim.email/api/domains/example.com/credentials" \ -u "username:your-api-key" \ -H "Content-Type: application/json" \ -d '{"name": "My Application"}'Response:
{ "success": true, "data": { "id": "cred_xxxxx", "name": "My Application", "username": "smtp_xxxxx", "password": "generated-password-here", "created_at": "2024-01-15T10:30:00Z" }}Important: Save the password immediately - it won’t be shown again.
Reset Credential Password
Section titled “Reset Credential Password”curl -X POST "https://smtp-app.kirim.email/api/domains/example.com/credentials/cred_xxxxx/reset-password" \ -u "username:your-api-key"Sending Email (Message)
Section titled “Sending Email (Message)”All message endpoints send as multipart/form-data and respond with 202 Accepted because delivery is processed asynchronously. Authenticate with your username + API token (-u "username:your-api-key"). The from address must belong to the domain in the path, and the domain must be verified with SMTP credentials configured.
Send with Direct Content
Section titled “Send with Direct Content”POST /api/domains/{domain}/message — required fields: from, to, subject, text.
curl -X POST "https://smtp-app.kirim.email/api/domains/example.com/message" \ -u "username:your-api-key" \ -F "from=noreply@example.com" \ -F "from_name=Company Name" \ -F "to=customer@clientdomain.com" \ -F "subject=Your Order Confirmation - #12345" \ -F "text=Thank you for your order #12345. Tracking info will follow." \ -F "html=<html><body><h2>Order Confirmation</h2><p>Thank you for your order.</p></body></html>" \ -F "reply_to=support@example.com"Optional fields:
| Field | Description |
|---|---|
from_name |
Sender display name |
html |
HTML body (plain text is always required as fallback) |
headers |
Custom headers as object or JSON string (e.g. X-Tags for log filtering, List-Unsubscribe) |
reply_to |
Must share the same top-level domain as from |
to |
Single email string or array of up to 1000 recipients for bulk sending |
attachments |
Single file or array (max 10 files, 20 MB each, 25 MB total payload) |
attachment_options |
JSON string: compress, password, watermark.enabled/text (watermark text max 50 chars) |
Success response (202):
{ "success": true, "message": "Email send jobs dispatched for 5 recipients in 1 job(s) with 2 attachment(s)", "messages": [ { "to": "user@example.com", "message_guid": "0193f3c4-..." } ]}Send with Attachments
Section titled “Send with Attachments”curl -X POST "https://smtp-app.kirim.email/api/domains/example.com/message" \ -u "username:your-api-key" \ -F "from=noreply@example.com" \ -F "to=customer@clientdomain.com" \ -F "subject=Hello with Attachment" \ -F "text=Please see the attached file." \ -F "attachments=@/path/to/file.pdf" \ -F 'attachment_options={"compress": true, "password": "SecureDoc2024", "watermark": {"enabled": true, "text": "CONFIDENTIAL", "position": "center"}}'Send Bulk Email
Section titled “Send Bulk Email”Pass to multiple times (or as an array) — up to 1000 recipients per request:
curl -X POST "https://smtp-app.kirim.email/api/domains/example.com/message" \ -u "username:your-api-key" \ -F "from=noreply@example.com" \ -F "to=customer1@clientdomain.com" \ -F "to=customer2@anotherdomain.com" \ -F "subject=Monthly Newsletter" \ -F "text=Hello! Here is this month's news." \ -F 'headers={"X-Tags": "newsletter,promo"}'The messages[] array in the 202 response contains one {to, message_guid} entry per recipient.
Send Using a Template
Section titled “Send Using a Template”POST /api/domains/{domain}/message/template — required fields: template_guid (UUID of a template belonging to the domain), to. Supports {{variable}} replacement in subject and content.
curl -X POST "https://smtp-app.kirim.email/api/domains/example.com/message/template" \ -u "username:your-api-key" \ -F "template_guid=550e8400-e29b-41d4-a716-446655440000" \ -F "to=recipient@example.com" \ -F "from=sender@example.com" \ -F 'variables={"name": "John Doe", "product": "Premium Widget"}'Per-recipient variables for bulk sends — pass an array with one object per recipient:
curl -X POST "https://smtp-app.kirim.email/api/domains/example.com/message/template" \ -u "username:your-api-key" \ -F "template_guid=550e8400-e29b-41d4-a716-446655440000" \ -F "to=recipient1@example.com" \ -F "to=recipient2@example.com" \ -F 'variables=[{"name": "John", "product": "Widget A"}, {"name": "Jane", "product": "Widget B"}]' \ -F "attachments=@/path/to/terms.pdf"If from is omitted it defaults to noreply@{domain}. Attachments and attachment_options work the same as the non-template endpoint.
Success response (202):
{ "success": true, "message": "Template-based email jobs dispatched for 2 recipients in 1 job(s)", "template_guid": "550e8400-e29b-41d4-a716-446655440000", "template_name": "Welcome Email", "messages": [ { "to": "user@example.com", "message_guid": "0193f3c4-..." } ]}Email Validation
Section titled “Email Validation”Validate email addresses before sending to reduce bounce rates.
Validate a Single Email
Section titled “Validate a Single Email”curl -X POST "https://smtp-app.kirim.email/api/validate/email" \ -u "username:your-api-key" \ -d "email=recipient@example.com"Validate with Strict Mode
Section titled “Validate with Strict Mode”curl -X POST "https://smtp-app.kirim.email/api/validate/email/strict" \ -u "username:your-api-key" \ -d "email=recipient@example.com"Validate Multiple Emails
Section titled “Validate Multiple Emails”curl -X POST "https://smtp-app.kirim.email/api/validate/email/batch" \ -u "username:your-api-key" \ -H "Content-Type: application/json" \ -d '{"emails": ["a@example.com", "b@example.com", "c@example.com"]}'Monitor your email sending activity.
Get Sending Logs
Section titled “Get Sending Logs”curl -X GET "https://smtp-app.kirim.email/api/domains/example.com/logs" \ -u "username:your-api-key"Get Logs for Specific Message
Section titled “Get Logs for Specific Message”curl -X GET "https://smtp-app.kirim.email/api/domains/example.com/logs/message_xxxxx" \ -u "username:your-api-key"Stream Logs in Real-time
Section titled “Stream Logs in Real-time”curl -X GET "https://smtp-app.kirim.email/api/domains/example.com/logs/stream" \ -u "username:your-api-key"Suppressions
Section titled “Suppressions”Manage suppressed email addresses (bounces, unsubscribes, whitelist).
Get Suppressions
Section titled “Get Suppressions”# Get all suppressionscurl -X GET "https://smtp-app.kirim.email/api/domains/example.com/suppressions" \ -u "username:your-api-key"
# Get bounces onlycurl -X GET "https://smtp-app.kirim.email/api/domains/example.com/suppressions/bounces" \ -u "username:your-api-key"
# Get unsubscribes onlycurl -X GET "https://smtp-app.kirim.email/api/domains/example.com/suppressions/unsubscribes" \ -u "username:your-api-key"Add to Whitelist
Section titled “Add to Whitelist”curl -X POST "https://smtp-app.kirim.email/api/domains/example.com/suppressions/whitelist" \ -u "username:your-api-key" \ -d "email=important@example.com"Remove Suppressions
Section titled “Remove Suppressions”# Remove from unsubscribescurl -X DELETE "https://smtp-app.kirim.email/api/domains/example.com/suppressions/unsubscribes" \ -u "username:your-api-key" \ -d "emails=recipient@example.com"Webhooks
Section titled “Webhooks”Receive real-time notifications about email events.
Create a Webhook
Section titled “Create a Webhook”curl -X POST "https://smtp-app.kirim.email/api/domains/example.com/webhooks" \ -u "username:your-api-key" \ -H "Content-Type: application/json" \ -d '{ "url": "https://your-app.com/webhooks/kirimemail", "events": ["delivered", "bounced", "complained"] }'Webhook Events
Section titled “Webhook Events”Available webhook events:
| Event | Description |
|---|---|
queued |
Email queued for delivery |
delivered |
Email successfully delivered |
bounced |
Email was bounced |
complained |
Email marked as spam |
clicked |
Link in email was clicked |
opened |
Email was opened |
Test a Webhook
Section titled “Test a Webhook”curl -X POST "https://smtp-app.kirim.email/api/domains/example.com/webhooks/webhook_xxxxx/test" \ -u "username:your-api-key"Check your account’s sending limits and usage.
curl -X GET "https://smtp-app.kirim.email/api/quota" \ -u "username:your-api-key"Response:
{ "success": true, "data": { "plan": "standard", "limit": 1000, "used": 450, "remaining": 550, "reset_at": "2024-01-31T23:59:59Z" }}Rate Limits
Section titled “Rate Limits”| Plan | Limit |
|---|---|
| Standard | 100 requests/minute |
| Enterprise | 1000 requests/minute |
When rate limited, the API returns a 429 Too Many Requests response.
Error Handling
Section titled “Error Handling”The API uses standard HTTP status codes for responses.
| Code | Meaning |
|---|---|
200 |
Success |
400 |
Bad Request - Invalid parameters |
401 |
Unauthorized - Invalid API key |
403 |
Forbidden - Insufficient permissions |
404 |
Not Found - Resource doesn’t exist |
429 |
Too Many Requests - Rate limit exceeded |
500 |
Server Error - Something went wrong |
Error Response Format:
{ "success": false, "error": { "code": "invalid_email", "message": "The provided email address is not valid" }}Code Examples
Section titled “Code Examples”Python
Section titled “Python”import requestsfrom requests.auth import HTTPBasicAuth
api_key = "your-api-key"base_url = "https://smtp-app.kirim.email"
# List domainsresponse = requests.get( f"{base_url}/api/domains", auth=HTTPBasicAuth("username", api_key))print(response.json())Node.js
Section titled “Node.js”const axios = require('axios');
const apiKey = 'your-api-key';const baseUrl = 'https://smtp-app.kirim.email';
async function getDomains() { const response = await axios.get(`${baseUrl}/api/domains`, { auth: { username: 'username', password: apiKey } }); console.log(response.data);}<?php
$apiKey = 'your-api-key';$baseUrl = 'https://smtp-app.kirim.email';
$ch = curl_init("$baseUrl/api/domains");curl_setopt($ch, CURLOPT_USERPWD, "username:$apiKey");curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);curl_close($ch);
$data = json_decode($response, true);print_r($data);