CreateContact

Creates a contact

This method creates a new contact within the account and adds it to the 'All contacts' address book.

Setting the OptInType to 'VerifiedDouble' will result in a double opt-in confirmation email being sent to the contact. The result will state that the contact's OptInType is 'Double' and Status is 'PendingOptIn'. These will only update to 'VerifiedDouble' and 'Subscribed' respectively once the contact has clicked the link in the confirmation email, at which point they will be added to the account.

Note that it is possible to update an existing contact using this operation. A duplicate contact will not be created. If the contact already exists, then any data provided in your request that is already held for the contact will be overwritten and updated in the system.

📘

Are you importing multiple contacts?

If you're looking to import or update multiple contacts at once, then we highly recommend using ImportContacts instead.

It allows you to import a file and has the benefit of being a single API call only, making it far less likely that your account will exceed its API calls per hour limit.

SOAP action: http://apiconnector.com/v2/ApiService/CreateContact

📘

Input and output parameters

The input and output parameters for this method are:

Input parameters

  • Email - required; string
  • OptInType - optional; string ('Unknown', 'Single', 'Double', 'VerifiedDouble')
  • EmailType - optional; string ('PlainText', 'Html')
  • DataFields - optional; array of ContactData
    • ContactData
      • Key - string
      • Value - anyType (please note: the data type needs to be defined for the value, such as 'string', 'numeric', 'date' or 'boolean'; e.g., for 'Firstname', the XML would need to be as follows - <apic:Value xsi:type="xsd:string">John</apic:Value>

Output parameters

  • CreateContactResult
    • Id - integer
    • Email - string
    • OptInType - string ('Unknown', 'Single', 'Double', 'VerifiedDouble')
    • EmailType - string ('PlainText', 'Html')
    • DataFields - optional; array of ContactData
      • ContactData
        • Key - string
        • Value - anyType
    • Status - string ('Subscribed', 'Unsubscribed', 'SoftBounced', 'HardBounced', 'IspComplained', 'MailBlocked', 'PendingOptIn', 'DirectComplaint', 'Deleted', 'SharedSuppression', 'Suppressed', 'NotAllowed', 'DomainSuppression', 'NoMxRecord')

Example

using (var client = new ApiServiceClient())
{
	client.ClientCredentials.UserName.UserName = "username";
	client.ClientCredentials.UserName.Password = "password";

	var contact = new ApiContact {
	    Email = "[email protected]",
	    OptInType = ApiContactOptInTypes.Single,
	    EmailType = ApiContactEmailTypes.Html,
	    DataFields = new[] {
			new ApiContactData { Key = "FirstName", Value = "John" },
      new ApiContactData { Key = "FullName", Value = "John Smith" }, 
      new ApiContactData { Key = "Gender", Value = "Male" },  
      new ApiContactData { Key = "LastName", Value = "Smith" },  
			new ApiContactData { Key = "Postcode", Value = "N5 1DP" }
		}
	};
	var createdContact = client.CreateContact(contact);
}