API
Listcleaner API Documentation
Our Email list cleaning API is easy to use and integrates within any software language.
Here you can find our email list cleaning API documentation, with ready made PHP examples.
Getting started
Click here to go to your dashboard.
Every request to our List Cleaning API requires these header parameters:
X-User-Email string
X-Api-Key string
Depending on the API call other query parameters are:
uid string This uid is the identifier of an uploaded data file.
file string($binary) The comma separated CSV file to be uploaded
mapping string The column name of your CSV file containing the email adresses
reference string Reference for your datafile
export_type string Choose options: all, ok, bad, for the requested dataset download.
Every response from our List Cleaning API come with a response code
200 Success
401 Unauthorized (check your username and API key)
400 Missing UID or other request error (check if the UID is in the request)
404 File not found (File not found or not ready for download)
404 File not found (File not found or not ready for download)
Listcleaner API request examples
Listcleaner API - PHP examples
PHP
/get_credits
Retrieve the amount of available credits
Request:
<?php
$url = "https://api.listcleaner.net/get_credits";
$headers = [
"accept: application/json",
"X-User-Email: username@domain.com",
"X-Api-Key: YOUR_API_KEY"
];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
$httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
if ($httpcode == 200) {
$data = json_decode($response, true);
print_r($data); // Output user credits
} else {
echo "Error: $httpcode\n";
}
curl_close($ch);
?>
Response (code 200):
{
"credits": 0
}
PHP
/upload_list
Upload your email data file to be cleaned
Request:
<?php
$url = "https://api.listcleaner.net/upload_list";
$headers = [
"accept: application/json",
"X-User-Email: username@domain.com",
"X-Api-Key: YOUR_API_KEY"
];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_POSTFIELDS, [
'file' => new CURLFile('YOUR_FILENAME.csv', 'text/csv'),
'mapping' => 'YOUR_MAPPING_COLUMN',
'reference' => 'YOUR_REFERENCE'
]);
$response = curl_exec($ch);
$httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
if ($httpcode == 200) {
echo $response; // Output the response
} else {
echo "Error: $httpcode\n";
}
curl_close($ch);
?>
Response (code 200):
{
"status": "File uploaded successfully",
"uid": "d53dec-bac2b5-34dfd1",
"records_total": 28391
}
PHP
/show_lists
Have a look at all your lists
?uid is optional and will only show that specific list.
Request:
<?php
// Optional uid parameter
$uid = "abc123-def456-ghi789";
$url = "https://api.listcleaner.net/show_lists?uid=$uid";
$headers = [
"accept: application/json",
"X-User-Email: username@domain.com",
"X-Api-Key: YOUR_API_KEY"
];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$response = curl_exec($ch);
$httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
if ($httpcode == 200) {
echo $response; // Output the response
} else {
echo "Error: $httpcode\n";
}
curl_close($ch);
?>
Response (code 200):
{
"lists": [
{
"uid": "abc123-def456-ghi789",
"created": "2024-01-01 00:00:01",
"filename_original": "dummy.csv",
"reference": "Dummy File Upload",
"mapping": "emailaddress",
"records_total": 436,
"records_processed": "436",
"records_ok": "405",
"records_bad": "31",
"records_bad_breakdown": "{\"catch_all\": 2, \"blacklisted_email\": 1, \"spamtrap\": 1, \"account_inactive\": 4, \"syntax_error\": 1, \"mx_server_offline\": 1, \"invalid_mx\": 3, \"disposable_domain\": 16, \"mx_server_error\": 2}",
"paid": "paid",
"current_step": "done",
"current_status": "done",
"last_status_update": "2024-01-01 00:01:02"
}
]
}
PHP
/download_list
Download your cleaned lists, when its current_status is "done".
Options:
all -> Export of all the data
ok -> Export of the clean data
bad -> Export of the bad data
The statuses can be found in the "reason" column.
(We use "abc123-def456-ghi789" as example uid.)
Request:
<?php
// Parameters
$uid = "abc123-def456-ghi789";
$exportType = "all";
$url = "https://api.listcleaner.net/download_list?uid=$uid&export_type=$exportType";
$headers = [
"accept: */*",
"X-User-Email: username@domain.com",
"X-Api-Key: YOUR_API_KEY"
];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$response = curl_exec($ch);
$httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
if ($httpcode == 200) {
// Save the response to a file
file_put_contents('downloaded_list.csv', $response);
echo "List downloaded successfully.\n";
} else {
echo "Error: $httpcode\n";
}
curl_close($ch);
?>
PHP
/delete_list
Remove your list from the panel
Request:
<?php
// Parameters
$uid = "abc123-def456-ghi789";
$url = "https://api.listcleaner.net/delete_list?uid=$uid";
$headers = [
"accept: */*",
"X-User-Email: username@domain.com",
"X-Api-Key: YOUR_API_KEY"
];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_POST, true); // Set method to POST
curl_setopt($ch, CURLOPT_POSTFIELDS, ""); // Send an empty body
$response = curl_exec($ch);
$httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
if ($httpcode == 200) {
echo $response; // Output the response
} else {
echo "Error: $httpcode\n";
}
curl_close($ch);
?>
Response (code 200):
{
"status": "List removed successfully"
}