Overview

You can use this request to create a new subscription list. Subscription lists are used to send email campaigns to groups of contacts. A contact will have a subscription status on a list, denoting whether or not the contact should receive messages when a campaign is sent to that list.

The Method

API-Method
RESTPOSThttps://[Your URL]/api/2.0/lists
XML-RPCCalllists.CreateList

Your method must be structured as follows:

Parameters

PropertyTypeDescriptionRequired
$propertiesstructarrayAn array of the properties of the list you need to create.yes

Properties

PropertyTypeDescriptionDefaultRequiredRead Only
list_group_idintegerList group identifier.0 nono
namestringName of the list.emptyyesno
public_namestringPublic name of the list.emptynono
owner_namestringName of the list owner.emptynono
owner_emailstringEmail address for the list owner.emptyyesno
owner_reply_emailstringThe list owner’s reply address.emptynono
company_namestringNameemptynono
company_addressstringAddressemptynono
company_citystringCityemptynono
company_statestringStateemptynono
company_countrystringCountryemptynono
company_postal_codestringPostal Codeemptynono
company_telephonestringTelephone Numberemptynono
company_mobilestringMobile Numberemptynono
company_faxstringFax Numberemptynono
company_emailstringEmail Addressemptynono
company_urlstringURLemptynono
notify_owner_on_list_subscribestringNotify owner on list subscribe Possible values:
yes
no
nonono
notify_owner_on_list_unsubscribestringNotify owner on list unsubscribe Possible values:
yes
no
nonono
ask_for_unsubscribe_reasonstringAsk for reason on list unsubscribe Possible Values:
yes
no
nonono
send_unsubscribe_confirmationstringConfirmation message sent on unsubscribe Possible values:
yes
no
nonono
redirect_url_on_unsubscribestringCustom unsubscribe URLemptynono

Responses

TypeDescription
integerThe ID of the created list.

Code Samples

PHP (using REST API):

$json = '
{
"name":"This is the name of the list",
"owner_email":"[email protected]"
}
';
$url = '(Your URL)/api/2.0/lists';
$method = 'POST';
$cSession = curl_init();
$headers = array();
$auth = base64_encode($username . ':' . $apikey);
$headers[] = 'Authorization: Basic ' . $auth;
curl_setopt($cSession, CURLOPT_URL, $url);
curl_setopt($cSession, CURLOPT_RETURNTRANSFER, true);
curl_setopt($cSession, CURLOPT_HEADER, false);
curl_setopt($cSession, CURLOPT_CUSTOMREQUEST, strtoupper($method));
curl_setopt($cSession, CURLOPT_POSTFIELDS, $json);
$headers[] = 'Content-Type: application/json';
curl_setopt($cSession, CURLOPT_HTTPHEADER, $headers);
$result = curl_exec($cSession);
curl_close($cSession);