API Endpoints
API Endpoints are essentially the available functions presented by the API. These functions can be used to either send (POST) or receive information between the API and your web application or website. Understanding what each endpoint is used for is essential to successful Leadtrekker integration between your web application and the Leadtrekker database.
Apart from the compulsory Apikey header some endpoints might have other required, and sometimes optional, parameters that need to be passed along when using that specific endpooint.
Creating Leads
The most widely used endpoint the Leadtrekker API has to offer is the createlead endpoint. This endpoint is used to send leads from your web application into your Leadtrekker account.
URL
https://system.leadtrekker.com/api/createlead
Required Parameters
| Property |
Type |
Description |
Default |
| name |
Base64 encoded string |
The name of the lead. |
- |
| number |
Base64 encoded string |
The contact number of the lead. |
- |
| email |
Base64 encoded string |
The email address of the lead. |
- |
Optional Parameters
| Property |
Type |
Description |
Default |
| company |
Base64 encoded string |
Company name of the lead. |
- |
| confidence |
Base64 encoded integer |
The level of confidence that the lead will convert into business. 1 being low 10 being high. |
1 |
| custom_fields |
Array with Base64 encoded values |
Key value pair array of custom fields. |
- |
| expected_closing_date |
Base64 encoded string |
The expected date the lead will convert into business. |
Last day of the current month. |
| notes |
Base64 encoded string |
Notes related to the lead. |
- |
| sourceid |
Base64 encoded integer |
The source id of the lead. |
1 |
| statusid |
Base64 encoded integer |
The status id of the lead. |
1 |
| value |
Base64 encoded float |
The value of the lead should it convert into business. |
0 |
| interested_in |
Base64 encoded string |
Wich service or product the lead seems interested in. |
- |
| group |
Base64 encoded string |
Link the lead to a group name. |
- |
Response
| Property |
Type |
Description |
| id |
Integer |
The id of the lead if it was created successfully. |
- |
Creating Leads Examples
Most basic example to create a lead with only the three required parameters
<?php
$data = array();
$headers = array();
$Apikey = 'A1B2C3D4E5F6G7H8I9';
$url = 'https://system.leadtrekker.com/api/createlead';
$data['name'] = base64_encode('John Doe');
$data['email'] = base64_encode('john.doe@johnsbakery.com');
$data['number'] = base64_encode('0120040509');
$data = json_encode($data);
$cSession = curl_init();
$headers[] = 'Apikey:' . $Apikey;
curl_setopt($cSession, CURLOPT_URL, $url);
curl_setopt($cSession, CURLOPT_RETURNTRANSFER, true);
curl_setopt($cSession, CURLOPT_HEADER, false);
curl_setopt($cSession, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($cSession, CURLOPT_POSTFIELDS, $data);
curl_setopt($cSession, CURLOPT_SSL_VERIFYPEER, false);
$headers[] = 'Content-Type: application/json';
curl_setopt($cSession, CURLOPT_HTTPHEADER, $headers);
$result = curl_exec($cSession);
curl_close($cSession);
?>
Example to create a lead with all optional parameters except custom fields
<?php
$data = array();
$headers = array();
$Apikey = 'A1B2C3D4E5F6G7H8I9';
$url = 'https://system.leadtrekker.com/api/createlead';
$data['name'] = base64_encode('John Doe');
$data['email'] = base64_encode('john.doe@johnsbakery.com');
$data['number'] = base64_encode('0120040509');
$data['company'] = base64_encode('Johns Bakery');
$data['confidence'] = base64_encode('6');
$data['expected_closing_date'] = base64_encode('2020-09-11');
$data['notes'] = base64_encode('This will be added as a note to the lead.');
$data['sourceid'] = base64_encode('12345');
$data['statusid'] = base64_encode('54321');
$data['value'] = base64_encode('125.00');
$data = json_encode($data);
$cSession = curl_init();
$headers[] = 'Apikey:' . $Apikey;
curl_setopt($cSession, CURLOPT_URL, $url);
curl_setopt($cSession, CURLOPT_RETURNTRANSFER, true);
curl_setopt($cSession, CURLOPT_HEADER, false);
curl_setopt($cSession, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($cSession, CURLOPT_POSTFIELDS, $data);
curl_setopt($cSession, CURLOPT_SSL_VERIFYPEER, false);
$headers[] = 'Content-Type: application/json';
curl_setopt($cSession, CURLOPT_HTTPHEADER, $headers);
$result = curl_exec($cSession);
curl_close($cSession);
?>
Example to create a lead with some optional parameters and a few custom fields
<?php
$data = array();
$headers = array();
$Apikey = 'A1B2C3D4E5F6G7H8I9';
$url = 'https://system.leadtrekker.com/api/createlead';
$data['name'] = base64_encode('John Doe');
$data['email'] = base64_encode('john.doe@johnsbakery.com');
$data['number'] = base64_encode('0120040509');
$data['company'] = base64_encode('Johns Bakery');
$data['confidence'] = base64_encode('6');
$data['expected_closing_date'] = base64_encode('2020-09-11');
$data['notes'] = base64_encode('This will be added as a note to the lead.');
$data['sourceid'] = base64_encode('12345');
$data['statusid'] = base64_encode('54321');
$data['value'] = base64_encode('125.00');
$data['custom_fields'] = array(
'Country' => base64_encode('South Africa'),
'Age' => base64_encode('50'),
'Sex' => base64_encode('Male'));
$data = json_encode($data);
$cSession = curl_init();
$headers[] = 'Apikey:' . $Apikey;
curl_setopt($cSession, CURLOPT_URL, $url);
curl_setopt($cSession, CURLOPT_RETURNTRANSFER, true);
curl_setopt($cSession, CURLOPT_HEADER, false);
curl_setopt($cSession, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($cSession, CURLOPT_POSTFIELDS, $data);
curl_setopt($cSession, CURLOPT_SSL_VERIFYPEER, false);
$headers[] = 'Content-Type: application/json';
curl_setopt($cSession, CURLOPT_HTTPHEADER, $headers);
$result = curl_exec($cSession);
curl_close($cSession);
?>
Creating Custom Fields
Add custom fields to leads after they have been created.
Create Custom Fields While Creating a Lead
You can create all your custom fields while creating the lead. Refer to the Creating Leads section form more information.
URL
https://system.leadtrekker.com/api/createcustomfields
Required Parameters
| Property |
Type |
Description |
| leadid |
Base64 encoded integer |
The id of the lead. |
| custom_fields |
Array with Base64 encoded values |
The createcustomfields API method expects an array called custom_fields. Each value in the array should be Base64 encoded. |
Response
| Property |
Type |
Description |
| Response Text |
String |
The status of the request. A successful request returns OK. |
- |
Creating Custom Fields Example
This example creates 3 different custom fields and links them to lead with id 12345
<?php
$data = array();
$headers = array();
$Apikey = 'A1B2C3D4E5F6G7H8I9';
$url = 'https://system.leadtrekker.com/api/createcustomfields';
$data['leadid'] = base64_encode('12345');
$data['custom_fields'] = array(
'Age' => base64_encode('30'),
'Sex' => base64_encode('Male'),
'Location' => base64_encode('South Africa')
);
$data = json_encode($data);
$cSession = curl_init();
$headers[] = 'Apikey:' . $Apikey;
curl_setopt($cSession, CURLOPT_URL, $url);
curl_setopt($cSession, CURLOPT_RETURNTRANSFER, true);
curl_setopt($cSession, CURLOPT_HEADER, false);
curl_setopt($cSession, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($cSession, CURLOPT_POSTFIELDS, $data);
curl_setopt($cSession, CURLOPT_SSL_VERIFYPEER, false);
$headers[] = 'Content-Type: application/json';
curl_setopt($cSession, CURLOPT_HTTPHEADER, $headers);
$result = curl_exec($cSession);
curl_close($cSession);
?>
Creating Notes
Use this endpoint to create notes.
URL
https://system.leadtrekker.com/api/createnote
Required Parameters
| Property |
Type |
Description |
| leadid |
Base64 encoded integer |
The id of the lead. |
| note |
Base64 encoded string |
The actual text of the note to be created. |
Optional Parameters
| Property |
Type |
Description |
Default |
| userid |
Base64 encoded integer |
The id of the user creating the note. |
0 (System user) |
Response
| Property |
Type |
Description |
| Response Text |
String |
The status of the request. A successful request returns OK. |
- |
Creating Notes Example
<?php
$data = array();
$headers = array();
$Apikey = 'A1B2C3D4E5F6G7H8I9';
$url = 'https://system.leadtrekker.com/api/createnote';
$data = array(
'leadid' => base64_encode(12345),
'note' => base64_encode('Hello world!'),
'userid' => base64_encode(123)
);
$data = json_encode($data);
$cSession = curl_init();
$headers[] = 'Apikey:' . $Apikey;
curl_setopt($cSession, CURLOPT_URL, $url);
curl_setopt($cSession, CURLOPT_RETURNTRANSFER, true);
curl_setopt($cSession, CURLOPT_HEADER, false);
curl_setopt($cSession, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($cSession, CURLOPT_POSTFIELDS, $data);
curl_setopt($cSession, CURLOPT_SSL_VERIFYPEER, false);
$headers[] = 'Content-Type: application/json';
curl_setopt($cSession, CURLOPT_HTTPHEADER, $headers);
$result = curl_exec($cSession);
curl_close($cSession);
?>
List Sources
Use this endpoint to view all the lead sources on your account.
URL
https://system.leadtrekker.com/api/sources
Response
| Property |
Type |
Description |
| Sources |
Array |
All the sources linked to your account. |
- |
List Sources Example
<?php
$headers = array();
$Apikey = 'A1B2C3D4E5F6G7H8I9';
$url = 'https://system.leadtrekker.com/api/sources';
$cSession = curl_init();
$headers[] = 'Apikey:' . $Apikey;
curl_setopt($cSession, CURLOPT_URL, $url);
curl_setopt($cSession, CURLOPT_RETURNTRANSFER, true);
curl_setopt($cSession, CURLOPT_HEADER, false);
curl_setopt($cSession, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($cSession, CURLOPT_POSTFIELDS, $data);
curl_setopt($cSession, CURLOPT_SSL_VERIFYPEER, false);
$headers[] = 'Content-Type: application/json';
curl_setopt($cSession, CURLOPT_HTTPHEADER, $headers);
$result = curl_exec($cSession);
curl_close($cSession);
?>
Update Statuses
Use this endpoint to update the status of an existing lead.
URL
https://system.leadtrekker.com/api/updatestatus
Required Parameters
| Property |
Type |
Description |
Default |
| statusid |
Base64 encoded integer |
The id of the lead. |
- |
| leadid |
Base64 encoded integer |
The id of the lead. |
- |
Response
| Property |
Type |
Description |
| Response Text |
String |
The status of the request. A successful request returns OK. |
- |
Update Statuses Example
<?php
$headers = array();
$Apikey = 'A1B2C3D4E5F6G7H8I9';
$url = 'https://system.leadtrekker.com/api/updatestatus';
$data = array(
'leadid' => base64_encode(12345),
'statusid' => base64_encode(2)
);
$data = json_encode($data);
$cSession = curl_init();
$headers[] = 'Apikey:' . $Apikey;
curl_setopt($cSession, CURLOPT_URL, $url);
curl_setopt($cSession, CURLOPT_RETURNTRANSFER, true);
curl_setopt($cSession, CURLOPT_HEADER, false);
curl_setopt($cSession, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($cSession, CURLOPT_POSTFIELDS, $data);
curl_setopt($cSession, CURLOPT_SSL_VERIFYPEER, false);
$headers[] = 'Content-Type: application/json';
curl_setopt($cSession, CURLOPT_HTTPHEADER, $headers);
$result = curl_exec($cSession);
curl_close($cSession);
?>
Update Leads
Use this endpoint to update the details of a lead.
URL
https://system.leadtrekker.com/api/updatelead
Required Parameters
| Property |
Type |
Description |
Default |
| leadid |
Base64 encoded integer |
The id of the lead. |
- |
Optional Parameters
| Property |
Type |
Description |
Default |
| name |
Base64 encoded string |
The name of the lead. |
- |
| number |
Base64 encoded string |
The contact number of the lead. |
- |
| email |
Base64 encoded string |
The email address of the lead. |
- |
| company |
Base64 encoded string |
The company name of the lead. |
- |
| confidence |
Base64 encoded integer |
The level of confidence that the lead will convert into business. 1 being low 10 being high. |
1 |
| value |
Base64 encoded float |
The value of the lead should it convert into business. |
0 |
| interested_in |
Base64 encoded string |
Wich service or product the lead seems interested in. |
- |
Response
| Property |
Type |
Description |
| Response Text |
String |
The status of the request. A successful request returns OK. |
- |
Update Statuses Example
<?php
$headers = array();
$Apikey = 'A1B2C3D4E5F6G7H8I9';
$url = 'https://system.leadtrekker.com/api/updatelead';
$data = array(
'leadid' => base64_encode(12345),
'interested_in' => base64_encode('Digital Marketing Services')
);
$data = json_encode($data);
$cSession = curl_init();
$headers[] = 'Apikey:' . $Apikey;
curl_setopt($cSession, CURLOPT_URL, $url);
curl_setopt($cSession, CURLOPT_RETURNTRANSFER, true);
curl_setopt($cSession, CURLOPT_HEADER, false);
curl_setopt($cSession, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($cSession, CURLOPT_POSTFIELDS, $data);
curl_setopt($cSession, CURLOPT_SSL_VERIFYPEER, false);
$headers[] = 'Content-Type: application/json';
curl_setopt($cSession, CURLOPT_HTTPHEADER, $headers);
$result = curl_exec($cSession);
curl_close($cSession);
?>