List Management

Through the List Management API you can create new lists, subscribe new users to your existing lists, manage segments and create or delete custom columns.

The List Management API is used to create and manage lists (collections) and the content of each list (content of each collection). The content of each list corresponds to the subscribers.Therefore, this API not only allows you to manage lists, also allows you to edit, create, delete subscribers and segments, among other functions.

  • Lists: Create a new list where subscribers can be added or imported via JSON or CSV file.
  • Subscribers: You can add or remove subscribers one by one or multiple subscribers, fetch and update their information and batch import new subscribers.
  • Segments: Create targeted sub-groups of subscribers based on conditions you set.

Manage Lists

The List endpoints allow you to create, delete, and get Lists on behalf of an authenticated user. For these endpoints, there are three methods available: POST, DELETE and GET. The POST method allows you to create a List, the DELETE method allows you to delete a List, and the GET method allows you to get information from a list.

Creating List

The first step is creating a new list by adding subscribers via JSON body or from a CSV file.

To set up a list, you need to define the columns and rows that the new list will contain. Once defined, the next step is to add one or more subscribers to the list.

Therefore, this endpoint allows you to create a new list and add subscribers to the list in the same request.

📘

NOTE

Type for list's columns will be inferred using the first value found for the column if using a CSV file.

HTTP Request : POST /lists

In the following request body example, we are going to create a list called "NewSusbcribers" that includes 2 columns defined as ("name" and "email") and 1 subscriber named (“Julian”).

📘

NOTE

When you create a new list, three columns will be added automatically : “id”, “email”, “mobile”, “devices”, “devices_type”.

When you create any of the automatically generated columns (“id”, “email”, “mobile”, “devices”, “devices_type”) with the same name, they will be replaced with the new column you create.

Let's create the request body example by creating the list and adding one subscriber in JSON format.

  • JSON format
{
  "name": "NewSubscribers",
  "columns": [
    {
      "name": "name",
      "type": "STRING"
    },
    {
      "name": "email",
      "type": "STRING"
    }
  ],
  "rows": [
    {
      "Name": "Julian",
      "Email": "[email protected]"
    }
  ]
}

The parameters presented in the request body example when creating the List in JSON format are the following:

Parameter Required Description
name Yes

Name of the new list.

columns Yes

This array stores information about the columns that the list contains.

columns.name Yes

Name of the column.

columns.type Yes

Data type the column stores.

  • "STRING": Sequence of characters, digits, or symbols. Always treated as text.
  • "NUMBER": Numeric data type for numbers without fractions.
  • "BOOLEAN":True or false values.
  • "DATE": Date is represented in UTC format: (yyyy-mm-dd-Thh:mm:ss.ssZ).
columns.unique No

The value of the column is unique.

  • true: Value column is unique.
  • false: Value column is not unique.

For example: the phone number column is unique, therefore the phone number of each subscriber cannot be repeated.

columns.required No

The value of the column is required (mandatory).

  • true: Value column is required.
  • false: Value column is not required.

columns.defaultValue No

The value of the column is default.

  • null: There is no default value.
  • "open": End user clicked on the short URL link.

For example: If the column defined as "City" has the default value "Caracas", all subscribers who register without a city will be set as Caracas by default.

rows Yes

This array stores information about the subscribers that the list contains.

Add one by one in JSON format each subscriber you want to include in the list.

Set as parameter the name of the column that was defined and its value.

Now let's create the request body example by creating the list and adding one subscriber by importing a CSV file locally.

  • CSV file

Example CSV File format:

📘

NOTE

The maximum size of the CSV file should be 200 MB as a limit. If the file exceeds, the response will fail.

curl -X POST "https://elastic.messangi.me/qarth/v3/lists?trackLastActivity=false&name=<LIST_NAME>&usesAut7Columns=true&caseSensitive=false&usesGeneratedData=true" -H "accept: application/json" -H "Authorization: Bearer <API_KEY>" -H "Content-Type: multipart/form-data" -F "csvFile=@<CSV_FILE_NAME>.csv;type=text/csv"

The parameters presented in the request body example when creating the List by importing a CSV file are the following:

Parameter Required Description
name Yes

Name of the new list.

csvFile Yes

CSV file with list columns and its content.

key No

Key of the list. It must be null or empty if an auto generated key is wanted.

usesAutoColumns No

Indicate if the list is using auto generated columns.

  • true: Sequence of characters, digits, or symbols. Always treated as text.
  • false: The list does not use auto generated columns.
caseSensitive No

Indicate if the list is using case sensitive columns.

  • true: The list is using case sensitive columns.
  • false: The list does not use sensitive columns

usesGeneratedData No

Indicate if empty unique columns are to be populated with fake data.

  • true: The empty unique columns are to be populated with fake data (must use an auto-generated id).
  • false: The empty unique columns will not be populated with fake data.

trackLastActivity No

Indicate if the list is going to track subscriber last activity.

  • true: The list is going to track subscriber last activity.
  • false: The list is not going to track subscriber last activity.

When you created the list in JSON format or imported a CSV file, the response body contains the following data:


{
  "meta": {
    "timestamp": 1689704359002,
    "transactionId": "2bab46a1-c3ee-45e4-b396-c846"
  },
  "data": {
    "id": 95343,
    "columns": [
      {
        "name": "name",
        "type": "STRING",
        "defaultValue": null,
        "indexed": false,
        "required": false,
        "unique": false,
        "customConfiguration": null
      },
      {
        "name": "email",
        "type": "STRING",
        "defaultValue": null,
        "indexed": true,
        "required": false,
        "unique": true,
        "customConfiguration": null
      },
      {
        "name": "id",
        "type": "STRING",
        "defaultValue": null,
        "indexed": true,
        "required": true,
        "unique": true,
        "customConfiguration": null
      },
      {
        "name": "mobile",
        "type": "STRING",
        "defaultValue": null,
        "indexed": true,
        "required": false,
        "unique": true,
        "customConfiguration": null
      },
      {
        "name": "devices",
        "type": "STRING",
        "defaultValue": null,
        "indexed": true,
        "required": false,
        "unique": false,
        "customConfiguration": null
      },
      {
        "name": "devices_type",
        "type": "STRING",
        "defaultValue": null,
        "indexed": true,
        "required": false,
        "unique": false,
        "customConfiguration": null
      }
    ],
    "name": "NewSubscribers",
    "userName": "[email protected]",
    "size": 1,
    "key": "id",
    "autoId": true,
    "usesAutoColumns": true,
    "caseSensitive": false,
    "usesGeneratedData": true,
    "lastUpdated": "2023-07-18T18:19:18.977256025",
    "createdAt": "2023-07-18T18:19:18.825373698",
    "status": "OK",
    "totalLines": 1,
    "percentProcessed": 100
  }
}

Parameters presented in the response body example when creating the list are the following:

Parameter Description
data Data contained in the list.
data.id Unique identifier of the list.
data.columns

This array stores information about the columns that the list contains.

data.columns.name

Name of the column.

data.columns.type

Data type the column stores.

  • "STRING": Sequence of characters, digits, or symbols. Always treated as text.
  • "NUMBER": Numeric data type for numbers without fractions.
  • "BOOLEAN":True or false values.
  • "DATE": Date is represented in UTC format: (yyyy-mm-dd-Thh:mm:ss.ssZ).
data.columns.defaultValue

Optional. The value of the column is default.

  • null: There is no default value.
  • "open": End user clicked on the short URL link.

For example: If the column defined as "City" has the default value "Caracas", all subscribers who register without a city will be set as Caracas by default.

data.columns.required

Optional. The value of the column is required (mandatory).

  • true: Value column is required.
  • false: Value column is not required.

data.columns.unique

Optional.The value of the column is unique.

  • true: Value column is unique.
  • false: Value column is not unique.

For example: the phone number column is unique, therefore the phone number of each subscriber cannot be repeated.

data.name Name of the new list.
data.userName Owner or creator of the list.
data.size Total of rows (subscribers) added to the list.
data.key

Optional. Applies only when importing a CSV file.

Key of the list. It must be null or empty if an auto generated key is wanted.

data.usesAutoColumns

Optional. Applies only when importing a CSV file.

Indicate if the list is using auto generated columns.

  • true: Sequence of characters, digits, or symbols. Always treated as text.
  • false: The list does not use auto generated columns.
data.caseSensitive

Optional. Applies only when importing a CSV file.

Indicate if the list is using case sensitive columns.

  • true: The list is using case sensitive columns.
  • false: The list does not use sensitive columns

data.usesGeneratedData

Optional. Applies only when importing a CSV file.

Indicate if empty unique columns are to be populated with fake data.

  • true: The empty unique columns are to be populated with fake data (must use an auto-generated id).
  • false: The empty unique columns will not be populated with fake data.

data.lastUpdated Date when the last update or status change.
data.createdAt Date when the list has been created.
data.status

Status of the list.

  • OK: The list has been created successfully.

data.totalLines

The total number of rows the list contains.

data.percentProcessed

Total percentage of the list creation process.

📘

NOTE

Copy the parameter data.id ("listId") located in the response body for future requests.

Getting List

When a List is previously created, we proceed to get the information from a single list.

HTTP Request : GET /lists/{listId}

To get a list information, you need to provide the unique identifier of the list you want to retrieve the information.

Required ParameterDescription
listIdUnique identifier of the list.

Deleting List

When a List is previously created, we can delete a single list.

HTTP Request : DELETE /lists/{listId}

To delete a list, you need to provide the unique identifier of the list you want to delete.

Required ParameterDescription
listIdUnique identifier of the list.

Manage Subscribers

Keeping your subscriptions lists up to date is essential to reaching the right audience. There are a combination of APIs that allow you to add, edit or delete subscribers. With these methods you can ensure that no one misses out on your campaigns.

Adding Subscribers

The second step is adding new subscribers to the list created via JSON body or importing a CSV file.

HTTP Request: POST /lists/{listId}/subscribers/bulk

In the following example, we are going to add 3 new subscribers to the “New Subscribers” list created previously.

To add subscribers to a specific list, you need to provide the unique identifier of the list you want to add the new subscribers to.

Required ParameterDescription
listIdUnique identifier of the list.

Let's create the request body example by creating the list and adding the three subscribers in JSON format.**

  • JSON format
[
  {
    "name": "Albert",
    "email": "[email protected]"
  },
  {
    "name": "Elizabeth",
    "email": "[email protected]"
  },
  {
    "name": "Amanda",
    "email": "[email protected]"
  }
]

The parameters presented in the request body example when creating the List in JSON format are the 2 columns that were defined when the list was created: "name" and "email". And the values that correspond to the previously mentioned columns.

Now let's create the request body example by creating the list and adding the three subscribers by importing a CSV file locally.

  • CSV file

Example CSV File format:

📘

NOTE

The maximum size of the CSV file should be 200 MB as a limit. If the file exceeds, the response will fail.

curl -X POST "https://elastic.messangi.me/qarth/v3/lists/<LIST_ID>/subscribers/bulk" -H "accept: application/json" -H "Authorization: Bearer <API_KEY>" -H "Content-Type: multipart/form-data" -F "csvFile=@<CSV_FILE_NAME>.csv;type=text/csv"

When you added the subscribers to the list in JSON format or imported a CSV file, the response body contains the following data:

{
  "meta": {
    "timestamp": 1689736657744,
    "transactionId": "8e8ac3e5-8394-4342-9aa8"
  },
  "data": {
    "subscriberUpdated": 0,
    "subscriberAdded": 3,
    "subscribersError": []
  }
}

Parameters presented in the response body example when creating the list are the following:

Parameter Description
data Data contained in the list.
data.subscriberUpdated Total number of subscribers that have been updated.
data.subscriberAdded

Total number of subscribers that have been added to the list.

data.subscribersError

Total number of errors when adding or updating subscribers to the list.

Getting Subscribers

When the subscribers have been added to a specific list, we proceed to get the information of all the subscribers that the list contains.

HTTP Request: GET /lists/{listId}/subscribers

To get subscribers information, you need to provide the unique identifier of the list you want to retrieve the subscribers information.

Required ParameterDescription
listIdUnique identifier of the list.

Once executed the API call, from the response body you can get the unique identifier (“id”) of each subscriber the list contains.

Deleting Subscriber

When the subscribers have been added to a specific list, we can delete a single subscriber.

HTTP Request: DELETE /lists/{listId}/subscribers/{subscriberId}

To delete a subscriber, you need to provide the unique identifier of the list and the subscriber id you want to delete.

Required ParameterDescription
listIdUnique identifier of the list.
subscriberIdUnique identifier of the subscriber.