POST
/
send-email
curl --request POST \
     --url https://api.credira.com/v1/send-email \
     --header 'Authorization: Bearer YOUR_API_KEY' \
     --header 'Content-Type: application/json' \
     --data '{
       "template_id": "template_123456789",
       "recipient_email": "customer@example.com",
       "recipient_name": "John Doe",
       "callout_id": "callout_987654321",
       "variables": {
         "customer_name": "John Doe",
         "invoice_number": "INV-001",
         "amount": "1250.00",
         "due_date": "2024-01-30"
       },
       "scheduled_time": "2024-01-15T14:30:00Z",
       "priority": "high",
       "email_type": "payment_reminder",
       "metadata": {
         "campaign_id": "camp_123",
         "department": "billing",
         "invoice_amount": 1250.0
       }
     }'
{
  "success": true,
  "data": {
    "id": "email_123456789",
    "template_id": "template_123456789",
    "callout_id": "callout_987654321",
    "recipient_email": "customer@example.com",
    "recipient_name": "John Doe",
    "subject": "Payment Reminder - Invoice #INV-001",
    "status": "scheduled",
    "scheduled_time": "2024-01-15T14:30:00Z",
    "account_id": "acc_789123456",
    "created_time": "2024-01-15T10:30:00Z",
    "email_type": "payment_reminder",
    "priority": "high",
    "estimated_delivery": "2024-01-15T14:30:00Z",
    "tracking_id": "track_456789123",
    "metadata": {
      "campaign_id": "camp_123",
      "department": "billing",
      "invoice_amount": 1250.0
    }
  },
  "meta": {
    "timestamp": "2024-01-15T10:30:00Z",
    "request_id": "req_123456789",
    "message": "Email has been scheduled successfully"
  }
}
Trigger a new email to a customer using a template and recipient information.
This endpoint sends an email using a specified template with variable substitution. The email will be sent immediately or scheduled for later delivery.

Request

template_id
string
required
The unique identifier of the email template to use
recipient_email
string
required
The email address of the recipient
recipient_name
string
required
The name of the recipient
callout_id
string
required
The unique identifier of the callout associated with this email
variables
object
required
Key-value pairs for template variable substitution
scheduled_time
string
ISO 8601 timestamp for when to send the email (optional, defaults to immediate)
priority
string
Priority level of the email (low, medium, high, urgent)
email_type
string
Type of email (payment_reminder, follow_up, welcome, notification, marketing)
metadata
object
Additional metadata for the email (campaign_id, department, etc.)
Authorization
string
required
Bearer token for API authentication
curl --request POST \
     --url https://api.credira.com/v1/send-email \
     --header 'Authorization: Bearer YOUR_API_KEY' \
     --header 'Content-Type: application/json' \
     --data '{
       "template_id": "template_123456789",
       "recipient_email": "customer@example.com",
       "recipient_name": "John Doe",
       "callout_id": "callout_987654321",
       "variables": {
         "customer_name": "John Doe",
         "invoice_number": "INV-001",
         "amount": "1250.00",
         "due_date": "2024-01-30"
       },
       "scheduled_time": "2024-01-15T14:30:00Z",
       "priority": "high",
       "email_type": "payment_reminder",
       "metadata": {
         "campaign_id": "camp_123",
         "department": "billing",
         "invoice_amount": 1250.0
       }
     }'
{
  "success": true,
  "data": {
    "id": "email_123456789",
    "template_id": "template_123456789",
    "callout_id": "callout_987654321",
    "recipient_email": "customer@example.com",
    "recipient_name": "John Doe",
    "subject": "Payment Reminder - Invoice #INV-001",
    "status": "scheduled",
    "scheduled_time": "2024-01-15T14:30:00Z",
    "account_id": "acc_789123456",
    "created_time": "2024-01-15T10:30:00Z",
    "email_type": "payment_reminder",
    "priority": "high",
    "estimated_delivery": "2024-01-15T14:30:00Z",
    "tracking_id": "track_456789123",
    "metadata": {
      "campaign_id": "camp_123",
      "department": "billing",
      "invoice_amount": 1250.0
    }
  },
  "meta": {
    "timestamp": "2024-01-15T10:30:00Z",
    "request_id": "req_123456789",
    "message": "Email has been scheduled successfully"
  }
}
{
  "success": false,
  "error": {
    "code": "INVALID_REQUEST",
    "message": "Missing required field: template_id"
  },
  "meta": {
    "timestamp": "2024-01-15T10:30:00Z",
    "request_id": "req_123456789"
  }
}
{
  "success": false,
  "error": {
    "code": "UNAUTHORIZED",
    "message": "Invalid or missing API key"
  },
  "meta": {
    "timestamp": "2024-01-15T10:30:00Z",
    "request_id": "req_123456789"
  }
}
{
  "success": false,
  "error": {
    "code": "VALIDATION_ERROR",
    "message": "Invalid email address format",
    "details": "Email address must be a valid format"
  },
  "meta": {
    "timestamp": "2024-01-15T10:30:00Z",
    "request_id": "req_123456789"
  }
}
{
  "success": false,
  "error": {
    "code": "RATE_LIMITED",
    "message": "Too many email requests. Please wait before sending another email."
  },
  "meta": {
    "timestamp": "2024-01-15T10:30:00Z",
    "request_id": "req_123456789"
  }
}