Each API request must be sent in JSON format and consist of 3 main items: entity, action and params. It can also optionally contain an account_id:
The return value is a JSON object. It always contains a key "is_error", which is 0 or 1 accordingly. The other keys depend on the request being made and are detailed below. On an error the key "error_message" is set with the appropriate error message.
This section details each of the entities available, along with the possible actions and the parameters that should be sent.
In the case of a Multiple List, the contact entity performs operations on contacts in the central Address Book. For a Single List, it performs operations on List Members. The values for the standard API request are as follows:
Entity: | contact |
---|---|
Available actions: | get, create, delete, confirm |
Params: | JSON value. See below for details of required value. |
Options: |
|
The value for "params" depends on the action, as detailed in the following table:
Action | JSON value for params | Return value | Example request(s) |
---|---|---|---|
get | Standard search parameter | Object containing key "return", which contains object with contacts. Each item in the returned object has a key of the Simplelists ID and a value containing a contact object. |
Match surname{ "entity": "contact", "action":"get", "params": { "match": "all", "conditions": [ { "field": "surname", "value": "12%", "op":"like" } ] } }Match list { "entity": "contact", "action":"get", "params": { "match": "all", "conditions": [ { "field": "list", "value": { "name" : "test" } } ] } } |
create | Array of contact objects. Notes:
|
Object containing key "return", which contains array of contact IDs (either created or updated as applicable) |
Create multiple contacts
{ "entity": "contact", "action": "create", "params": [ { "surname": "John", "firstname": "Smith", "emails": [ { "email": "john@example.com" }, { "email":"jon@example.com" } ] }, { "surname": "Fred", "firstname": "Bloggs", "emails": [ { "email": "fred@example.com" } ] } ] }Add lists to existing contact { "entity": "contact", "action": "create", "options": { "append_lists": true }, "params": [ { "id": 821259, "lists": [ { "name": "mylist" } ] } ] } |
delete | An object with one of the four keys described below. Each key should contain an array
of the applicable values.
|
Standard error response. is_error will be 0 on success, and 1 on fail. | { "entity": "contact", "action": "delete", "params": { "cids": [ "3031292" ] } } |
confirm | An object with one of the two keys described below. Each key should contain an array
of the applicable values.
|
Standard error response. is_error will be 0 on success, and 1 on fail. | { "entity": "contact", "action": "confirm", "params": { "cids": [ "3031292" ] } } |
The membership entity only applies to a Multiple List account. It is used to remove contacts from lists and update the digest status of specific lists of a contact. When updating the digest status, the list membership must already exist. If it does not exist, an error is thrown. Only the digest status of the specified lists will be updated.
Entity: | membership |
---|---|
Available actions: | delete, update |
Params: | JSON value. See below for details of required value. |
The value for "params" depends on the action, as detailed in the following table:
Action | JSON value for params | Return value | Example request(s) |
---|---|---|---|
delete | An object with both the keys described below. Each key should contain an object
of the applicable values.
|
Standard error response. is_error will be 0 on success, and 1 on fail. | { "entity": "membership", "action": "delete", "params": { "contacts": { "ccids": [ "3031292" ] }, "lists": { "names": [ "listname" ] } } } |
update | An object with the keys described below.
|
Standard error response. is_error will be 0 on success, and 1 on fail. | { "entity": "membership", "action": "update", "params": { "contacts": { "ccids": [ "3031211" ] }, "lists": { "names": [ "listname" ] }, "digest": true } } |
The list entity is used to manage the creation, settings and deletion of lists. Creation and deletion of lists only applies to a Multiple List account.
Entity: | list |
---|---|
Available actions: | get, create, delete |
Params: | JSON value. See below for details of required value. |
The value for "params" depends on the action, as detailed in the following table:
Action | JSON value for params | Return value | Example request(s) |
---|---|---|---|
get | Standard search parameter, but field can only be name or id |
Array of list objects of each list. |
Match name{ "entity": "list", "action":"get", "params": { "match": "all", "conditions": [ { "field": "name", "value": "mylist%", "op": "like" } ] } }Match ID { "entity": "list", "action":"get", "params": { "match": "all", "conditions": [ { "field": "id", "value": 24381 } ] } } |
create | Array of list objects. Notes:
|
Object containing key "return", which contains an array of the IDs of the lists (either created or updated as applicable) |
{ "entity": "list", "action": "create", "params": [ { "name": "mylist", "maxlength": 1024, "subject_prefix": "[My prefix]", }, ] } |
delete | An object with one of the two keys described below. Each key should contain an array
of the applicable values.
|
Standard error response. is_error will be 0 on success, and 1 on fail. | { "entity": "list", "action": "delete", "params": { "ids": [ 23398 ] } } |
The following details the search parameter, which is used when searching for contacts with the "get" action:
The search parameter is a JSON object, consisting of 2 keys as follows:
match | Should contain either the value "all" (to only return values that match all criteria, boolean AND), or the value "any" (to return values that match any criteria - boolean OR). |
---|---|
conditions |
The conditions to match. An array of objects with the following keys:
|
This section details the various objects that are sent and received by the API.
The contact object contains details of a contact in your account. Not all of the keys apply to all functions.
id | Integer containing the Simplelists contact ID |
---|---|
ccid | Integer containing custom contact ID |
surname | String containing the contact's surname |
firstname | String containing the contact's firstname |
String containing a single email address | |
emails | An array of email objects (see below) |
added | Date the contact was added |
notes | String containing any notes |
lists | An array of list objects (see below) |
String containing the email address | |
id | Integer containing Simplelists email ID |
ceid | Integer containing custom email ID |
digest | Whether the email address receives the list digest |
confirmed | Whether the email address has been confirmed |
confsent | Whether a confirmation request has been sent |
pause_delivery | Whether delivery to the email address is paused |
id | Integer containing Simplelists internal list ID |
---|---|
name | String containing list name |
maxlength | Maximum message size in KB |
truncate | Length in bytes to truncate messages to, or null to disable |
subject_prefix | Subject prefix of the list |
moderator | Alternative moderator of the list |
subs_memberview | Whether list members can view other members (noemail , withemail , all-noemail , all-withemail or empty string to disable) |
message_footer | Plain text message footer of the list |
message_footer_html | HTML message footer of the list |
reply_to | The reply-to email address of the list (null for the list default, empty string to disable) |
strip_attachments | Set to a true value to strip attachments from messages |
hold_automated | Set to a true value to hold automated emails for approval |
restrict_post_emails | An array of email addresses to restrict posting to, in the same format as the web interface (moderate must also be set appropriately) |
restrict_post_lists | An array of list names to restrict posting to (moderate must also be set appropriately) |
moderate | The posting restrictions. Any of the following values can be ANDed together:
|
hold_message | The message that is sent back to the sender if their list email is held for approval.
The following variables are available:
|
hold_subject | The subject of the message that is sent back to the sender if their list email is held for approval.
The following variables are available:
|
reject_message | The message that is sent back to the sender if their list email is rejected.
The following variables are available:
|
reject_subject | The subject of the message that is sent back to the sender if their list email is rejected.
The following variables are available:
|
archive_enabled | Set to a true value to enable archives |
archive_spammode | Set to a true value to hide email addresses in the archives |
archive_protected | Set to a true value to disable open access of the archives |
archive_password | If set, this is the password to access the archives (archive_protected must also be enabled). If set to a blank value, password access to list archives is disabled. This parameter can only be set, not retrieved. |
archive_memberview | Set to a true value to allow list members to access protected archives (archive_protected must also be enabled to protect the archives). |
member_count | Total number of members on this list (get requests only). |