Contact lists
These methods manage the contact lists stored on the platform, for your account or for your sub-accounts. To load contacts directly into a campaign without going through a list, see Campaign recipients.
They are all called with POST, with a JSON body that contains your api_key. Parameter tables do not repeat it. See the common rules.
List an account’s lists
Access point: https://www.mdworks.fr/api_http/list_list
This method returns the contact lists of an account or a sub-account.
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
user_id | integer | no | ID of the account whose lists you want (see user_list). If missing, the main account’s lists are returned |
Example of posted data:
{
"api_key": "YOUR_API_KEY",
"user_id": "4781"
}Response: an array of objects.
| Field | Description |
|---|---|
id | unique ID of the list |
nom | name of the list |
field_email | field that holds the email address |
field_sms | field that holds the mobile phone number, empty if none |
total_lignes | number of contacts in the list |
[
{
"id": "254698",
"nom": "BASE_TEST_EDIWARE",
"field_email": "EMAIL",
"field_sms": "",
"total_lignes": "100868"
},
{
"id": "125478",
"nom": "My new list",
"field_email": "EMAIL",
"field_sms": "",
"total_lignes": "254"
}
]Errors:
| Message | Cause |
|---|---|
Problem with this user | the sub-account does not exist or does not belong to your account |
Read a list’s fields
Access point: https://www.mdworks.fr/api_http/list_fields
This method returns the fields of a contact list. Use it to match your data to the list’s fields before a list_insert or a list_insert_or_update. The list can belong to your account or to one of your sub-accounts.
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
list_id | integer | yes | ID of the list (see list_list) |
Example of posted data:
{
"api_key": "YOUR_API_KEY",
"list_id": 4567
}Response:
{
"list_id": 4567,
"name": "Prospects 2026",
"field_email": "email",
"field_sms": "",
"fields": [
{"name": "email", "type": "varchar(1000)"},
{"name": "nom", "type": "varchar(1000)"}
]
}| Field | Description |
|---|---|
name | name of the list |
field_email, field_sms | field used as email address or SMS number. Its case may differ from the one in fields |
fields[].name | field name, in lowercase. These are exactly the keys to use in the tab_insert of list_insert. The platform’s technical fields are not listed |
fields[].type | data type of the field |
Errors:
| Message | Cause |
|---|---|
Error list_id is missing or is not numeric | |
Error this list not owned by auth user | the list belongs neither to your account nor to one of your sub-accounts |
Error No fields in this list | the list has no fields |
Create a list
Access point: https://www.mdworks.fr/api_http/list_create
This method creates a new list for an account or a sub-account.
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
nom | text | yes | name of the list |
field_list | text | yes | comma-separated list of fields, letters and the _ character only. 50 fields at most |
field_email | text | yes | name of the field that holds the email addresses. It must appear in field_list |
field_index | text | no | comma-separated fields on which search is enabled, with the same names as in field_list. 20 fields at most |
user_id | integer | no | ID of the account on which to create the list (see user_list). If missing, the list is created on the main account |
email_crypt | 0 or 1 | no | 0 by default. With 1, email addresses are never accessible to the user, but they can still be used in campaigns |
Example of posted data:
{
"api_key": "YOUR_API_KEY",
"user_id": "4781",
"nom": "My new list",
"field_list": "email,nom,prenom,civilite,societe,code_naf",
"field_index": "code_naf",
"field_email": "email"
}Response: the ID of the new list.
{"list_id": "33541"}Errors:
| Message | Cause |
|---|---|
Param nom is missing | |
Param field_list is missing | |
Param field_email is missing | |
Error field_list as disallowed characters | a character other than a letter, _ or a comma |
Error field_index as disallowed characters | |
Error field_email as disallowed characters | |
Error field_email not in field_list | field_email is not in field_list |
Problem with this user | the sub-account does not exist or does not belong to your account |
Delete a list
Access point: https://www.mdworks.fr/api_http/list_delete
This method deletes a contact list from your account or from one of your sub-accounts.
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
list_id | integer | yes | ID of the list to delete (see list_list) |
Example of posted data:
{
"api_key": "YOUR_API_KEY",
"list_id": "4781"
}Response:
{"result": "ok"}Errors:
| Message | Cause |
|---|---|
Error list_id is missing | |
Error list_id should ne numeric | list_id is not a number |
Error this list not owned by auth user | the list belongs neither to your account nor to one of your sub-accounts |
Error this list protected against delete, go to the dashboard | the list is protected against deletion. The protection can be removed in the interface |
Insert contacts into a list
Access point: https://www.mdworks.fr/api_http/list_insert
This method inserts contacts into a list of an account or a sub-account. You send the data in the call (“push” method).
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
list_id | integer | yes | ID of the list (see list_list) |
tab_insert | array of objects | yes | contacts to insert, 255 rows at most per call |
Each row of tab_insert is an object whose keys are the list’s field names, as returned by list_fields. Their order does not matter. Only the field holding the email address is required, missing fields are filled with an empty value.
For performance reasons, we advise against adding rows one by one: group them in batches.
Example of posted data:
{
"api_key": "YOUR_API_KEY",
"list_id": "4781",
"tab_insert": [
{"email": "test@test.com", "nom": "Dupont", "prenom": "Martin", "civilite": "Monsieur"},
{"email": "test1@test.com", "nom": "Durant", "prenom": "Myrlène"}
]
}Example of a PHP variable:
$tab = array(
0 => array("email" => "test@test.com", "nom" => "Dupont", "prenom" => "Martin", "civilite" => "Monsieur"),
1 => array("email" => "test1@test.com", "nom" => "Durant", "prenom" => "Myrlène", "civilite" => "Madame")
);Response:
{"result": "ok"}Errors:
| Message | Cause |
|---|---|
Error list_id is missing | |
Error this list not owned by auth user | the list belongs neither to your account nor to one of your sub-accounts |
Error tab_insert is missing | |
Error tab_insert is not an array | |
Error No fields in this list | the list has no fields |
Insert contacts from a URL
Access point: https://www.mdworks.fr/api_http/list_insert_url
With this method (“get”), you give the platform the URL of a file that it fetches itself. The data must be in CSV format, with a semicolon as separator.
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
list_id | integer | yes | ID of the list (see list_list) |
url | text | yes | URL of the CSV file that contains the data to insert |
Example of posted data:
{
"api_key": "YOUR_API_KEY",
"list_id": "4781",
"url": "https://www.example.com/export/mylist.csv"
}Response:
{"result": "ok"}Errors:
| Message | Cause |
|---|---|
Error list_id is missing | |
Error url is missing | |
Error this list not owned by auth user | the list belongs neither to your account nor to one of your sub-accounts |
Insert or update contacts
Access point: https://www.mdworks.fr/api_http/list_insert_or_update
This method inserts new contacts and updates existing contacts in a list of an account or a sub-account.
If there are no updates to handle, prefer list_insert: list_insert_or_update is slower, because it checks whether each row already exists.
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
list_id | integer | yes | ID of the list (see list_list) |
tab_insert | array of objects | yes | contacts to insert or update, 255 rows at most per call, in the same format as for list_insert |
index_key | text | yes | field used for the lookup, to know whether a row is a new contact or a contact to update |
For an existing contact, only the fields present in the row are updated: a missing field keeps its value. A field sent empty or null is emptied.
index_key field must have the “uniqueness” setting enabled in the interface, otherwise an error is returned. This check prevents existing data from being compromised.Example of posted data:
{
"api_key": "YOUR_API_KEY",
"list_id": "4781",
"tab_insert": [
{"email": "test@test.com", "nom": "Dupont", "prenom": "Martin", "civilite": "Monsieur"},
{"email": "test1@test.com", "nom": "Durant", "prenom": "Myrlène"}
],
"index_key": "email"
}Response:
{"result": "ok"}Errors:
| Message | Cause |
|---|---|
Error list_id is missing | |
Error this list not owned by auth user | the list belongs neither to your account nor to one of your sub-accounts |
Error tab_insert is missing | |
Error tab_insert is not an array | |
Error No fields in this list | the list has no fields |
Error index_key should not be empty | |
Error index_key is not in the list of fields | index_key matches no field of the list |
Error index_key must have the unique property activated in the interface | enable “uniqueness” on this field in the interface |