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
The unique identifier of the email template to use
The email address of the recipient
The name of the recipient
The unique identifier of the callout associated with this email
Key-value pairs for template variable substitution
ISO 8601 timestamp for when to send the email (optional, defaults to
immediate)
Priority level of the email (low, medium, high, urgent)
Type of email (payment_reminder, follow_up, welcome, notification, marketing)
Additional metadata for the email (campaign_id, department, etc.)
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"
}
}