API Reference - Email Automation Settings

Link: https://support.brilliantdirectories.com/support/solutions/articles/12000108095

← Back to API Reference | Getting Started

Email Automation Settings

Email Automation Settings hold the settings for the five automatic billing emails: the new payment confirmation, the upcoming payment reminder and the three past due reminders. Each row controls one of those emails and matches one line on the Billing Email Settings page in the admin (see Billing Reminder Email Settings). The daily billing email run reads these rows to decide which invoices get an email, who receives it and when.

Model name in URL: email_automation_settings — DB table: email_automation_settings
Change the existing rows instead of adding new ones.
A website already has one row for each of the five rule_name values. To change a billing email, look up its rule_id with the list endpoint and send an update. Only use the create endpoint when the row for that rule_name is missing. Keep one row per rule_name: the Billing Email Settings page saves every row with the same name together, and a member receives at most one email per rule_name for each invoice, so extra rows never send a second reminder. Deleting a row turns that email off until a row with the same rule_name is added again.

The Email Automation Settings Object

FieldTypeDescription
rule_idintegerUnique rule ID (primary key, read-only)
rule_namestringWhich billing email this row controls. Must be one of new_payment_received, upcoming_reminder, past_due_reminder_1, past_due_reminder_2 or past_due_reminder_3 (see the table below). A row with any other name is saved but never sends an email. required on create
rule_email_daysintegerWhen the email is sent, shown as Send Email When on the Billing Email Settings page. For upcoming_reminder, the number of days before the invoice due date. For the three past due reminders, the number of days after the due date (0 sends it on the due date). Not used for new_payment_received, which is sent the day the payment is received; leave it at 0.
rule_email_memberintegerSend this email to the member: 1 yes, 0 no. Shown as Email Member. Any value other than 1, such as an email template name, means the member is not emailed.
rule_billing_cyclesstringComma-separated list of the billing cycles this email applies to. Allowed values: Monthly, Quarterly, Semi-Annually, Annually, Biennially, Triennially and One Time. The email is only sent for invoices whose billing cycle is in the list. Shown as Billing Cycles. An empty value turns this email off.
rule_email_adminintegerInclude these emails in the daily billing summary sent to the Default Website Email address: 1 yes, 0 no. Shown as Daily Admin Report.
rule_copy_adminintegerSend a copy of the member's email to the Default Website Email address: 1 yes, 0 no. Shown as Email Admin.
rule_email_attachmentintegerAttach the invoice PDF to the email: 1 yes, 0 no. Requires the Download Invoices add-on. Shown as Include Invoice PDF.
rule_updated_bystringEmail address of the admin who last updated this rule
revision_timestamptimestampTimestamp of the last modification (auto-managed)

Fields that are not listed above are not used for billing emails. The API may accept and return an extra field, but the billing email run ignores it.

Rule names and email templates

Each billing email always uses its own email template. The template is edited under Email Templates and can't be changed through this API.

rule_nameBilling Email Settings nameEmail templaterule_email_days counts
new_payment_receivedNew Payments Receivedinvoice_payment_receivedNot used (sent the same day)
upcoming_reminderUpcoming Payment Reminderinvoice_reminder_notice_firstDays before the due date
past_due_reminder_1Past Due Reminder #1invoice_overdue_notice_firstDays after the due date
past_due_reminder_2Past Due Reminder #2invoice_overdue_notice_secondDays after the due date
past_due_reminder_3Past Due Reminder #3invoice_overdue_notice_thirdDays after the due date

List Email Automation Settings

GET /api/v2/email_automation_settings/get

Example Request

Copy
curl -X GET "https://www.yourdomain.com/api/v2/email_automation_settings/get?limit=25" \
  -H "X-Api-Key: your-api-key-here"

Example Response

Copy
{
  "status": "success",
  "message": [
    {
      "rule_id": "1",
      "rule_name": "new_payment_received",
      "rule_email_days": "0",
      "rule_email_member": "1",
      "rule_billing_cycles": "Monthly,Annually",
      "rule_email_admin": "1",
      "rule_copy_admin": "0",
      "rule_email_attachment": "0",
      "rule_updated_by": "admin@example.com",
      "revision_timestamp": "2026-10-13 19:00:24"
    },
    {
      "rule_id": "2",
      "rule_name": "upcoming_reminder",
      "rule_email_days": "7",
      "rule_email_member": "1",
      "rule_billing_cycles": "Monthly,Annually",
      "rule_email_admin": "0",
      "rule_copy_admin": "0",
      "rule_email_attachment": "0",
      "rule_updated_by": "admin@example.com",
      "revision_timestamp": "2026-10-13 19:00:24"
    }
  ],
  "total": "5",
  "current_page": 1,
  "total_pages": 1
}

Retrieve an Email Automation Rule

GET /api/v2/email_automation_settings/get/{rule_id}

Example Request

Copy
curl -X GET "https://www.yourdomain.com/api/v2/email_automation_settings/get/2" \
  -H "X-Api-Key: your-api-key-here"

Example Response

Copy
{
  "status": "success",
  "message": [
    {
      "rule_id": "2",
      "rule_name": "upcoming_reminder",
      "rule_email_days": "7",
      "rule_email_member": "1",
      "rule_billing_cycles": "Monthly,Annually",
      "rule_email_admin": "0",
      "rule_copy_admin": "0",
      "rule_email_attachment": "0",
      "rule_updated_by": "admin@example.com",
      "revision_timestamp": "2026-10-13 19:00:24"
    }
  ],
  "total": 1,
  "current_page": 1,
  "total_pages": 1
}

Update an Email Automation Rule

PUT /api/v2/email_automation_settings/update

Updates the row identified by rule_id. The same rules as above apply: rule_name must be one of the five billing emails, the email template can't be changed here, and fields that are not listed in the object table are not used. This example sends the upcoming payment reminder to members 3 days before the due date for monthly and annual invoices, and copies the Default Website Email address on each one.

Example Request

Copy
curl -X PUT "https://www.yourdomain.com/api/v2/email_automation_settings/update" \
  -H "X-Api-Key: your-api-key-here" \
  -d "rule_id=2" \
  -d "rule_email_member=1" \
  -d "rule_billing_cycles=Monthly,Annually" \
  -d "rule_email_days=3" \
  -d "rule_copy_admin=1" \
  -d "rule_updated_by=admin%40example.com"

Example Response

Copy
{
  "status": "success",
  "message": {
    "rule_id": "2",
    "rule_name": "upcoming_reminder",
    "rule_email_days": "3",
    "rule_email_member": "1",
    "rule_billing_cycles": "Monthly,Annually",
    "rule_email_admin": "0",
    "rule_copy_admin": "1",
    "rule_email_attachment": "0",
    "rule_updated_by": "admin@example.com",
    "revision_timestamp": "2026-10-13 19:00:24"
  }
}

Create an Email Automation Rule

POST /api/v2/email_automation_settings/create

Adds the row for one of the five billing emails. Use it only when the list endpoint shows no row for that rule_name; otherwise update the existing row. This example adds an upcoming payment reminder sent to members 7 days before the due date of monthly and annual invoices.

Example Request

Copy
curl -X POST "https://www.yourdomain.com/api/v2/email_automation_settings/create" \
  -H "X-Api-Key: your-api-key-here" \
  -d "rule_name=upcoming_reminder" \
  -d "rule_email_days=7" \
  -d "rule_email_member=1" \
  -d "rule_billing_cycles=Monthly,Annually" \
  -d "rule_email_admin=0" \
  -d "rule_copy_admin=0" \
  -d "rule_email_attachment=0"

Example Response

Copy
{
  "status": "success",
  "message": {
    "rule_id": "6",
    "rule_name": "upcoming_reminder",
    "rule_email_days": "7",
    "rule_email_member": "1",
    "rule_billing_cycles": "Monthly,Annually",
    "rule_email_admin": "0",
    "rule_copy_admin": "0",
    "rule_email_attachment": "0",
    "rule_updated_by": null,
    "revision_timestamp": null
  }
}

Delete an Email Automation Rule

DELETE /api/v2/email_automation_settings/delete

Deletes the row identified by rule_id. Deleting one of the five rows turns that billing email off until a row with the same rule_name is created again.

Example Request

Copy
curl -X DELETE "https://www.yourdomain.com/api/v2/email_automation_settings/delete" \
  -H "X-Api-Key: your-api-key-here" \
  -d "rule_id=6"

Example Response

Copy
{
  "status": "success",
  "message": "email_automation_settings record was deleted"
}