API
The PHP Wrapper
This guide to the KlickTipp API and PHP wrapper covers API essentials, including setup, authentication, endpoint use, and error handling, while also providing a comprehensive overview of all available endpoints and their respective functions.
Premium, Deluxe, and Enterprise customers enjoy full access to our API interface, enabling seamless integration with KlickTipp. Built on the REST (Representational State Transfer) paradigm, the API allows for smooth and efficient interaction with other platforms.
The API allows you to access information from KlickTipp. Additionally, you can update data for your KlickTipp contacts through your web applications. For example, you can tag customers who have purchased a product in your shop system with → Customer via our API. This way, you can utilize all of KlickTipp's email marketing features for your customers..
We offer our API as a REST web service, enabling you to access your data from any environment or programming language, including PHP, JavaScript, and XML.
PHP Interface Class
Simplify your programming with our PHP interface class. You can download it here:
Upload the class to your web server using FTP, placing it in the directory where you plan to use the API. Next, we'll dive into a detailed description of the class functions.
Start by logging into the API using your username and password through the → login function. This step grants you access to a recipient's data, with your login information securely stored in the session. Once logged in, you can execute various functions, allowing for multiple API calls in succession. After completing your tasks, remember to use the → logout function to sign out of the API, ensuring your session ends securely.
The API call process is always the same:
login('username', 'password');
// Insert api function here
$result = $connector->apifunction($parameters);
$connector->logout();
?>
Instead of $connector->apifunction($parameters); use one of the functions listed below.
Functions
The following functions are available as part of our API.
login($username, $password)
This function enables you to log in to your KlickTipp account using your username ($username) and your password ($password).
- param mixed $username - Your Klick-Tipp username
- param mixed $password - Your Klick-Tipp password
The function returns TRUE if the login was successful, for example:
login($username, $password);
$connector->logout();
if ($logged_in) {
print 'Login successful.';
} else {
print $connector->get_last_error();
}
?>
logout()
This function logs you out of your account and returns TRUE if the logout was successful.
Example:
login($username, $password);
$logged_out = $connector->logout();
if ($logged_out) {
print 'Logout successful.';
} else {
print $connector->get_last_error();
}
?>
subscriber_index()
This function returns an associative array [id] => [subscriber_id] of all contacts in your KlickTipp user account. Log in with → login to use this function.
Example:
login($username, $password);
$subscriber_ids = $connector->subscriber_index();
$connector->logout();
if ($subscriber_ids) {
print_r($subscriber_ids, true);
} else {
print $connector->get_last_error();
}
?>
subscriber_tagged($tag_id)
Use this function to search for recipients marked with a specific tag.
Simply use → login to access this function.
- param mixed $tag_id - ID of the tag
The function returns an associative array [subscriber_id] => [subscription_timestamp].
Use the subscriber_get function to read the data for a specific recipient.
Example:
[subscription_timestamp]
* Use subscriber_get to get subscriber details.
*/
require ('klicktipp.api.inc');
$username = 'username'; // Replace with username
$password = 'password'; // Replace with password
$tag_id = 123; // Replace 123 with the tag id.
$connector = new KlicktippConnector();
$connector->login($username, $password);
$subscriber = $connector->subscriber_tagged($tag_id);
$connector->logout();
if ($subscriber) {
print_r($subscriber, true);
} else {
print $connector->get_last_error();
}
?>
subscriber_search($email_address)
Use this function to search for a recipient in your KlickTipp account by their email address. Log in with → login to access this function.
- param mixed $email_address - The e-mail address of the recipient
This function returns the recipient's ID.
Use subscriber_get to retrieve data for a specific recipient.
Example:
login($username, $password);
$subscriber_id = $connector->subscriber_search($email_address);
$connector->logout();
if ($subscriber_id) {
print $subscriber_id;
} else {
print $connector->get_last_error();
}
?>
subscriber_get($subscriber_id)
With this function you can read out all the information about a recipient. Use this function, for example, to find out when a contact received a certain email, opened it or clicked on a link in it. Log in with → login to be able to use this function.
- param mixed $subscriber_id - ID of the recipient
The function returns an object with the recipient's data. The contents of all fields and associative arrays of the tags with which the recipient was marked are listed:
- manual_tags - associative array manual tags [tag_id] => [timestamp]
- smart_links - associative array SmartLinks [tag_id] => [timestamp]
- emails_sent - associative array "Newsletter / Autoresponder received" [Newsletter / Autoresponder ID] => [timestamp]
- emails_opened - associative array "Newsletter / Autoresponder clicked" [Newsletter / Autoresponder ID] => [timestamp]
- emails_clicked - associative array "Newsletter / Autoresponder opened" [Newsletter / Autoresponder ID] => [timestamp]
- emails_viewed - associative array "Newsletter / Autoresponder viewed in web browser" [Newsletter / Autoresponder ID] => [timestamp]
- conversions - associative array "Newsletter / Autoresponder conversion pixel loaded" [Newsletter / Autoresponder ID] => [timestamp]
- outbound - associative array "Outbound triggered" [Outbound ID] => [timestamp]
- kajabi_activated - associative array "Kajabi Membership activated" [Kajabi ID] => [timestamp]
- kajabi_deactivated - associative array "Kajabi Membership deactivated" [Outbound ID] => [timestamp]
- taggingpixel_triggered - associative array "Tagging pixel triggered" [Tagging pixel ID] => [timestamp]
- notification_emails_sent - associative array "Email (Marketing Cockpit) received" [Email ID] => [timestamp]
- notification_emails_opened - associative array "Email (Marketing Cockpit) opened" [Email ID] => [timestamp]
- notification_emails_clicked - associative array "Email (Marketing Cockpit) clicked" [Email ID] => [timestamp]
- notification_emails_viewed - associative array "Email (Marketing Cockpit) viewed in web browser" [Email ID] => [timestamp]
- notification_sms_sent - associative array "SMS (Marketing Cockpit) received" [SMS ID] => [timestamp]
- notification_sms_clicked - associative array "SMS (Marketing Cockpit) clicked" [SMS ID] => [timestamp]
- campaigns_started - associative array "Campaign started" [Campaign ID] => [timestamp]
- campaigns_finished - associative array "Campaign finished" [Campaign ID] => [timestamp]
- api_subscriptions - associative array "Registered via API-Key" [API-Key ID] => [timestamp]
- email_subscriptions - associative array "Registered via email" [registration-per-email ID] => [timestamp]
- sms_subscriptions - associative array "Registered via SMS" [registration-per-SMS ID] => [timestamp]
- form_subscriptions - associative array "Via registration form" [registration-form ID] => [timestamp]
- facebook_subscriptions - associative array "Subscribed via Facebook button" [Facebook button ID] => [timestamp]
- payments - associative array "Payment received" [product ID] => [timestamp]
- refunds - associative array "Refund triggered" [product ID] => [timestamp]
- chargebacks - associative array "Chargeback triggered" [Product ID] => [timestamp]
- rebills_canceled - associative array "Subscription canceled" [Product ID] => [timestamp]
- rebills_resumed - associative array "Subscription resumed" [Product ID] => [timestamp]
- rebills_expired - associative array "Last day of subscription reached" [Product ID] => [timestamp]
- digistore_affiliations - associative array "Affiliate of a Digistore24 product" [Product ID] => [timestamp]
You can determine the corresponding IDs of the e-mails, registration forms, products, etc. from the 1st column of the table on the respective overview pages.
Example:
login($username, $password);
$subscriber = $connector->subscriber_get($subscriber_id);
$connector->logout();
if ($subscriber) {
print_r($subscriber, true);
} else {
print $connector->get_last_error();
}
?>
subscribe($email_address, $list_id = 0, $tag_id = 0, $fields = array(), $smsnumber = '')
You can use this function to add a new subscriber to your ContactCloud.
Log in with → login to be able to use this function.
- param mixed $email_address - e-mail address of the recipient
- param mixed $list_id - optional: ID of the double opt-in process. (In the menu → Listbuilding, select the option → Double opt-in processes. You will find the ID at the beginning of the table).
- param mixed $tag_id - optional: ID of the tag with which your contacts should be marked. (In the menu → Automation, select the option → Tags. You will find the ID at the top of the table).
- param mixed $fields - optional: additional data of the recipient, for example name, affiliate ID, address, customer number, etc. The array must be structured as returned by the field_index function.
- param mixed $smsnumber - optional: SMS mobile number of the recipient
The function returns an object with the recipient's data, for example:
'Thomas',
'fieldLastName' => 'Weber',
);
$smsnumber = '00491631737743';
$connector = new KlicktippConnector();
$connector->login($username, $password);
$subscriber = $connector->subscribe($email_address,
$double_optin_process_id, $tag_id, $fields, $smsnumber);
$connector->logout();
if ($subscriber) {
print_r($subscriber, true);
} else {
print $connector->get_last_error();
}
?>
signin($api_key, $email_address, $fields = array(), $smsnumber = '')
With this function, you can add a new subscriber using an API key in → Recipients.
- param mixed $api_key - API key
- param mixed $email_address - e-mail address of the recipient
- param mixed $fields - optional: additional recipient data, e.g. name, affiliate ID, address, customer number, etc. The array must be structured as returned by the field_index function.
- param mixed $smsnumber - optional: SMS mobile number of the recipient
This function returns the double opt-in confirmation page URL associated with the API key.
Example:
'Thomas',
'fieldLastName' => 'Weber',
);
$smsnumber = '00491631737743';
$connector = new KlicktippConnector();
$redirect_url = $connector->signin($api_key, $email_address, $fields, $smsnumber);
if ($redirect_url) {
print $redirect_url;
} else {
print $connector->get_last_error();
}
?>
subscriber_update($subscriber_id, $fields = array(), $newemail = '', $newsmsnumber = '')
With this function, you can update a recipient's data. Log in with → login to use this function.
- param mixed $subscriber_id - ID of the recipient
- param mixed $fields - fields to be updated
- param mixed $newemail - optional: new e-mail address of the recipient
- param mixed $newsmsnumber - optional: new SMS mobile number of the recipient
The function returns TRUE if the operation was successful.
Example:
'Martin',
'fieldLastName' => 'Meier',
);
$newsmsnumber = '00491631737743';
$connector = new KlicktippConnector();
$connector->login($username, $password);
$updated = $connector->subscriber_update($subscriber_id, $fields, $newemail, $newsmsnumber);
$connector->logout();
if ($updated) {
print 'Subscriber successfully updated.';
} else {
print $connector->get_last_error();
}
?>
tag($email_address, $tag_id)
With this function, you can assign manual tags or SmartLinks to a contact.
Log in with → login to use this function.
- param mixed $email_address - e-mail address of the recipient
- param mixed $tag_id - the ID of the manual tag / SmartLink. You can also pass an array of tag IDs to assign multiple tags at the same time (in the → Automation menu, select the → Tags option or the → SmartLinks option. You will find the ID at the top of the table).
login($username, $password);
$result = $connector->tag($email_address, $tag_id);
$connector->logout();
if ($result) {
print 'Subscriber successfully tagged.';
} else {
print $connector->get_last_error();
}
?>
untag($email_address, $tag_id)
You can use this function to remove a manual tag or SmartLink from a contact.
Log in with → login to access this function.
- param mixed $email_address - e-mail address of the recipient
- param mixed $tag_id - ID of the manual tag / SmartLinks (In the → Automation menu, select → Tags or → SmartLinks. You'll find the ID at the top of the table).
login($username, $password);
$untagged = $connector->untag($email_address, $tag_id);
$connector->logout();
if ($untagged) {
print 'Tag successfully removed from subscriber.';
} else {
print $connector->get_last_error();
}
?>
signout($api_key, $email_address)
This function removes a manual tag or a SmartLink with an API key from a contact.
- param mixed $api_key - API key
- param mixed $email_address - e-mail address of the recipient
signout($api_key, $email_address);
if ($untagged) {
print 'Tag successfully removed from subscriber.';
} else {
print $connector->get_last_error();
}
?>
unsubscribe($email_address)
You can use this function to unsubscribe a recipient.
Log in with → login to be able to use this function.
- param mixed $email_address - e-mail address of the recipient
login($username, $password);
$unsubscribed = $connector->unsubscribe($email_address);
$connector->logout();
if ($unsubscribed) {
print 'Subscriber successfully unsubscribed.';
} else {
print $connector->get_last_error();
}
?>
signoff($api_key, $email_address)
You can use this function to unsubscribe a recipient with an API key.
- param mixed $api_key - API key
- param mixed $email_address - e-mail address of the recipient
signoff($api_key, $email_address);
if ($unsubscribed) {
print 'Subscriber successfully unsubscribed.';
} else {
print $connector->get_last_error();
}
?>
subscriber_delete($subscriber_id)
You can use this function to delete a recipient.
Log in with → login to be able to use this function.
- param mixed $subscriber_id - ID of the recipient
The function returns TRUE if the process was successful.
login($username, $password);
$deleted = $connector->subscriber_delete($subscriber_id);
$connector->logout();
if ($deleted) {
print 'Subscriber successfully deleted.';
} else {
print $connector->get_last_error();
}
?>
tag_index()
This function returns an associative array [tag_id] => [tag_name] of your manual tags and your SmartLinks. Log in with → login to be able to use this function.
Example:
[tag_name]
*/
require ('klicktipp.api.inc');
$username = 'username'; // Replace with username
$password = 'password'; // Replace with password
$connector = new KlicktippConnector();
$connector->login($username, $password);
$tags = $connector->tag_index();
$connector->logout();
if ($tags) {
print_r($tags, true);
} else {
print $connector->get_last_error();
}
?>
tag_get($tag_id)
This function returns the name and description of a tag. Log in with → login to be able to use this function.
- param mixed $tag_id - ID of the tag
Example:
login($username, $password);
$tag = $connector->tag_get($tag_id);
$connector->logout();
if ($tag) {
print_r($tag, true);
} else {
print $connector->get_last_error();
}
?>
tag_create($name, $text = '')
You can use this function to create a new manual tag.
Log in with → login to be able to use this function.
- param mixed $name - name of the manual tag
- param mixed $text - optional: additional information
The function returns the ID of the new tag, for example:
login($username, $password);
$tag_id = $connector->tag_create($name, $text);
$connector->logout();
if ($tag_id) {
print $tag_id;
} else {
print $connector->get_last_error();
}
?>
tag_update($tag_id, $name = '', $text = '')
You can use this function to update a manual tag or a SmartLink. Log in with → login to be able to use this function.
- param mixed $tag_id - ID of the manual tag / SmartLinks (In the → Automation menu, select the → Tags option or the → SmartLinks option. You will find the ID at the top of the table).
- param mixed $name - optional: Name of the manual tag / SmartLinks
- param mixed $text - optional: additional information
login($username, $password);
$updated = $connector->tag_update($tag_id, $name, $text);
$connector->logout();
if ($updated) {
print 'Tag successfully updated.';
} else {
print $connector->get_last_error();
}
?>
tag_delete($tag_id)
You can use this function to delete a manual tag or a SmartLink. Log in with → login to be able to use this function.
- param mixed $tag_id - ID of the manual tag / SmartLinks (In the → Automation menu, select the → Tags option or the → SmartLinks option. You will find the ID at the top of the table).
login($username, $password);
$deleted = $connector->tag_delete($tag_id);
$connector->logout();
if ($deleted) {
print 'Tag successfully deleted.';
} else {
print $connector->get_last_error();
}
?>
subscription_process_index()
This function returns an associative array [double_optin_process_id] => [double_optin_process_name] of your double opt-in processes.
Log in with → login to be able to use this function.
Example:
[double_optin_process_name]
*/
require ('klicktipp.api.inc');
$username = 'username'; // Replace with username
$password = 'password'; // Replace with password
$connector = new KlicktippConnector();
$connector->login($username, $password);
$subscription_processes = $connector->subscription_process_index();
$connector->logout();
if ($subscription_processes) {
print_r($subscription_processes, true);
} else {
print $connector->get_last_error();
}
?>
subscription_process_get($list_id)
This function returns the name of a double opt-in process. Log in with → login to be able to use this function.
- param mixed $list_id - ID of your double opt-in process (In the menu → Listbuilding, select the option → Double opt-in processes. You will find the ID at the top of the table).
Example:
login($username, $password);
$subscription_process = $connector->subscription_process_get($double_optin_process_id);
$connector->logout();
if ($subscription_process) {
print_r($subscription_processes, true);
} else {
print $connector->get_last_error();
}
?>
subscription_process_redirect($listid, $email)
This function retrieves the confirmation page URL for the Double Opt-In process for a specific recipient.
- param mixed $listid - ID of your double opt-in process (In the menu → Listbuilding, select the option → Double opt-in processes. You will find the ID at the top of the table).
- param mixed $email - Email address of the recipient
This function returns the URL of the confirmation page of the double opt-in process for the given recipient.
Example:
subscription_process_redirect($double_optin_process_id, $email);
if ($redirect_url) {
print $redirect_url;
} else {
print $connector->get_last_error();
}
?>
field_index()
[field_name]
*/
require ('klicktipp.api.inc');
$username = 'username'; // Replace with username
$password = 'password'; // Replace with password
$connector = new KlicktippConnector();
$connector->login($username, $password);
$fields = $connector->field_index();
$connector->logout();
if ($fields) {
print_r($fields, true);
} else {
print $connector->get_last_error();
}
?>