email marketing solutions
Hiya Mail API
Add Subscriber to a List

The XML document structure for 'Adding a subscriber and associated custom details' request is as follows:
  • xmlrequest (Required)
    • username - The user name used to login to the Hiya Mail. (Required)
    • usertoken - The unique token assigned to the user account used above. (Required)
    • requesttype - The name of the API file in question. (Required)
    • requestmethod - The name of the function being called. (Required)
    • details (Required)
      • emailaddress - The email address of the contact being added. (Required)
      • mailinglistid - The list that the contact is located within. (Required)
      • confirmed - Sets the confirmation status of the subscriber to confirmed or not (yes or y or true or 1) (Not required, default to unconfirmed)
      • format - The format of the email campaigns that this contact prefers to receive
      • (html or h or text or t) (defaults to text)
      • customfields
        • item
          • fieldid - The id of the custom field being added.
          • value - The value to be added to this custom field.

Successful Response
Upon submission of a valid 'add subscriber to list submission a contact will be added to the contact list and the contacts id number returned.

The format is as follows:
  • response
    • status - The value of the status field will be "SUCCESS" for a successful response.
    • data - The contacts ID number.

Sample Request (XML)
The following code sample performs an insertion of the user 'email@domain.com' into the mailing list with ID '1' , status set to 'confirmed' , format set to 'html' and with a custom field set to 'John Smith'.
<xmlrequest> 
<username>admin</username> 
<usertoken>d467e49b221137215ebdab1ea4e046746de7d0ea</usertoken> 
<requesttype>subscribers</requesttype> 
<requestmethod>AddSubscriberToList</requestmethod> 
<details> 
<emailaddress>email@domain.com</emailaddress> 
<mailinglist>1</mailinglist> 
<format>html</format> 
<confirmed>yes</confirmed> 
<customfields> 
<item> 
<fieldid>1</fieldid> 
<value>John Smith</value> 
</item> 
</customfields> 
</details> 
</xmlrequest>

Sample Request (PHP)
The following sample code is written in PHP and makes use of PHP's CURL functionality to insert the above XML into the application.
<?php 

$xml = '<xmlrequest> 
<username>admin</username> 
<usertoken>d467e49b221137215ebdab1ea4e046746de7d0ea</usertoken> 
<requesttype>subscribers</requesttype>
<requestmethod>AddSubscriberToList</requestmethod> 
<details> 
<emailaddress>email@domain.com</emailaddress> 
<mailinglist>1</mailinglist> 
<format>html</format> 
<confirmed>yes</confirmed> 
<customfields> 
<item> 
<fieldid>1</fieldid> 
<value>John Smith</value> 
</item> 
</customfields> 
</details> 
</xmlrequest>'; 
 
$ch= curl_init('http://www.hiyamail.com/API/xml.php'); 
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 
curl_setopt($ch, CURLOPT_POST, 1); 
curl_setopt($ch, CURLOPT_POSTFIELDS, $xml); 

$result = @curl_exec($ch); 
if($result === false) 
{ 
  echo"Error performing request"; 
}  

else
{ 
 $xml_doc= simplexml_load_string($result); 
 echo'Status is ', $xml_doc->status, '<br/>'; 
 if($xml_doc->status =='SUCCESS') 
 { 
  echo'Data is ', $xml_doc->data, '<br/>'; 
 }
 else
 { 
 echo'Error is ', $xml_doc->errormessage, '<br/>'; 
 } 
} 

?> 

Highly Competitive Pricing

We make a mockery of other email providers' rates. Contact us today to find out how much you can save.
Learn more

Natural Selection

Find out which of your email campaigns performs the best based on open rates and click-thru rates with Hiya Mail's split testing tool.
Learn more

Insights Beyond Opens and Clicks

Advanced reports let you adapt campaigns based on behaviour & demographics to identify new marketing.
Learn more

Optional Managed Solutions

Prefer a chauffeur-driven service? Sit back, relax, and let Hiya deliver you the best possible results.

Learn more

Talk to us today for your FREE trial

Let one of us show how you can build a richer dialogue with your customers and get Hiya Mail for 30 days FREE.
Learn more

How Hiya Can Help You

Hiya helps organizations communicate with their customers and prospects. We provide the services to transform those relationships into more profitable, timely, and measurable business outcomes.

Learn more

Careers with Hiya Group

Hiya Group provides SaaS platform solutions to some of the biggest brands, globally. If working on ground-breaking projects with an unconventional, fast-growing technology company appeals to you, then please review our open positions. Learn more

International Leading Brands



About Hiya Group

United Kingdom +44 (0)20 7047 8110    Ireland +353 (0)1 410 0779
Follow us on Twitter
Become a fan on Facebook

Hiya Mail is a member of the Direct Marketing Association.
As a member of the DMA we abide by the Direct
Marketing Code of Practice.

Copyright (c) 2014 Hiya Group. All rights reserved.