Skip to main content

Getting Started with EDITH Email API

Welcome to the EDITH Email Service API documentation. This guide will help you understand how to effectively integrate with our email infrastructure for sending, receiving, and managing emails at scale.

Overview

EDITH is a comprehensive email management platform that provides:

  • Email Sending: Send transactional and marketing emails with advanced tracking
  • Domain Management: Configure and verify sending domains with DKIM/SPF authentication
  • Email Templates: Create reusable email templates for consistent messaging
  • Inbound Email Processing: Receive and process incoming emails via webhooks
  • SMTP/IMAP Integration: Connect your own mail servers for sending and receiving
  • Webhooks: Real-time notifications for email events (delivery, opens, clicks, bounces)
  • IP Pool Management: Dedicated IP pools for better deliverability control

Authentication

All API requests require authentication using one of the following methods:

Bearer Token Authentication

Most endpoints use Bearer token authentication. Include your API token in the request header:

Authorization: Bearer your_api_token_here

Example:

curl -X POST https://api.edith.example.com/v1/email/send \
-H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..." \
-H "Content-Type: application/json" \
-d '{ ... }'

API Key Authentication

Some endpoints support API Key authentication:

X-API-Key: your_api_key_here

Base URL

All API endpoints are relative to the base URL:

https://api.edith.example.com

Request Format

  • All request bodies must be JSON formatted
  • Set the Content-Type header to application/json
  • Use UTF-8 encoding for all text content

Response Format

All responses follow a consistent structure:

Success Response

{
"success": true,
"message": "Operation completed successfully",
"data": { ... }
}

Error Response

{
"success": false,
"error": "Error description",
"details": "Additional error context (optional)"
}

HTTP Status Codes

CodeDescription
200Success - Request completed successfully
201Created - Resource created successfully
400Bad Request - Invalid request parameters
401Unauthorized - Invalid or missing authentication
404Not Found - Resource does not exist
409Conflict - Resource already exists or state conflict
422Unprocessable Entity - Validation failed
500Internal Server Error - Server-side error

Rate Limiting

API requests are rate-limited to ensure fair usage:

  • Standard tier: 100 requests per minute
  • Enterprise tier: 1000 requests per minute

Rate limit headers are included in responses:

X-RateLimit-Limit: 100
X-RateLimit-Remaining: 95
X-RateLimit-Reset: 1699449600

Pagination

List endpoints support cursor-based pagination:

ParameterTypeDescription
pageSizeintegerNumber of results per page (default: 20, max: 50)
pageTokenstringCursor token for the next page of results

Example Request:

GET /v1/email/logs?pageSize=25&pageToken=eyJJZCI6IjEyMzQ1...

Response includes:

{
"success": true,
"data": [...],
"nextPageToken": "eyJJZCI6IjY3ODkw...",
"totalCount": 150
}

Quick Start: Send Your First Email

Step 1: Configure a Sending Domain

Before sending emails, you need to add and verify a sending domain:

curl -X POST https://api.edith.example.com/v1/domain/add \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"domain": "mail.yourcompany.com"
}'

Step 2: Add DNS Records

The response will include DNS records (DKIM, SPF) that you need to add to your domain's DNS settings.

Step 3: Verify the Domain

After adding DNS records, verify the domain:

curl -X PUT https://api.edith.example.com/v1/domain/verify/mail.yourcompany.com \
-H "Authorization: Bearer YOUR_TOKEN"

Step 4: Send an Email

Once verified, you can send emails:

curl -X POST https://api.edith.example.com/v1/email/send \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"from": {
"email": "sender@mail.yourcompany.com",
"name": "Your Company"
},
"to": [
{
"email": "recipient@example.com",
"name": "John Doe"
}
],
"subject": "Welcome to Our Service",
"content": [
{
"type": "text/html",
"value": "<h1>Welcome!</h1><p>Thank you for signing up.</p>"
}
],
"mailer_id": "your_mailer_id",
"settings": {
"open_tracking": { "enable": true },
"click_tracking": { "enable": true }
}
}'

Key Concepts

Mailer ID

A mailer_id is a unique identifier for your email configuration. It's returned when you:

  • Add a sending domain
  • Configure SMTP/IMAP settings
  • Set up OAuth email connections

You must include the mailer_id when sending emails to specify which configuration to use.

Email Statuses

StatusDescription
queuedEmail is queued for sending
sentEmail sent to the mail server
deliveredEmail successfully delivered to recipient
openedRecipient opened the email
clickedRecipient clicked a link in the email
bouncedEmail bounced (soft or hard bounce)
failedEmail failed to send
spamEmail marked as spam by recipient
unsubscribedRecipient unsubscribed

Template Variables

Use double curly braces for dynamic content in templates:

<p>Hello {{name}},</p>
<p>Your order #{{order_id}} has been shipped!</p>

Pass substitutions when sending:

{
"substitutions": {
"recipient@example.com": {
"name": "John",
"order_id": "12345"
}
}
}

SDKs and Libraries

We provide official SDKs for JS:

  • JS: npm install @sparrowengg/sparrow-mailer-sdk@0.1.2-stable.0