Send Email

Send a single email to one or multiple recipients. Supports templates, variables, attachments, scheduling, and tracking.

POST/emails

Headers

AuthorizationstringRequired

Bearer token for authentication.

Idempotency-Keystring

Unique key (max 256 chars, alphanumeric/dash/underscore) to prevent duplicate sends for 24 hours.

Request Body

fromstringRequired

Sender email in RFC format: email@domain.com or Display Name <email@domain.com>.

tostring | string[]Required

Recipient email address(es). Maximum 50 recipients.

subjectstring

Email subject line. Required unless template provides it.

htmlstring

HTML content of the email. Required unless template provides it or text is provided.

textstring

Plain text content of the email.

reply_tostring | string[]

Reply-to email address(es).

ccstring | string[]

CC recipients. Maximum 50 recipients.

bccstring | string[]

BCC recipients. Maximum 50 recipients.

templatestring

Template alias or ID (tem_xxx format).

variablesobject

Variables for template substitution using {{'{'}variable{'}'}} syntax.

attachmentsarray

Array of attachment objects (see Attachment Object below).

headersobject

Custom email headers as key-value pairs.

metaobject

Metadata as key-value string pairs. Stored and returned with the email.

scheduled_atstring

Schedule send time. Accepts ISO 8601, Unix timestamp, or natural language like tomorrow at 9am.

trackingboolean | object

Override domain tracking defaults. Can be a boolean or object with loads and clicks properties.

Attachment Object

filenamestringRequired

File name with extension.

contentstring

Base64 encoded content. Mutually exclusive with url.

urlstring

URL to fetch attachment from. Mutually exclusive with content.

content_typestring

MIME type. Required when using content.

content_idstring

Content-ID for inline images (cid:).

encodingstring

Content encoding (default: base64).

Allowed Attachment File Types

CategoryExtensions
Text.txt, .csv, .log, .css, .ics, .xml
Images.jpg, .jpe, .jpeg, .gif, .png, .bmp, .psd, .tif, .tiff, .svg, .indd, .ai, .eps
Documents.doc, .docx, .rtf, .odt, .ott, .pdf, .pub, .pages, .mobi, .epub
Audio.mp3, .m4a, .m4v, .wma, .ogg, .flac, .wav, .aif, .aifc, .aiff
Video.mp4, .mov, .avi, .mkv, .mpeg, .mpg, .wmv
Spreadsheets.xls, .xlsx, .ods, .numbers
Presentations.odp, .ppt, .pptx, .pps, .key
Archives.zip, .vcf
Email.eml
Cryptographic.p7c, .p7m, .p7s, .pgp, .asc, .sig

Rate Limit Headers

The following headers are included in every response:

HeaderDescription
ratelimit-limitMaximum requests per second
ratelimit-remainingRemaining requests in current second
ratelimit-resetSeconds until rate limit resets
ratelimit-daily-limitMaximum daily requests
ratelimit-daily-remainingRemaining daily requests
ratelimit-daily-resetSeconds until daily limit resets
POST /emails
import { Emailit } from '@emailit/node';
const emailit = new Emailit('your_api_key');

const email = await emailit.emails.send({
  from: 'Your Company <hello@yourdomain.com>',
  to: ['recipient1@example.com', 'recipient2@example.com'],
  subject: 'Hello World',
  html: '<h1>Welcome!</h1><p>Thanks for signing up.</p>',
  tracking: {
    loads: true,
    clicks: true,
  },
});
from emailit import EmailitClient
client = EmailitClient("your_api_key")

email = client.emails.send({
  "from": "Your Company <hello@yourdomain.com>",
  "to": ["recipient1@example.com", "recipient2@example.com"],
  "subject": "Hello World",
  "html": "<h1>Welcome!</h1><p>Thanks for signing up.</p>",
  "tracking": {
    "loads": True,
    "clicks": True
  }
})
$emailit = Emailit::client('your_api_key');

$email = $emailit->emails()->send([
  'from' => 'Your Company <hello@yourdomain.com>',
  'to' => ['recipient1@example.com', 'recipient2@example.com'],
  'subject' => 'Hello World',
  'html' => '<h1>Welcome!</h1><p>Thanks for signing up.</p>',
  'tracking' => [
    'loads' => true,
    'clicks' => true,
  ],
]);
require "emailit"
client = Emailit::EmailitClient.new("your_api_key")

email = client.emails.send(
  from: "Your Company <hello@yourdomain.com>",
  to: ["recipient1@example.com", "recipient2@example.com"],
  subject: "Hello World",
  html: "<h1>Welcome!</h1><p>Thanks for signing up.</p>",
  tracking: { loads: true, clicks: true }
)
import "github.com/emailit/emailit-go/v2"
client := emailit.NewClient("your_api_key")

email, err := client.Emails.Send(&emailit.SendEmailRequest{
  From:    "Your Company <hello@yourdomain.com>",
  To:      []string{"recipient1@example.com", "recipient2@example.com"},
  Subject: "Hello World",
  Html:    "<h1>Welcome!</h1><p>Thanks for signing up.</p>",
  Tracking: &emailit.TrackingOptions{
    Loads:  true,
    Clicks: true,
  },
})
use emailit::Emailit;
use emailit::types::CreateEmailBaseOptions;

let emailit = Emailit::new("your_api_key");

let opts = CreateEmailBaseOptions::new(
    "Your Company <hello@yourdomain.com>",
    ["recipient1@example.com", "recipient2@example.com"],
    "Hello World",
)
.with_html("<h1>Welcome!</h1><p>Thanks for signing up.</p>")
.with_tracking(true, true);

let email = emailit.emails.send(opts).await?;
import com.emailit.*;
import com.emailit.params.*;

EmailitClient emailit = new EmailitClient("your_api_key");

EmailitObject email = emailit.emails().send(
  EmailSendParams.builder()
    .setFrom("Your Company <hello@yourdomain.com>")
    .setTo(Arrays.asList("recipient1@example.com", "recipient2@example.com"))
    .setSubject("Hello World")
    .setHtml("<h1>Welcome!</h1><p>Thanks for signing up.</p>")
    .setTracking(new TrackingOptions(true, true))
    .build()
);
using Emailit;

var emailit = new EmailitClient("your_api_key");

var email = emailit.Emails.Send(new EmailSendOptions {
  From = "Your Company <hello@yourdomain.com>",
  To = new[] { "recipient1@example.com", "recipient2@example.com" },
  Subject = "Hello World",
  Html = "<h1>Welcome!</h1><p>Thanks for signing up.</p>",
  Tracking = new TrackingOptions { Loads = true, Clicks = true },
});
use Emailit\Laravel\Facades\Emailit;

$email = Emailit::emails()->send([
  'from' => 'Your Company <hello@yourdomain.com>',
  'to' => ['recipient1@example.com', 'recipient2@example.com'],
  'subject' => 'Hello World',
  'html' => '<h1>Welcome!</h1><p>Thanks for signing up.</p>',
  'tracking' => [
    'loads' => true,
    'clicks' => true,
  ],
]);
curl -X POST https://api.emailit.com/v2/emails \
  -H "Authorization: Bearer your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "from": "Your Company <hello@yourdomain.com>",
    "to": ["recipient1@example.com", "recipient2@example.com"],
    "subject": "Hello World",
    "html": "<h1>Welcome!</h1><p>Thanks for signing up.</p>",
    "tracking": {
      "loads": true,
      "clicks": true
    }
  }'
const response = await fetch('https://api.emailit.com/v2/emails', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer em_test_51RxCWJ...vS00p61e0qRE',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    from: 'hello@yourdomain.com',
    to: 'user@example.com',
    template: 'welcome_email',
    variables: {
      name: 'John Doe',
      company: 'Acme Inc',
      activation_url: 'https://example.com/activate?token=abc123'
    }
  })
});

const result = await response.json();
curl -X POST https://api.emailit.com/v2/emails \
  -H "Authorization: Bearer em_test_51RxCWJ...vS00p61e0qRE" \
  -H "Content-Type: application/json" \
  -d '{
    "from": "hello@yourdomain.com",
    "to": "user@example.com",
    "template": "welcome_email",
    "variables": {
      "name": "John Doe",
      "company": "Acme Inc",
      "activation_url": "https://example.com/activate?token=abc123"
    }
  }'
const response = await fetch('https://api.emailit.com/v2/emails', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer em_test_51RxCWJ...vS00p61e0qRE',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    from: 'invoices@yourdomain.com',
    to: 'customer@example.com',
    subject: 'Your Invoice #12345',
    html: '<p>Please find your invoice attached.</p>',
    attachments: [
      {
        filename: 'invoice-12345.pdf',
        content: 'JVBERi0xLjQKJcOkw7zDqc...', // base64 encoded
        content_type: 'application/pdf'
      }
    ]
  })
});

const result = await response.json();
curl -X POST https://api.emailit.com/v2/emails \
  -H "Authorization: Bearer em_test_51RxCWJ...vS00p61e0qRE" \
  -H "Content-Type: application/json" \
  -d '{
    "from": "invoices@yourdomain.com",
    "to": "customer@example.com",
    "subject": "Your Invoice #12345",
    "html": "<p>Please find your invoice attached.</p>",
    "attachments": [
      {
        "filename": "invoice-12345.pdf",
        "content": "JVBERi0xLjQKJcOkw7zDqc...",
        "content_type": "application/pdf"
      }
    ]
  }'
const response = await fetch('https://api.emailit.com/v2/emails', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer em_test_51RxCWJ...vS00p61e0qRE',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    from: 'reminders@yourdomain.com',
    to: 'user@example.com',
    subject: 'Appointment Reminder',
    html: '<p>Your appointment is tomorrow at 2 PM.</p>',
    scheduled_at: 'tomorrow at 9am'
  })
});

const result = await response.json();
curl -X POST https://api.emailit.com/v2/emails \
  -H "Authorization: Bearer em_test_51RxCWJ...vS00p61e0qRE" \
  -H "Content-Type: application/json" \
  -d '{
    "from": "reminders@yourdomain.com",
    "to": "user@example.com",
    "subject": "Appointment Reminder",
    "html": "<p>Your appointment is tomorrow at 2 PM.</p>",
    "scheduled_at": "2026-01-10T09:00:00Z"
  }'
{
  "object": "email",
  "id": "em_abc123xyz789def456ghi012jkl345",
  "ids": {
    "recipient1@example.com": "em_abc123xyz789def456ghi012jkl345",
    "recipient2@example.com": "em_def456abc789ghi012jkl345mno678"
  },
  "token": "abc123xyz789",
  "message_id": "<abc123xyz789@yourdomain.com>",
  "from": "hello@yourdomain.com",
  "to": ["recipient1@example.com", "recipient2@example.com"],
  "cc": ["cc@example.com"],
  "bcc": ["bcc@example.com"],
  "subject": "Hello World",
  "status": "pending",
  "scheduled_at": null,
  "created_at": "2026-01-08T12:00:00.123456Z",
  "tracking": {
    "loads": true,
    "clicks": true
  }
}
{
  "object": "email",
  "id": "em_abc123xyz789def456ghi012jkl345",
  "token": "abc123xyz789",
  "message_id": "<abc123xyz789@yourdomain.com>",
  "from": "hello@yourdomain.com",
  "to": ["user@example.com"],
  "subject": "Appointment Reminder",
  "status": "scheduled",
  "scheduled_at": "2026-01-10T09:00:00.000Z",
  "created_at": "2026-01-08T12:00:00.123456Z",
  "tracking": {
    "loads": true,
    "clicks": true
  }
}
{
  "error": "Validation failed",
  "validation_errors": [
    "Missing required field: from",
    "Invalid to email address at index 0: invalid-email"
  ]
}
{
  "error": "Template not found",
  "details": "Template 'welcome_email' not found or not published"
}
{
  "error": "Message too large",
  "details": "Message size (45MB) exceeds maximum allowed size of 40MB"
}
{
  "error": "From/Sender domain is not valid or not verified",
  "details": "The domain from email address 'sender@unverified.com' is not verified in your workspace"
}
{
  "error": "Rate limit exceeded",
  "message": "Too many requests. Maximum 10 messages per second allowed.",
  "limit": 10,
  "current": 11,
  "retry_after": 1
}

List Emails

List emails in your workspace with pagination and optional filtering by type.

GET/emails

Query Parameters

pageinteger

Page number. Minimum: 1. Default: 1.

limitinteger

Number of results per page. Range: 1–100. Default: 10.

typestring

Filter by email type: inbound or outbound.

GET /emails
import { Emailit } from '@emailit/node';
const emailit = new Emailit('your_api_key');

const emails = await emailit.emails.list({ page: 1, limit: 10 });
from emailit import EmailitClient
client = EmailitClient("your_api_key")

emails = client.emails.list({ "page": 1, "limit": 10 })
$emailit = Emailit::client('your_api_key');

$emails = $emailit->emails()->list(['page' => 1, 'limit' => 10]);
require "emailit"
client = Emailit::EmailitClient.new("your_api_key")

emails = client.emails.list(page: 1, limit: 10)
import "github.com/emailit/emailit-go/v2"
client := emailit.NewClient("your_api_key")

emails, err := client.Emails.List(&emailit.ListEmailsRequest{
  Page:  1,
  Limit: 10,
})
use emailit::Emailit;

let emailit = Emailit::new("your_api_key");

let emails = emailit.emails.list(Some(emailit::types::ListEmailsParams {
  page: Some(1),
  limit: Some(10),
})).await?;
import com.emailit.*;
import com.emailit.params.*;

EmailitClient emailit = new EmailitClient("your_api_key");

EmailitObject emails = emailit.emails().list(
  EmailListParams.builder()
    .setPage(1)
    .setLimit(10)
    .build()
);
using Emailit;

var emailit = new EmailitClient("your_api_key");

var emails = emailit.Emails.List(new EmailListOptions {
  Page = 1,
  Limit = 10,
});
use Emailit\Laravel\Facades\Emailit;

$emails = Emailit::emails()->list(['page' => 1, 'limit' => 10]);
curl "https://api.emailit.com/v2/emails?page=1&limit=10" \
  -H "Authorization: Bearer your_api_key"
{
  "data": [
    {
      "object": "email",
      "id": "em_abc123xyz789def456ghi012jkl345",
      "type": "outbound",
      "from": "sender@yourdomain.com",
      "to": "recipient@example.com",
      "subject": "Hello World",
      "status": "delivered",
      "size": 4523,
      "scheduled_at": null,
      "created_at": "2026-01-08T12:00:00.123456Z",
      "updated_at": "2026-01-08T12:01:00.123456Z",
      "meta": null
    },
    {
      "object": "email",
      "id": "em_def456ghi789jkl012mno345pqr678",
      "type": "inbound",
      "from": "external@otherdomain.com",
      "to": "inbox@yourdomain.com",
      "subject": "Re: Your inquiry",
      "status": "delivered",
      "size": 2891,
      "scheduled_at": null,
      "created_at": "2026-01-08T11:30:00.123456Z",
      "updated_at": "2026-01-08T11:30:00.123456Z",
      "meta": null
    }
  ],
  "next_page_url": "/v2/emails?page=2&limit=10",
  "previous_page_url": null
}

Get Email

Retrieve a single email by its ID, including headers, parsed body content, and attachments.

GET/emails/{id}

Path Parameters

idstringRequired

The email ID in em_xxx format.

GET /emails/{id}
import { Emailit } from '@emailit/node';
const emailit = new Emailit('your_api_key');

const email = await emailit.emails.get('em_abc123');
from emailit import EmailitClient
client = EmailitClient("your_api_key")

email = client.emails.get("em_abc123")
$emailit = Emailit::client('your_api_key');

$email = $emailit->emails()->get('em_abc123');
require "emailit"
client = Emailit::EmailitClient.new("your_api_key")

email = client.emails.get("em_abc123")
import "github.com/emailit/emailit-go/v2"
client := emailit.NewClient("your_api_key")

email, err := client.Emails.Get("em_abc123")
use emailit::Emailit;

let emailit = Emailit::new("your_api_key");

let email = emailit.emails.get("em_abc123").await?;
import com.emailit.*;

EmailitClient emailit = new EmailitClient("your_api_key");

EmailitObject email = emailit.emails().get("em_abc123");
using Emailit;

var emailit = new EmailitClient("your_api_key");

var email = emailit.Emails.Get("em_abc123");
use Emailit\Laravel\Facades\Emailit;

$email = Emailit::emails()->get('em_abc123');
curl https://api.emailit.com/v2/emails/em_abc123 \
  -H "Authorization: Bearer your_api_key"

Response Fields

FieldTypeDescription
objectstringAlways "email"
idstringEmail ID in em_xxx format
typestring"inbound" or "outbound"
tokenstringEmail token
message_idstringSMTP Message-ID
fromstringSender email address
tostringRecipient email address
subjectstringEmail subject line
statusstringCurrent email status
sizeintegerEmail size in bytes
scheduled_atstring | nullScheduled delivery time (ISO 8601)
created_atstringCreation timestamp (ISO 8601)
updated_atstringLast update timestamp (ISO 8601)
trackingobject | nullTracking settings (omitted for inbound emails)
metaobject | nullCustom metadata
headersobjectParsed email headers
bodyobjectParsed body with text and html fields
attachmentsarrayParsed attachments with base64-encoded content

Body Object

FieldTypeDescription
textstring | nullPlain text content
htmlstring | nullHTML content

Attachment Object

FieldTypeDescription
filenamestringAttachment filename
content_typestringMIME type
sizeintegerAttachment size in bytes
content_idstring | nullContent-ID for inline attachments
content_dispositionstring"attachment" or "inline"
contentstringBase64-encoded attachment content
{
  "object": "email",
  "id": "em_abc123xyz789def456ghi012jkl345",
  "type": "outbound",
  "token": "abc123xyz789",
  "message_id": "<abc123xyz789@yourdomain.com>",
  "from": "sender@yourdomain.com",
  "to": "recipient@example.com",
  "subject": "Hello World",
  "status": "delivered",
  "size": 12345,
  "scheduled_at": null,
  "created_at": "2026-01-08T12:00:00.123456Z",
  "updated_at": "2026-01-08T12:05:00.123456Z",
  "tracking": {
    "loads": true,
    "clicks": true
  },
  "meta": {
    "campaign": "summer",
    "type": "marketing"
  },
  "headers": {
    "From": "sender@yourdomain.com",
    "To": "recipient@example.com",
    "Subject": "Hello World",
    "Content-Type": "multipart/mixed; boundary=----boundary123"
  },
  "body": {
    "text": "Welcome!",
    "html": "<html><body><h1>Welcome!</h1></body></html>"
  },
  "attachments": [
    {
      "filename": "doc.pdf",
      "content_type": "application/pdf",
      "size": 12345,
      "content_id": null,
      "content_disposition": "attachment",
      "content": "JVBERi0xLjQKJcOkw7zDqc..."
    }
  ]
}
{
  "object": "email",
  "id": "em_abc123xyz789def456ghi012jkl345",
  "type": "inbound",
  "token": "abc123xyz789",
  "message_id": "<abc123xyz789@externaldomain.com>",
  "from": "external@externaldomain.com",
  "to": "inbox@yourdomain.com",
  "subject": "Re: Your inquiry",
  "status": "delivered",
  "size": 8234,
  "scheduled_at": null,
  "created_at": "2026-01-08T12:00:00.123456Z",
  "updated_at": "2026-01-08T12:00:00.123456Z",
  "meta": null,
  "headers": {
    "From": "external@externaldomain.com",
    "To": "inbox@yourdomain.com",
    "Subject": "Re: Your inquiry",
    "Content-Type": "text/plain; charset=utf-8"
  },
  "body": {
    "text": "Thanks for reaching out...",
    "html": null
  },
  "attachments": []
}
{
  "object": "email",
  "id": "em_abc123xyz789def456ghi012jkl345",
  "type": "outbound",
  "token": "abc123xyz789",
  "message_id": "<abc123xyz789@yourdomain.com>",
  "from": "sender@yourdomain.com",
  "to": "recipient@example.com",
  "subject": "Appointment Reminder",
  "status": "scheduled",
  "size": 8234,
  "scheduled_at": "2026-01-10T15:00:00.000000Z",
  "created_at": "2026-01-08T12:00:00.123456Z",
  "updated_at": "2026-01-08T12:00:00.123456Z",
  "tracking": {
    "loads": true,
    "clicks": true
  },
  "meta": null,
  "headers": {
    "From": "sender@yourdomain.com",
    "To": "recipient@example.com",
    "Subject": "Appointment Reminder",
    "Content-Type": "text/html; charset=utf-8"
  },
  "body": {
    "text": "Appointment Reminder...",
    "html": "<html>..."
  },
  "attachments": []
}
{
  "error": "Email not found",
  "message": "Email with ID 'em_abc123' not found in your workspace"
}

Get Email Raw

Returns the full raw MIME message string along with email metadata.

GET/emails/{id}/raw

Path Parameters

idstringRequired

The email ID in em_xxx format.

GET /emails/{id}/raw
import { Emailit } from '@emailit/node';
const emailit = new Emailit('your_api_key');

// This endpoint requires a direct API call
const response = await fetch('https://api.emailit.com/v2/emails/em_abc123/raw', {
  headers: { 'Authorization': 'Bearer your_api_key' },
});
const raw = await response.json();
from emailit import EmailitClient
client = EmailitClient("your_api_key")

# This endpoint requires a direct API call
import requests
response = requests.get(
  "https://api.emailit.com/v2/emails/em_abc123/raw",
  headers={"Authorization": "Bearer your_api_key"}
)
raw = response.json()
// This endpoint requires a direct API call
$ch = curl_init('https://api.emailit.com/v2/emails/em_abc123/raw');
curl_setopt_array($ch, [
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_HTTPHEADER => [
    'Authorization: Bearer your_api_key',
  ],
]);
$raw = json_decode(curl_exec($ch), true);
curl_close($ch);
require "net/http"
require "json"

# This endpoint requires a direct API call
uri = URI("https://api.emailit.com/v2/emails/em_abc123/raw")
req = Net::HTTP::Get.new(uri)
req["Authorization"] = "Bearer your_api_key"
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
raw = JSON.parse(http.request(req).body)
import "github.com/emailit/emailit-go/v2"
client := emailit.NewClient("your_api_key")

raw, err := client.Emails.GetRaw("em_abc123")
use emailit::Emailit;

let emailit = Emailit::new("your_api_key");

let raw = emailit.emails.get_raw("em_abc123").await?;
import java.net.http.*;
import java.net.URI;

// This endpoint requires a direct API call
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
  .uri(URI.create("https://api.emailit.com/v2/emails/em_abc123/raw"))
  .header("Authorization", "Bearer your_api_key")
  .GET()
  .build();
HttpResponse<String> response = client.send(request,
  HttpResponse.BodyHandlers.ofString());
using Emailit;

var emailit = new EmailitClient("your_api_key");

var raw = emailit.Emails.GetRaw("em_abc123");
// This endpoint requires a direct API call
$response = Http::withToken('your_api_key')
  ->get('https://api.emailit.com/v2/emails/em_abc123/raw');
$raw = $response->json();
curl https://api.emailit.com/v2/emails/em_abc123/raw \
  -H "Authorization: Bearer your_api_key"
{
  "object": "email",
  "id": "em_abc123xyz789def456ghi012jkl345",
  "type": "outbound",
  "token": "abc123xyz789",
  "message_id": "<abc123xyz789@yourdomain.com>",
  "from": "sender@yourdomain.com",
  "to": "recipient@example.com",
  "subject": "Hello World",
  "status": "delivered",
  "size": 4523,
  "scheduled_at": null,
  "created_at": "2026-01-08T12:00:00.123456Z",
  "updated_at": "2026-01-08T12:05:00.123456Z",
  "tracking": {
    "loads": true,
    "clicks": false
  },
  "meta": null,
  "headers": {
    "From": "sender@yourdomain.com",
    "To": "recipient@example.com",
    "Subject": "Hello World",
    "Content-Type": "text/html; charset=utf-8"
  },
  "raw": "From: sender@yourdomain.com\r\nTo: recipient@example.com\r\nSubject: Hello World\r\nContent-Type: text/html; charset=utf-8\r\n\r\n<html><body><h1>Welcome!</h1></body></html>"
}
{
  "error": "Email not found",
  "message": "Email with ID 'em_abc123' not found in your workspace"
}

Get Email Attachments

Returns only the attachment list for an email, with base64-encoded content.

GET/emails/{id}/attachments

Path Parameters

idstringRequired

The email ID in em_xxx format.

GET /emails/{id}/attachments
import { Emailit } from '@emailit/node';
const emailit = new Emailit('your_api_key');

// This endpoint requires a direct API call
const response = await fetch('https://api.emailit.com/v2/emails/em_abc123/attachments', {
  headers: { 'Authorization': 'Bearer your_api_key' },
});
const attachments = await response.json();
from emailit import EmailitClient
client = EmailitClient("your_api_key")

# This endpoint requires a direct API call
import requests
response = requests.get(
  "https://api.emailit.com/v2/emails/em_abc123/attachments",
  headers={"Authorization": "Bearer your_api_key"}
)
attachments = response.json()
// This endpoint requires a direct API call
$ch = curl_init('https://api.emailit.com/v2/emails/em_abc123/attachments');
curl_setopt_array($ch, [
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_HTTPHEADER => [
    'Authorization: Bearer your_api_key',
  ],
]);
$attachments = json_decode(curl_exec($ch), true);
curl_close($ch);
require "net/http"
require "json"

# This endpoint requires a direct API call
uri = URI("https://api.emailit.com/v2/emails/em_abc123/attachments")
req = Net::HTTP::Get.new(uri)
req["Authorization"] = "Bearer your_api_key"
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
attachments = JSON.parse(http.request(req).body)
import "github.com/emailit/emailit-go/v2"
client := emailit.NewClient("your_api_key")

attachments, err := client.Emails.GetAttachments("em_abc123")
use emailit::Emailit;

let emailit = Emailit::new("your_api_key");

let attachments = emailit.emails.get_attachments("em_abc123").await?;
import java.net.http.*;
import java.net.URI;

// This endpoint requires a direct API call
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
  .uri(URI.create("https://api.emailit.com/v2/emails/em_abc123/attachments"))
  .header("Authorization", "Bearer your_api_key")
  .GET()
  .build();
HttpResponse<String> response = client.send(request,
  HttpResponse.BodyHandlers.ofString());
using Emailit;

var emailit = new EmailitClient("your_api_key");

var attachments = emailit.Emails.GetAttachments("em_abc123");
// This endpoint requires a direct API call
$response = Http::withToken('your_api_key')
  ->get('https://api.emailit.com/v2/emails/em_abc123/attachments');
$attachments = $response->json();
curl https://api.emailit.com/v2/emails/em_abc123/attachments \
  -H "Authorization: Bearer your_api_key"

Response Fields

FieldTypeDescription
objectstringAlways "list"
dataarrayArray of attachment objects

Attachment Object

FieldTypeDescription
filenamestringAttachment filename
content_typestringMIME type
sizeintegerAttachment size in bytes
content_idstring | nullContent-ID for inline attachments
content_dispositionstring"attachment" or "inline"
contentstringBase64-encoded attachment content
{
  "object": "list",
  "data": [
    {
      "filename": "doc.pdf",
      "content_type": "application/pdf",
      "size": 12345,
      "content_id": null,
      "content_disposition": "attachment",
      "content": "JVBERi0xLjQKJcOkw7zDqc..."
    },
    {
      "filename": "logo.png",
      "content_type": "image/png",
      "size": 5678,
      "content_id": "logo@yourdomain.com",
      "content_disposition": "inline",
      "content": "iVBORw0KGgoAAAANSUhEUg..."
    }
  ]
}
{
  "object": "list",
  "data": []
}
{
  "error": "Email not found",
  "message": "Email with ID 'em_abc123' not found in your workspace"
}

Get Email Body

Returns only the parsed body content (text and HTML) for an email.

GET/emails/{id}/body

Path Parameters

idstringRequired

The email ID in em_xxx format.

GET /emails/{id}/body
import { Emailit } from '@emailit/node';
const emailit = new Emailit('your_api_key');

// This endpoint requires a direct API call
const response = await fetch('https://api.emailit.com/v2/emails/em_abc123/body', {
  headers: { 'Authorization': 'Bearer your_api_key' },
});
const body = await response.json();
from emailit import EmailitClient
client = EmailitClient("your_api_key")

# This endpoint requires a direct API call
import requests
response = requests.get(
  "https://api.emailit.com/v2/emails/em_abc123/body",
  headers={"Authorization": "Bearer your_api_key"}
)
body = response.json()
// This endpoint requires a direct API call
$ch = curl_init('https://api.emailit.com/v2/emails/em_abc123/body');
curl_setopt_array($ch, [
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_HTTPHEADER => [
    'Authorization: Bearer your_api_key',
  ],
]);
$body = json_decode(curl_exec($ch), true);
curl_close($ch);
require "net/http"
require "json"

# This endpoint requires a direct API call
uri = URI("https://api.emailit.com/v2/emails/em_abc123/body")
req = Net::HTTP::Get.new(uri)
req["Authorization"] = "Bearer your_api_key"
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
body = JSON.parse(http.request(req).body)
import "github.com/emailit/emailit-go/v2"
client := emailit.NewClient("your_api_key")

body, err := client.Emails.GetBody("em_abc123")
use emailit::Emailit;

let emailit = Emailit::new("your_api_key");

let body = emailit.emails.get_body("em_abc123").await?;
import java.net.http.*;
import java.net.URI;

// This endpoint requires a direct API call
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
  .uri(URI.create("https://api.emailit.com/v2/emails/em_abc123/body"))
  .header("Authorization", "Bearer your_api_key")
  .GET()
  .build();
HttpResponse<String> response = client.send(request,
  HttpResponse.BodyHandlers.ofString());
using Emailit;

var emailit = new EmailitClient("your_api_key");

var body = emailit.Emails.GetBody("em_abc123");
// This endpoint requires a direct API call
$response = Http::withToken('your_api_key')
  ->get('https://api.emailit.com/v2/emails/em_abc123/body');
$body = $response->json();
curl https://api.emailit.com/v2/emails/em_abc123/body \
  -H "Authorization: Bearer your_api_key"
{
  "text": "Plain text content of the email",
  "html": "<html><body><h1>Welcome!</h1><p>HTML content of the email</p></body></html>"
}
{
  "text": "Plain text content of the email",
  "html": null
}
{
  "error": "Email not found",
  "message": "Email with ID 'em_abc123' not found in your workspace"
}

Get Email Meta

Returns email metadata with attachment information, but without attachment content. Useful for inspecting an email without downloading potentially large attachment data.

GET/emails/{id}/meta

Path Parameters

idstringRequired

The email ID in em_xxx format.

GET /emails/{id}/meta
import { Emailit } from '@emailit/node';
const emailit = new Emailit('your_api_key');

// This endpoint requires a direct API call
const response = await fetch('https://api.emailit.com/v2/emails/em_abc123/meta', {
  headers: { 'Authorization': 'Bearer your_api_key' },
});
const meta = await response.json();
from emailit import EmailitClient
client = EmailitClient("your_api_key")

# This endpoint requires a direct API call
import requests
response = requests.get(
  "https://api.emailit.com/v2/emails/em_abc123/meta",
  headers={"Authorization": "Bearer your_api_key"}
)
meta = response.json()
// This endpoint requires a direct API call
$ch = curl_init('https://api.emailit.com/v2/emails/em_abc123/meta');
curl_setopt_array($ch, [
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_HTTPHEADER => [
    'Authorization: Bearer your_api_key',
  ],
]);
$meta = json_decode(curl_exec($ch), true);
curl_close($ch);
require "net/http"
require "json"

# This endpoint requires a direct API call
uri = URI("https://api.emailit.com/v2/emails/em_abc123/meta")
req = Net::HTTP::Get.new(uri)
req["Authorization"] = "Bearer your_api_key"
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
meta = JSON.parse(http.request(req).body)
import "github.com/emailit/emailit-go/v2"
client := emailit.NewClient("your_api_key")

meta, err := client.Emails.GetMeta("em_abc123")
use emailit::Emailit;

let emailit = Emailit::new("your_api_key");

let meta = emailit.emails.get_meta("em_abc123").await?;
import java.net.http.*;
import java.net.URI;

// This endpoint requires a direct API call
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
  .uri(URI.create("https://api.emailit.com/v2/emails/em_abc123/meta"))
  .header("Authorization", "Bearer your_api_key")
  .GET()
  .build();
HttpResponse<String> response = client.send(request,
  HttpResponse.BodyHandlers.ofString());
using Emailit;

var emailit = new EmailitClient("your_api_key");

var meta = emailit.Emails.GetMeta("em_abc123");
// This endpoint requires a direct API call
$response = Http::withToken('your_api_key')
  ->get('https://api.emailit.com/v2/emails/em_abc123/meta');
$meta = $response->json();
curl https://api.emailit.com/v2/emails/em_abc123/meta \
  -H "Authorization: Bearer your_api_key"

Response Fields

The response includes all email metadata fields plus an attachments array with attachment info (without the content field).

Attachment Object (Meta)

FieldTypeDescription
filenamestringAttachment filename
content_typestringMIME type
sizeintegerAttachment size in bytes
content_idstring | nullContent-ID for inline attachments
content_dispositionstring"attachment" or "inline"
{
  "object": "email",
  "id": "em_abc123xyz789def456ghi012jkl345",
  "type": "outbound",
  "token": "abc123xyz789",
  "message_id": "<abc123xyz789@yourdomain.com>",
  "from": "sender@yourdomain.com",
  "to": "recipient@example.com",
  "subject": "Hello World",
  "status": "delivered",
  "size": 4523,
  "scheduled_at": null,
  "created_at": "2026-01-08T12:00:00.123456Z",
  "updated_at": "2026-01-08T12:05:00.123456Z",
  "tracking": {
    "loads": true,
    "clicks": false
  },
  "meta": null,
  "headers": {
    "From": "sender@yourdomain.com",
    "To": "recipient@example.com",
    "Subject": "Hello World",
    "Content-Type": "multipart/mixed; boundary=----boundary123"
  },
  "attachments": [
    {
      "filename": "doc.pdf",
      "content_type": "application/pdf",
      "size": 12345,
      "content_id": null,
      "content_disposition": "attachment"
    }
  ]
}
{
  "object": "email",
  "id": "em_abc123xyz789def456ghi012jkl345",
  "type": "outbound",
  "token": "abc123xyz789",
  "message_id": "<abc123xyz789@yourdomain.com>",
  "from": "sender@yourdomain.com",
  "to": "recipient@example.com",
  "subject": "Hello World",
  "status": "delivered",
  "size": 4523,
  "scheduled_at": null,
  "created_at": "2026-01-08T12:00:00.123456Z",
  "updated_at": "2026-01-08T12:05:00.123456Z",
  "tracking": {
    "loads": true,
    "clicks": false
  },
  "meta": null,
  "headers": {
    "From": "sender@yourdomain.com",
    "To": "recipient@example.com",
    "Subject": "Hello World",
    "Content-Type": "text/html; charset=utf-8"
  },
  "attachments": []
}
{
  "error": "Email not found",
  "message": "Email with ID 'em_abc123' not found in your workspace"
}

Update Scheduled Email

Update a scheduled email’s send time. Only works for emails with status “scheduled” and only if the current scheduled time is at least 3 minutes in the future.

POST/emails/{id}

Path Parameters

idstringRequired

The email ID in em_xxx format.

Request Body

scheduled_atstringRequired

New scheduled time. Accepts ISO 8601 format, Unix timestamp, or natural language like tomorrow at 9am. Must be at least 3 minutes in the future.

POST /emails/{id}
import { Emailit } from '@emailit/node';
const emailit = new Emailit('your_api_key');

const email = await emailit.emails.update('em_abc123', {
  scheduled_at: '2026-01-10T09:00:00Z',
});
from emailit import EmailitClient
client = EmailitClient("your_api_key")

email = client.emails.update("em_abc123", {
  "scheduled_at": "2026-01-10T09:00:00Z"
})
$emailit = Emailit::client('your_api_key');

$email = $emailit->emails()->update('em_abc123', [
  'scheduled_at' => '2026-01-10T09:00:00Z',
]);
require "emailit"
client = Emailit::EmailitClient.new("your_api_key")

email = client.emails.update("em_abc123",
  scheduled_at: "2026-01-10T09:00:00Z"
)
import "github.com/emailit/emailit-go/v2"
client := emailit.NewClient("your_api_key")

email, err := client.Emails.Update("em_abc123", &emailit.UpdateEmailRequest{
  ScheduledAt: "2026-01-10T09:00:00Z",
})
use emailit::Emailit;

let emailit = Emailit::new("your_api_key");

let email = emailit.emails.update("em_abc123", emailit::types::UpdateEmailParams {
  scheduled_at: "2026-01-10T09:00:00Z".to_string(),
}).await?;
import com.emailit.*;
import com.emailit.params.*;

EmailitClient emailit = new EmailitClient("your_api_key");

EmailitObject email = emailit.emails().update("em_abc123",
  EmailUpdateParams.builder()
    .setScheduledAt("2026-01-10T09:00:00Z")
    .build()
);
using Emailit;

var emailit = new EmailitClient("your_api_key");

var email = emailit.Emails.Update("em_abc123", new EmailUpdateOptions {
  ScheduledAt = "2026-01-10T09:00:00Z",
});
use Emailit\Laravel\Facades\Emailit;

$email = Emailit::emails()->update('em_abc123', [
  'scheduled_at' => '2026-01-10T09:00:00Z',
]);
curl -X POST https://api.emailit.com/v2/emails/em_abc123 \
  -H "Authorization: Bearer your_api_key" \
  -H "Content-Type: application/json" \
  -d '{"scheduled_at": "2026-01-10T09:00:00Z"}'
curl -X POST https://api.emailit.com/v2/emails/em_abc123xyz789def456 \
  -H "Authorization: Bearer em_test_51RxCWJ...vS00p61e0qRE" \
  -H "Content-Type: application/json" \
  -d '{
    "scheduled_at": "tomorrow at 3pm"
  }'
{
  "object": "email",
  "id": "em_abc123xyz789def456ghi012jkl345",
  "status": "scheduled",
  "scheduled_at": "2026-01-10T15:00:00.000Z",
  "updated_at": "2026-01-08T12:00:00.123456Z",
  "message": "Email schedule has been updated successfully"
}
{
  "error": "Email not found",
  "message": "Email with ID 'em_abc123' not found in your workspace"
}
{
  "error": "Cannot update email",
  "message": "Scheduled emails can only be updated at least 3 minutes before the scheduled time. This email is scheduled to send in 2 minute(s)."
}
{
  "error": "Invalid scheduled_at",
  "message": "The new scheduled time must be at least 3 minutes in the future."
}

Cancel Email

Cancel a scheduled or pending email. For scheduled emails, cancellation is only allowed if the scheduled time is at least 3 minutes in the future.

POST/emails/{id}/cancel

Path Parameters

idstringRequired

The email ID in em_xxx format.

POST /emails/{id}/cancel
import { Emailit } from '@emailit/node';
const emailit = new Emailit('your_api_key');

const email = await emailit.emails.cancel('em_abc123');
from emailit import EmailitClient
client = EmailitClient("your_api_key")

email = client.emails.cancel("em_abc123")
$emailit = Emailit::client('your_api_key');

$email = $emailit->emails()->cancel('em_abc123');
require "emailit"
client = Emailit::EmailitClient.new("your_api_key")

email = client.emails.cancel("em_abc123")
import "github.com/emailit/emailit-go/v2"
client := emailit.NewClient("your_api_key")

email, err := client.Emails.Cancel("em_abc123")
use emailit::Emailit;

let emailit = Emailit::new("your_api_key");

let email = emailit.emails.cancel("em_abc123").await?;
import com.emailit.*;

EmailitClient emailit = new EmailitClient("your_api_key");

EmailitObject email = emailit.emails().cancel("em_abc123");
using Emailit;

var emailit = new EmailitClient("your_api_key");

var email = emailit.Emails.Cancel("em_abc123");
use Emailit\Laravel\Facades\Emailit;

$email = Emailit::emails()->cancel('em_abc123');
curl -X POST https://api.emailit.com/v2/emails/em_abc123/cancel \
  -H "Authorization: Bearer your_api_key"
{
  "object": "email",
  "id": "em_abc123xyz789def456ghi012jkl345",
  "status": "canceled",
  "message": "Email has been canceled successfully"
}
{
  "error": "Email not found",
  "message": "Email with ID 'em_abc123' not found in your workspace"
}
{
  "error": "Cannot cancel email",
  "message": "Email cannot be canceled. Current status: 'sent'. Only 'scheduled' or 'pending' emails can be canceled."
}
{
  "error": "Cannot cancel email",
  "message": "Scheduled emails can only be canceled at least 3 minutes before the scheduled time. This email is scheduled to send in 2 minute(s)."
}

Cancelable Email Statuses

StatusCan Cancel?Notes
pending✅ YesEmail is queued but not yet processed
scheduled✅ YesOnly if scheduled time is 3+ minutes away
sent❌ NoEmail already sent to mail server
delivered❌ NoEmail already delivered to recipient
bounced❌ NoEmail already processed
canceled❌ NoEmail already canceled

Retry Email

Retry an email that hard failed, errored, or was held. This creates a duplicate of the original email and sends it again. The new email gets its own ID.

POST/emails/{id}/retry

Path Parameters

idstringRequired

The email ID in em_xxx format.

POST /emails/{id}/retry
import { Emailit } from '@emailit/node';
const emailit = new Emailit('your_api_key');

const email = await emailit.emails.retry('em_abc123');
from emailit import EmailitClient
client = EmailitClient("your_api_key")

email = client.emails.retry("em_abc123")
$emailit = Emailit::client('your_api_key');

$email = $emailit->emails()->retry('em_abc123');
require "emailit"
client = Emailit::EmailitClient.new("your_api_key")

email = client.emails.retry("em_abc123")
import "github.com/emailit/emailit-go/v2"
client := emailit.NewClient("your_api_key")

email, err := client.Emails.Retry("em_abc123")
use emailit::Emailit;

let emailit = Emailit::new("your_api_key");

let email = emailit.emails.retry("em_abc123").await?;
import com.emailit.*;

EmailitClient emailit = new EmailitClient("your_api_key");

EmailitObject email = emailit.emails().retry("em_abc123");
using Emailit;

var emailit = new EmailitClient("your_api_key");

var email = emailit.Emails.Retry("em_abc123");
use Emailit\Laravel\Facades\Emailit;

$email = Emailit::emails()->retry('em_abc123');
curl -X POST https://api.emailit.com/v2/emails/em_abc123/retry \
  -H "Authorization: Bearer your_api_key"
{
  "object": "email",
  "id": "em_new789xyz456abc123",
  "original_id": "em_abc123xyz789def456",
  "status": "pending",
  "message": "Email has been queued for retry"
}
{
  "error": "Email not found",
  "message": "Email with ID 'em_abc123' not found in your workspace"
}
{
  "error": "Cannot retry email",
  "message": "Email cannot be retried. Current status: 'delivered'. Only 'failed', 'errored', or 'held' emails can be retried."
}

Retryable Email Statuses

StatusCan Retry?Notes
failed✅ YesEmail hard bounced
errored✅ YesEmail errored during processing
held✅ YesEmail was held for review
pending❌ NoEmail is already queued
sent❌ NoEmail already sent
delivered❌ NoEmail already delivered

Important Notes

  • Billing: Retried emails are billed as new emails based on standard pricing
  • New ID: The retried email gets a new ID, the original email remains unchanged
  • Original reference: The response includes original_id to link back to the original email