Skip to main content
AhaSend offers two API versions for sending emails. This page helps you understand the differences so you can choose the right one when creating credentials.
API v1 is in maintenance mode. It will continue to work, but all new features and improvements go to API v2. We recommend API v2 for new integrations.

Quick Comparison

API v1API v2
StatusMaintenance modeActively developed
EndpointsSingle (POST /v1/email/send)Full REST API with multiple resources
AuthenticationX-Api-Key headerAuthorization: Bearer header
Send emailsUp to 100 recipients per requestUp to 100 recipients per request
AttachmentsYesYes
Custom headersYesYes
Reply-toYesYes
Template substitutionsNoYes (global and per-recipient)
AMP email contentNoYes
CC/BCCNoYes (via conversation endpoint)
Message tagsNoYes
Scheduled deliveryNoYes
Message cancellationNoYes
Per-message tracking controlsNoYes (override account defaults)
Retention controlsNoYes
Sandbox modeNoYes
IdempotencyNoYes
Granular API key scopesNoYes
Resource managementNoYes (domains, webhooks, routes, etc.)
Reporting & analyticsNoYes

When to Use API v1

API v1 is a single endpoint for sending emails. Choose it if you are maintaining an existing integration that already uses v1. For new integrations, use API v2.

When to Use API v2

API v2 is the recommended choice for all new integrations. It includes everything v1 can do, plus:
  • Template substitutions with MiniJinja — global and per-recipient
  • AMP email content for interactive emails
  • CC/BCC support via the conversation message endpoint
  • Message tags for categorization
  • Scheduled delivery and message cancellation
  • Per-message tracking controls to override account-level open/click tracking settings
  • Retention controls for metadata and content
  • Sandbox mode for testing without delivery
  • Idempotency for safe retries
  • Granular API key scopes for least-privilege security
  • Full resource management — domains, webhooks, routes, suppressions, and more
  • Delivery analytics and reporting

Key Differences in Detail

Authentication

Uses an X-Api-Key header:
curl -X POST https://api.ahasend.com/v1/email/send \
  -H "X-Api-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ ... }'

Request Structure

Email content is nested under a content object. Fields use text_body and html_body:
{
  "from": { "email": "hello@yourdomain.com", "name": "Your Company" },
  "recipients": [
    { "email": "user@example.com", "name": "John Doe" }
  ],
  "content": {
    "subject": "Hello!",
    "text_body": "Plain text content",
    "html_body": "<p>HTML content</p>",
    "attachments": [
      {
        "data": "base64-encoded-data",
        "base64": true,
        "file_name": "document.pdf",
        "content_type": "application/pdf"
      }
    ],
    "reply_to": { "email": "reply@yourdomain.com" },
    "headers": { "X-Custom-Header": "value" }
  }
}

Response Format

Returns 201 Created with aggregate counts:
{
  "success_count": 1,
  "fail_count": 0,
  "failed_recipients": [],
  "errors": []
}
Errors return a status string:
{ "status": "domain is not yours" }

Beyond Sending: Managing Resources with API v2

API v1 only sends emails. API v2 provides a complete management API:

Messages

Send, retrieve, list, and cancel messages

Domains

Add, verify, and manage sending domains

Webhooks

Create and manage webhook endpoints for delivery events

Routes

Configure inbound email routing rules

Suppressions

Manage bounce and complaint suppression lists

Reports

Access deliverability, bounce, and delivery time analytics

SMTP Credentials

Create and manage SMTP credentials

API Keys

Create and manage API keys programmatically

Migrating from v1 to v2

1

Create an API v2 key

Go to Credentials and create a new credential with type “API Key v2”.
2

Update authentication

Replace the X-Api-Key header with Authorization: Bearer YOUR_V2_KEY.
3

Update the endpoint

Change the URL from /v1/email/send to /v2/accounts/{account_id}/messages.
4

Update the request body

  • Move content.subject to top-level subject
  • Rename content.text_body to text_content
  • Rename content.html_body to html_content
  • Move content.attachments to top-level attachments
  • Move content.headers to top-level headers
  • Move content.reply_to to top-level reply_to
5

Update response handling

  • v1 returns 201 with success_count/fail_count — v2 returns 202 with a data array of per-recipient message objects
  • v1 error responses use a status field — v2 uses a message field

Next Steps

API v2 Credentials

Create and manage API v2 keys

Send Emails with v2

Full guide with examples

API v1 Reference

Legacy API v1 endpoint reference

API v2 Reference

Complete API v2 documentation