API Reference - Email Auto Sent

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

← Back to API Reference | Getting Started

Email Auto Sent

Email Auto Sent records track every individual email sent through the automated campaign system. Each record represents a single email delivered to a single recipient and contains the full send result, including status, response, and the rendered email content.

Model name in URL: email_auto_sent — DB table: email_auto_sent

The Email Auto Sent Object

FieldTypeDescription
sent_idintegerUnique send record ID (primary key, read-only)
auto_idintegerID of the automation rule that triggered this send; 0 for campaign sends
user_idintegerID of the member/user who received the email; 0 for contacts
date_sentstringDate and time the email was sent (format: YYYYMMDDHHmmss)
email_namestringName of the email template used for this send
email_sentintegerWhether the send was attempted: 1 yes, 0 no
user_typestringRecipient type: Contact or Member
schedule_idintegerID of the campaign (from email_schedule) this send belongs to
category_idintegerCategory ID associated with the campaign
emailstringRecipient email address
senderstringSMTP provider used (EG sendgrid, jangosmtp)
statusstringSend result status: success, error, or provider-specific value
responsetextRaw response from the SMTP provider
typestringSend type: live for production sends, test for test sends, editsite for admin-triggered sends
unique_keystringUnique identifier for this send, used to prevent duplicate sends
smartlistsstringSmart list reference the recipient matched (EG smartlists[8])
email_subjectstringThe actual subject line sent to the recipient (after merge tag substitution)
email_htmltextThe full rendered HTML content of the email as delivered

List Email Auto Sent Records

GET /api/v2/email_auto_sent/get

Example Request

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

Example Response

Copy
{
  "status": "success",
  "message": [
    {
      "sent_id": "1",
      "auto_id": "0",
      "user_id": "0",
      "date_sent": "20230725125305",
      "email_name": "newsletter-spring",
      "email_sent": "1",
      "user_type": "Contact",
      "schedule_id": "101",
      "category_id": "0",
      "email": "recipient@example.com",
      "sender": "sendgrid",
      "status": "success",
      "response": "{\"message\":\"success\"}",
      "type": "live",
      "unique_key": "bGl2ZTEwMXJlY2lwaWVudA==",
      "smartlists": "smartlists[2]",
      "email_subject": "Spring Newsletter",
      "email_html": "

Hello, here is your spring update.

" } ], "total": "4", "current_page": 1, "total_pages": 1, "next_page": "" }

Retrieve an Email Auto Sent Record

GET /api/v2/email_auto_sent/get/{sent_id}

Example Request

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

Example Response

Copy
{
  "status": "success",
  "message": [
    {
      "sent_id": "1",
      "auto_id": "0",
      "user_id": "0",
      "date_sent": "20230725125305",
      "email_name": "newsletter-spring",
      "email_sent": "1",
      "user_type": "Contact",
      "schedule_id": "101",
      "category_id": "0",
      "email": "recipient@example.com",
      "sender": "sendgrid",
      "status": "success",
      "response": "{\"message\":\"success\"}",
      "type": "live",
      "unique_key": "bGl2ZTEwMXJlY2lwaWVudA==",
      "smartlists": "smartlists[2]",
      "email_subject": "Spring Newsletter",
      "email_html": "

Hello, here is your spring update.

" } ], "total": "4", "current_page": 1, "total_pages": 1 }

Create an Email Auto Sent Record

POST /api/v2/email_auto_sent/create

Example Request

Copy
curl -X POST "https://www.yourdomain.com/api/v2/email_auto_sent/create" \
  -H "X-Api-Key: your-api-key-here" \
  -d "email=recipient%40example.com" \
  -d "email_name=welcome-new-member" \
  -d "schedule_id=101" \
  -d "user_id=55" \
  -d "user_type=Member" \
  -d "email_sent=1" \
  -d "sender=sendgrid" \
  -d "status=success" \
  -d "type=live" \
  -d "date_sent=20240401120000"

Example Response

Copy
{
  "status": "success",
  "message": {
    "sent_id": "5",
    "auto_id": null,
    "user_id": "55",
    "date_sent": "20240401120000",
    "email_name": "welcome-new-member",
    "email_sent": "1",
    "user_type": "Member",
    "schedule_id": "101",
    "category_id": null,
    "email": "recipient@example.com",
    "sender": "sendgrid",
    "status": "success",
    "response": null,
    "type": "live",
    "unique_key": null,
    "smartlists": null,
    "email_subject": null,
    "email_html": null
  }
}

Update an Email Auto Sent Record

PUT /api/v2/email_auto_sent/update

Example Request

Copy
curl -X PUT "https://www.yourdomain.com/api/v2/email_auto_sent/update" \
  -H "X-Api-Key: your-api-key-here" \
  -d "sent_id=5" \
  -d "status=error" \
  -d "response=bounce"

Example Response

Copy
{
  "status": "success",
  "message": {
    "sent_id": "5",
    "email": "recipient@example.com",
    "status": "error",
    "response": "bounce",
    "email_name": "welcome-new-member"
  }
}

Delete an Email Auto Sent Record

DELETE /api/v2/email_auto_sent/delete

Example Request

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

Example Response

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