Skip to content

API Guide

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.

All API requests require Basic Authentication with your API credentials. Your username serves as username, and the API key serves as password.

Terminal window
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.

All API endpoints are relative to:

https://smtp-app.kirim.email

Retrieve all domains associated with your account.

Terminal window
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"
}
]
}

Add a new domain to your account.

Terminal window
curl -X POST "https://smtp-app.kirim.email/api/domains" \
-u "username:your-api-key" \
-H "Content-Type: application/json" \
-d '{"domain": "example.com"}'

After creating a domain, you need to verify your DNS records:

Terminal window
# 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"

SMTP credentials allow you to send emails through specific domains.

Terminal window
curl -X GET "https://smtp-app.kirim.email/api/domains/example.com/credentials" \
-u "username:your-api-key"
Terminal window
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.

Terminal window
curl -X POST "https://smtp-app.kirim.email/api/domains/example.com/credentials/cred_xxxxx/reset-password" \
-u "username:your-api-key"

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.

POST /api/domains/{domain}/message — required fields: from, to, subject, text.

Terminal window
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-..." }
]
}
Terminal window
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"}}'

Pass to multiple times (or as an array) — up to 1000 recipients per request:

Terminal window
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.

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.

Terminal window
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:

Terminal window
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-..." }
]
}

Validate email addresses before sending to reduce bounce rates.

Terminal window
curl -X POST "https://smtp-app.kirim.email/api/validate/email" \
-u "username:your-api-key" \
-d "email=recipient@example.com"
Terminal window
curl -X POST "https://smtp-app.kirim.email/api/validate/email/strict" \
-u "username:your-api-key" \
-d "email=recipient@example.com"
Terminal window
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.

Terminal window
curl -X GET "https://smtp-app.kirim.email/api/domains/example.com/logs" \
-u "username:your-api-key"
Terminal window
curl -X GET "https://smtp-app.kirim.email/api/domains/example.com/logs/message_xxxxx" \
-u "username:your-api-key"
Terminal window
curl -X GET "https://smtp-app.kirim.email/api/domains/example.com/logs/stream" \
-u "username:your-api-key"

Manage suppressed email addresses (bounces, unsubscribes, whitelist).

Terminal window
# Get all suppressions
curl -X GET "https://smtp-app.kirim.email/api/domains/example.com/suppressions" \
-u "username:your-api-key"
# Get bounces only
curl -X GET "https://smtp-app.kirim.email/api/domains/example.com/suppressions/bounces" \
-u "username:your-api-key"
# Get unsubscribes only
curl -X GET "https://smtp-app.kirim.email/api/domains/example.com/suppressions/unsubscribes" \
-u "username:your-api-key"
Terminal window
curl -X POST "https://smtp-app.kirim.email/api/domains/example.com/suppressions/whitelist" \
-u "username:your-api-key" \
-d "email=important@example.com"
Terminal window
# Remove from unsubscribes
curl -X DELETE "https://smtp-app.kirim.email/api/domains/example.com/suppressions/unsubscribes" \
-u "username:your-api-key" \
-d "emails=recipient@example.com"

Receive real-time notifications about email events.

Terminal window
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"]
}'

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
Terminal window
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.

Terminal window
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"
}
}
Plan Limit
Standard 100 requests/minute
Enterprise 1000 requests/minute

When rate limited, the API returns a 429 Too Many Requests response.

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"
}
}
import requests
from requests.auth import HTTPBasicAuth
api_key = "your-api-key"
base_url = "https://smtp-app.kirim.email"
# List domains
response = requests.get(
f"{base_url}/api/domains",
auth=HTTPBasicAuth("username", api_key)
)
print(response.json())
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);