curl --request GET \
--url https://api.credira.com/v1/email-templates?account_id=acc_987654321 \
--header 'Authorization: Bearer YOUR_API_KEY' \
--header 'Content-Type: application/json'
const response = await fetch(
"https://api.credira.com/v1/email-templates?account_id=acc_987654321",
{
method: "GET",
headers: {
Authorization: "Bearer YOUR_API_KEY",
"Content-Type": "application/json",
},
}
);
const data = await response.json();
console.log(data);
{
"success": true,
"data": [
{
"id": "template_123456789",
"account_id": "acc_987654321",
"name": "Payment Reminder Template",
"subject": "Payment Reminder - Invoice #{{invoice_number}}",
"category": "payment_reminder",
"status": "active",
"html_content": "<html><body><h1>Payment Reminder</h1><p>Dear {{customer_name}},</p><p>This is a reminder that your invoice #{{invoice_number}} for ${{amount}} is due on {{due_date}}.</p><p>Please make your payment as soon as possible.</p><p>Best regards,<br>Credira Team</p></body></html>",
"text_content": "Payment Reminder\n\nDear {{customer_name}},\n\nThis is a reminder that your invoice #{{invoice_number}} for ${{amount}} is due on {{due_date}}.\n\nPlease make your payment as soon as possible.\n\nBest regards,\nCredira Team",
"variables": ["customer_name", "invoice_number", "amount", "due_date"],
"created_time": "2024-01-15T10:30:00Z",
"updated_time": "2024-01-15T10:30:00Z",
"created_by": "user_456789123",
"usage_count": 150,
"last_used": "2024-01-15T09:30:00Z",
"metadata": {
"department": "billing",
"priority": "high",
"tags": ["payment", "reminder", "invoice"]
}
}
],
"meta": {
"timestamp": "2024-01-15T10:30:00Z",
"request_id": "req_123456789",
"total_templates": 1
}
}
Emails
Get Email Templates
Retrieve email templates for an account
GET
/
email-templates
curl --request GET \
--url https://api.credira.com/v1/email-templates?account_id=acc_987654321 \
--header 'Authorization: Bearer YOUR_API_KEY' \
--header 'Content-Type: application/json'
const response = await fetch(
"https://api.credira.com/v1/email-templates?account_id=acc_987654321",
{
method: "GET",
headers: {
Authorization: "Bearer YOUR_API_KEY",
"Content-Type": "application/json",
},
}
);
const data = await response.json();
console.log(data);
{
"success": true,
"data": [
{
"id": "template_123456789",
"account_id": "acc_987654321",
"name": "Payment Reminder Template",
"subject": "Payment Reminder - Invoice #{{invoice_number}}",
"category": "payment_reminder",
"status": "active",
"html_content": "<html><body><h1>Payment Reminder</h1><p>Dear {{customer_name}},</p><p>This is a reminder that your invoice #{{invoice_number}} for ${{amount}} is due on {{due_date}}.</p><p>Please make your payment as soon as possible.</p><p>Best regards,<br>Credira Team</p></body></html>",
"text_content": "Payment Reminder\n\nDear {{customer_name}},\n\nThis is a reminder that your invoice #{{invoice_number}} for ${{amount}} is due on {{due_date}}.\n\nPlease make your payment as soon as possible.\n\nBest regards,\nCredira Team",
"variables": ["customer_name", "invoice_number", "amount", "due_date"],
"created_time": "2024-01-15T10:30:00Z",
"updated_time": "2024-01-15T10:30:00Z",
"created_by": "user_456789123",
"usage_count": 150,
"last_used": "2024-01-15T09:30:00Z",
"metadata": {
"department": "billing",
"priority": "high",
"tags": ["payment", "reminder", "invoice"]
}
}
],
"meta": {
"timestamp": "2024-01-15T10:30:00Z",
"request_id": "req_123456789",
"total_templates": 1
}
}
Retrieve all email templates associated with a specific account ID.
This endpoint returns all available email templates for the specified account,
including both active and inactive templates.
Request
string
required
The unique identifier of the account to retrieve email templates for
string
Filter templates by status. Possible values:
active, inactive, draftstring
Filter templates by category. Possible values:
payment_reminder,
follow_up, welcome, notification, marketingstring
required
Bearer token for API authentication
curl --request GET \
--url https://api.credira.com/v1/email-templates?account_id=acc_987654321 \
--header 'Authorization: Bearer YOUR_API_KEY' \
--header 'Content-Type: application/json'
const response = await fetch(
"https://api.credira.com/v1/email-templates?account_id=acc_987654321",
{
method: "GET",
headers: {
Authorization: "Bearer YOUR_API_KEY",
"Content-Type": "application/json",
},
}
);
const data = await response.json();
console.log(data);
{
"success": true,
"data": [
{
"id": "template_123456789",
"account_id": "acc_987654321",
"name": "Payment Reminder Template",
"subject": "Payment Reminder - Invoice #{{invoice_number}}",
"category": "payment_reminder",
"status": "active",
"html_content": "<html><body><h1>Payment Reminder</h1><p>Dear {{customer_name}},</p><p>This is a reminder that your invoice #{{invoice_number}} for ${{amount}} is due on {{due_date}}.</p><p>Please make your payment as soon as possible.</p><p>Best regards,<br>Credira Team</p></body></html>",
"text_content": "Payment Reminder\n\nDear {{customer_name}},\n\nThis is a reminder that your invoice #{{invoice_number}} for ${{amount}} is due on {{due_date}}.\n\nPlease make your payment as soon as possible.\n\nBest regards,\nCredira Team",
"variables": ["customer_name", "invoice_number", "amount", "due_date"],
"created_time": "2024-01-15T10:30:00Z",
"updated_time": "2024-01-15T10:30:00Z",
"created_by": "user_456789123",
"usage_count": 150,
"last_used": "2024-01-15T09:30:00Z",
"metadata": {
"department": "billing",
"priority": "high",
"tags": ["payment", "reminder", "invoice"]
}
}
],
"meta": {
"timestamp": "2024-01-15T10:30:00Z",
"request_id": "req_123456789",
"total_templates": 1
}
}
{
"success": false,
"error": {
"code": "INVALID_REQUEST",
"message": "Missing required parameter: account_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": "NOT_FOUND",
"message": "Account not found"
},
"meta": {
"timestamp": "2024-01-15T10:30:00Z",
"request_id": "req_123456789"
}
}
{
"success": false,
"error": {
"code": "RATE_LIMITED",
"message": "Rate limit exceeded"
},
"meta": {
"timestamp": "2024-01-15T10:30:00Z",
"request_id": "req_123456789"
}
}
