Subscribe to List

The Subscribe command allows you to add a Contact to a list and update the Contact's data.


The Subscribe command requires the following arguments: Command, Realm, Password, List, Format, and Data.


The command is ‘sub', the realm is ‘myrealm’ and the password is ‘mypass’.  A plain text format subscription for '' will be added to list_id='5'.

The Subscribe command expects as least one field in the Data argument.  The email address of the contact is always required to create a subscription record.  If the contact does not yet exist, a Contact record will be created using the email address as the primary key.  If the contact does exist, the Contact record will be updated with any data defined in the Data fields.

You can add one or many contacts with the same subscribe command.  To add multiple contacts, include additional contacts separated by the carat (^) character.  Each additional contact must have the same number of data fields defined.

The Subscribe command supports the following arguments:







Defines the command to use.





Name of the realm to run the command.  This is required, and the command will fail if the realm and password do not match.





Authentication code for API access.  This is required, and the command will fail if the realm and password do not match.



List ID


Identifier of the list to apply the command.




The format of the email message content to send.

Plain Text = 1 HTML = 2 Multipart MIME = 99




Force Subscribe


When a Contact unsubscribes, in some instances an opt-out record is created preventing future subscriptions.  To force a subscription, set Force Subscribe to 1.  Records are not updated by default.




Override Subscription Confirmation Requirement


Lists include an option to require a contact to Confirm a subscription request through Subscription forms, Subscribe Links, and API calls.  If this option is enabled, the API subscribe command will not add the subscription until after the contact clicks a link to confirm they wish to be added to the List. 

To ignore the requirement, set override_confirmation argument to 1.  The subscription will be created and the confirmation email will not be sent to the contact.

override_confirmation= [0,1]



Data Yes Contact related data.  Email is always required, and additional fields are optional.




Using all commands and arguments (please note the command is wrapped for display purposes only):


The contact, ‘’, will be subscribed to list ‘5’ in the realm ‘myrealm’ with the option to receive MIME messages.   If the list requires subscription confirmation, the subscription will be created without the confirmation.

If a record for the contact already exists, then it will be updated.  If it does not exist, a new record will be created with the first name, ‘Jane’, last name, ‘Doe’, and custom field “gender” set to ‘female’.  Any optouts for the email address will be removed. 

Duplicate Contact

To add a contact with the same email, but different first name and allow a duplicate instead of updating an existing contact, add the Duplicate flag to the DATA argument:


A contact with the same email address will be created with the first name, ‘JD’, last name, ‘Doe’, and custom field “gender” set to ‘female’. 

Successful results return:

SUCCESS: Total Records Processed 1, Total Subscriptions 1, Records Added 1, Records Updated 0, Records Ignored (Optout Error)0, Records Failed Other Error 0  

Multiple Contacts

To add multiple contacts in one command: 


In addition to the first record example above, a second and third record are created.

Successful results return:

SUCCESS: Total Records Processed 3, Total Subscriptions 3, Records Added 3, Records Updated 0, Records Ignored (Optout Error)0, Records Failed Other Error 0  

Customer Key Example

Some systems have the ability to define a unique Customer Key per contact.  If your realm has Customer Key enabled, then you must include the customer_key in the data argument along with email.  For example:

api_web?r=myrealm&p=mypass&c=sub&list_id=5&format=99&force_sub=1&data=customer_key, email,first,last,custom_gender^11293,,Jane,Doe,female

If the Customer Key is not included, the command will fail.

Publishing Flight Example

Some Realms have the ability to deploy campaigns to contacts in a specified order, called the Publishing Flight ID.  If your realm has Publishing Flight enabled, then you can include the publishing_flight_id in the data argument along with email.  For example:

api_web?r=myrealm&p=mypass&c=sub&list_id=5&format=99&force_sub=1&data= email,first,last,custom_gender,publishing_flight_id^,Jane,Doe,female,25


The Subscribe command outputs either a SUCCESS or FAILURE message. 


The Subscribe command success message returns the SUCCESS message and includes information about the records processed.  The result format is:

SUCCESS: Total Records Processed [number_a], Total Subscriptions [number_b], Records Added [number_c], Records Updated [number_d], Records Ignored (Optout Error)[number_e], Records Failed Other Error [number_f]

The numbers reported in the results include the following:


Total Records Processed

Number of email addresses in the command

Total Subscriptions

Number of subscriptions added or updated

Records Added

Number of new Contacts

Records Updated

Number of Contacts that already existed and updated

Records Ignored Optout Error

Number of Contacts not subscribed because an optout was encountered.  Can only be 0 if force_sub=1, or no optouts encountered.

Records Failed Other Error

Number of contacts not subscribed because of some other error


A Subscribe command will fail for several reasons, such as if an invalid list is specified or an optout is encountered.  The result format is:

FAILURE: [Reason]  

*Publishing Flight added in v16.16

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request


Powered by Zendesk