Create a free account

API Documentation

MailBuild

Subscriber.AddWithCustomFields

Use this method to easily add a subscriber and associated custom field data to an existing list.

Arguments

The parameters you need to pass in are:

ApiKey (Required)
Your API application key. See here for more details.
ListID (Required)
The list you want to add the subscriber to. See here for more details.
Email (Required)
The email address of the new subscriber.
Name (Required)
The name of the new subscriber. If the name is unknown, an empty string can be passed in.
CustomFields (Required)
An array of custom fields for the subscriber.

SOAP

The following is a sample SOAP request to add a subscriber with custom fields. The placeholders shown need to be replaced with actual values.

POST http://yoursitename.createsend.com/api/api.asmx HTTP/1.1
Content-Type: text/xml; charset=utf-8
SOAPAction: "http://api.createsend.com/api/Subscriber.AddWithCustomFields"

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
 xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <Subscriber.AddWithCustomFields xmlns="http://api.createsend.com/api/">
      <ApiKey>string</ApiKey>
      <ListID>string</ListID>
      <Email>string</Email>
      <Name>string</Name>
      <CustomFields>
        <SubscriberCustomField>
          <Key>string</Key>
          <Value>string</Value>
        </SubscriberCustomField>
        <SubscriberCustomField>
          <Key>string</Key>
          <Value>string</Value>
        </SubscriberCustomField>
      </CustomFields>
    </Subscriber.AddWithCustomFields>
  </soap:Body>
</soap:Envelope>

Here is the response you will receive.

HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xmlns:xsd="http://www.w3.org/2001/XMLSchema"
  xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <Subscriber.AddWithCustomFieldsResponse xmlns="http://api.createsend.com/api/">
      <Subscriber.AddWithCustomFieldsResult>
        <Code>int</Code>
        <Message>string</Message>
      </Subscriber.AddWithCustomFieldsResult>
    </Subscriber.AddWithCustomFieldsResponse>
  </soap:Body>
</soap:Envelope>

Error Codes

1: Invalid email address
The email value passed in was an invalid email address.
100: Invalid API Key
The API key passed was not valid or has expired.
101: Invalid ListID
The ListID value passed in was not valid.