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
}
}'
const response = await fetch("https://api.credira.com/v1/send-email", {
method: "POST",
headers: {
Authorization: "Bearer YOUR_API_KEY",
"Content-Type": "application/json",
},
body: JSON.stringify({
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,
},
}),
});
const data = await response.json();
console.log(data);
{
"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"
}
}
Emails
Send Email
Trigger a new email to a customer
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
}
}'
const response = await fetch("https://api.credira.com/v1/send-email", {
method: "POST",
headers: {
Authorization: "Bearer YOUR_API_KEY",
"Content-Type": "application/json",
},
body: JSON.stringify({
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,
},
}),
});
const data = await response.json();
console.log(data);
{
"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
string
required
The unique identifier of the email template to use
string
required
The email address of the recipient
string
required
The name of the recipient
string
required
The unique identifier of the callout associated with this email
object
required
Key-value pairs for template variable substitution
string
ISO 8601 timestamp for when to send the email (optional, defaults to
immediate)
string
Priority level of the email (low, medium, high, urgent)
string
Type of email (payment_reminder, follow_up, welcome, notification, marketing)
object
Additional metadata for the email (campaign_id, department, etc.)
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
}
}'
const response = await fetch("https://api.credira.com/v1/send-email", {
method: "POST",
headers: {
Authorization: "Bearer YOUR_API_KEY",
"Content-Type": "application/json",
},
body: JSON.stringify({
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,
},
}),
});
const data = await response.json();
console.log(data);
{
"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"
}
}
