API Reference - Email Lists

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

← Back to API Reference | Getting Started

Email Lists

Email Lists track individual email addresses that have been added to or removed from your site's mailing lists. Each record represents a single email subscription entry including its subscription status, source, and associated token.

Model name in URL: email_list — DB table: email_list

The Email List Object

FieldTypeDescription
idintegerUnique record ID (primary key, read-only)
emailstringEmail address of the subscriber required on create
typestringList type or source identifier (EG subscribe, unsubscribe)
date_addedstringDate the record was added (format: YYYYMMDDHHmmss)
statusintegerSubscription status: 1 active, 0 inactive
tokenstringUnique token assigned to this subscription entry
cookiestringCookie value associated with the subscription action
httprstringHTTP referrer URL at time of subscription
pagestringPage URL where the subscription was initiated

List Email List Records

GET /api/v2/email_list/get

Example Request

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

Example Response

Copy
{
  "status": "success",
  "message": [
    {
      "id": "1",
      "email": "subscriber@example.com",
      "type": "subscribe",
      "date_added": "20240301120000",
      "status": "1",
      "token": "abc123token",
      "cookie": "",
      "httpr": "https://www.example.com/signup",
      "page": "/signup"
    }
  ],
  "total": "100",
  "current_page": 1,
  "total_pages": 4,
  "next_page": "MipfKjI1"
}

Retrieve an Email List Record

GET /api/v2/email_list/get/{id}

Example Request

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

Example Response

Copy
{
  "status": "success",
  "message": [
    {
      "id": "1",
      "email": "subscriber@example.com",
      "type": "subscribe",
      "date_added": "20240301120000",
      "status": "1",
      "token": "abc123token",
      "cookie": "",
      "httpr": "https://www.example.com/signup",
      "page": "/signup"
    }
  ],
  "total": "100",
  "current_page": 1,
  "total_pages": 1
}

Create an Email List Record

POST /api/v2/email_list/create

Example Request

Copy
curl -X POST "https://www.yourdomain.com/api/v2/email_list/create" \
  -H "X-Api-Key: your-api-key-here" \
  -d "email=subscriber%40example.com" \
  -d "type=subscribe" \
  -d "status=1" \
  -d "date_added=20240401120000"

Example Response

Copy
{
  "status": "success",
  "message": {
    "id": "101",
    "email": "subscriber@example.com",
    "type": "subscribe",
    "date_added": "20240401120000",
    "status": "1",
    "token": null,
    "cookie": null,
    "httpr": null,
    "page": null
  }
}

Update an Email List Record

PUT /api/v2/email_list/update

Example Request

Copy
curl -X PUT "https://www.yourdomain.com/api/v2/email_list/update" \
  -H "X-Api-Key: your-api-key-here" \
  -d "id=101" \
  -d "status=0"

Example Response

Copy
{
  "status": "success",
  "message": {
    "id": "101",
    "email": "subscriber@example.com",
    "type": "subscribe",
    "status": "0"
  }
}

Delete an Email List Record

DELETE /api/v2/email_list/delete

Example Request

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

Example Response

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