API Reference - Email Logs

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

← Back to API Reference | Getting Started

Email Logs

Email Logs record transactional emails sent from the platform, including admin-to-member emails, lead notifications, and system messages. Each record captures the full message, recipient, sender, and delivery status for audit and troubleshooting purposes.

Model name in URL: email_log — DB table: email_log

The Email Log Object

FieldTypeDescription
email_idintegerUnique log record ID (primary key, read-only)
subjecttextSubject line of the email
tostringRecipient email address
messagetextFull HTML or plain-text body of the email
date_sentstringDate and time the email was sent (format: YYYYMMDDHHmmss)
user_idintegerID of the member associated with this email; 0 if no member
contact_idintegerID of the contact associated with this email; 0 if no contact
typestringType of email (EG lead, system, admin)
sent_bystringIdentifier of who or what triggered the send (EG an admin email address or system process name)
lead_idintegerID of the related lead record; 0 if not lead-related
statustextDelivery status or provider response message

List Email Log Records

GET /api/v2/email_log/get

Example Request

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

Example Response

Copy
{
  "status": "success",
  "message": [
    {
      "email_id": "1",
      "subject": "You have a new lead inquiry",
      "to": "member@example.com",
      "message": "

You received a new lead from your listing.

", "date_sent": "20240301143000", "user_id": "42", "contact_id": "0", "type": "lead", "sent_by": "system", "lead_id": "17", "status": "success" } ], "total": "500", "current_page": 1, "total_pages": 20, "next_page": "MipfKjI1" }

Retrieve an Email Log Record

GET /api/v2/email_log/get/{email_id}

Example Request

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

Example Response

Copy
{
  "status": "success",
  "message": [
    {
      "email_id": "1",
      "subject": "You have a new lead inquiry",
      "to": "member@example.com",
      "message": "

You received a new lead from your listing.

", "date_sent": "20240301143000", "user_id": "42", "contact_id": "0", "type": "lead", "sent_by": "system", "lead_id": "17", "status": "success" } ], "total": "500", "current_page": 1, "total_pages": 1 }

Create an Email Log Record

POST /api/v2/email_log/create

Example Request

Copy
curl -X POST "https://www.yourdomain.com/api/v2/email_log/create" \
  -H "X-Api-Key: your-api-key-here" \
  -d "subject=New+lead+from+your+listing" \
  -d "to=member%40example.com" \
  -d "message=%3Cp%3EYou+have+a+new+lead.%3C%2Fp%3E" \
  -d "date_sent=20240401120000" \
  -d "user_id=42" \
  -d "type=lead" \
  -d "sent_by=system" \
  -d "lead_id=18" \
  -d "status=success"

Example Response

Copy
{
  "status": "success",
  "message": {
    "email_id": "501",
    "subject": "New lead from your listing",
    "to": "member@example.com",
    "message": "

You have a new lead.

", "date_sent": "20240401120000", "user_id": "42", "contact_id": null, "type": "lead", "sent_by": "system", "lead_id": "18", "status": "success" } }

Update an Email Log Record

PUT /api/v2/email_log/update

Example Request

Copy
curl -X PUT "https://www.yourdomain.com/api/v2/email_log/update" \
  -H "X-Api-Key: your-api-key-here" \
  -d "email_id=501" \
  -d "status=bounced"

Example Response

Copy
{
  "status": "success",
  "message": {
    "email_id": "501",
    "to": "member@example.com",
    "status": "bounced"
  }
}

Delete an Email Log Record

DELETE /api/v2/email_log/delete

Example Request

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

Example Response

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