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 Python examples.

Getting started

Your API key
You can retrieve and renew your API key by clicking on the "API KEY" button, on the Listcleaner dashboard.

Click here to go to your dashboard.
Your Username
Your username is the same as your account's email address
API Request parameters

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.

API Response codes

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

Choose your programming language

Listcleaner API request examples

Listcleaner API - Python examples

Python

/get_credits

Retrieve the amount of available credits

Request:

Pyton
				import requests

url = "https://api.listcleaner.net/get_credits"
headers = {
    "accept": "application/json",
    "X-User-Email": "username@domain.com",
    "X-Api-Key": "YOUR_API_KEY"
}

response = requests.get(url, headers=headers)

if response.status_code == 200:
    print(response.json())  # Output user credits
else:
    print(f"Error: {response.status_code}")

			

Response (code 200):

vim
				{
  "credits": 0
}
			

Python

/upload_list

Upload your email data file to be cleaned

Request:

Pyton
				import requests

url = "https://api.listcleaner.net/upload_list"
headers = {
    "accept": "application/json",
    "X-User-Email": "username@domain.com",
    "X-Api-Key": "YOUR_API_KEY"
}
files = {
    'file': ('YOUR_FILENAME.csv', open('YOUR_FILENAME.csv', 'rb'), 'text/csv'),
    'mapping': ('', 'YOUR_MAPPING_COLUMN'),
    'reference': ('', 'YOUR_REFERENCE')
}

response = requests.post(url, headers=headers, files=files)

if response.status_code == 200:
    print(response.json())  # Output the response
else:
    print(f"Error: {response.status_code}")

			

Response (code 200):

vim
				{
  "status": "File uploaded successfully",
  "uid": "d53dec-bac2b5-34dfd1",
  "records_total": 28391
}
			

Python

/show_lists

Have a look at all your lists

?uid is optional and will only show that specific list.

Request:

Pyton
				import requests

# Optional uid parameter
uid = "abc123-def456-ghi789"
url = f"https://api.listcleaner.net/show_lists?uid={uid}"
headers = {
    "accept": "application/json",
    "X-User-Email": "username@domain.com",
    "X-Api-Key": "YOUR_API_KEY"
}

response = requests.get(url, headers=headers)

if response.status_code == 200:
    print(response.json())  # Output the response
else:
    print(f"Error: {response.status_code}")

			

Response (code 200):

vim
				{
  "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"
    }
  ]
}
			

Python

/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:

Pyton
				import requests

# Parameters
uid = "abc123-def456-ghi789"
export_type = "all"
url = f"https://api.listcleaner.net/download_list?uid={uid}&export_type={export_type}"
headers = {
    "accept": "*/*",
    "X-User-Email": "username@domain.com",
    "X-Api-Key": "YOUR_API_KEY"
}

response = requests.get(url, headers=headers)

if response.status_code == 200:
    # Save the response content to a file (if it's a downloadable file)
    with open("downloaded_list.csv", "wb") as file:
        file.write(response.content)
    print("List downloaded successfully.")
else:
    print(f"Error: {response.status_code}")

			

Python

/delete_list

Remove your list from the panel

Request:

Go
				import requests

# Parameters
uid = "abc123-def456-ghi789"
url = f"https://api.listcleaner.net/delete_list?uid={uid}"
headers = {
    "accept": "*/*",
    "X-User-Email": "username@domain.com",
    "X-Api-Key": "YOUR_API_KEY"
}

response = requests.post(url, headers=headers)

if response.status_code == 200:
    print(response.json())  # Output the response
else:
    print(f"Error: {response.status_code}")

			

Response (code 200):

vim
				{
  "status": "List removed successfully"
}
			

Need Any Help? Or Looking For an Agent

Working Hours : Monday - Friday 09:00 - 19:00 CET
© 2024 | All Rights Reserved.