GO
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 C# (.NET) 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 - GOlang examples
GO
/get_credits
Retrieve the amount of available credits
Request:
package main
import (
"fmt"
"io/ioutil"
"net/http"
)
func main() {
client := &http.Client{}
req, _ := http.NewRequest("GET", "https://api.listcleaner.net/get_credits", nil)
req.Header.Add("accept", "application/json")
req.Header.Add("X-User-Email", "username@domain.com")
req.Header.Add("X-Api-Key", "YOUR_API_KEY")
resp, err := client.Do(req)
if err != nil {
fmt.Println("Error:", err)
return
}
defer resp.Body.Close()
if resp.StatusCode == 200 {
body, _ := ioutil.ReadAll(resp.Body)
fmt.Println(string(body)) // Output user credits
} else {
fmt.Printf("Error: %d\n", resp.StatusCode)
}
}
Response (code 200):
{
"credits": 0
}
GO
/upload_list
Upload your email data file to be cleaned
Request:
package main
import (
"bytes"
"fmt"
"io"
"mime/multipart"
"net/http"
"os"
)
func main() {
url := "https://api.listcleaner.net/upload_list"
body := &bytes.Buffer{}
writer := multipart.NewWriter(body)
// Add file to form
file, err := os.Open("YOUR_FILENAME.csv")
if err != nil {
fmt.Println("Error:", err)
return
}
defer file.Close()
part, err := writer.CreateFormFile("file", "YOUR_FILENAME.csv")
if err != nil {
fmt.Println("Error:", err)
return
}
io.Copy(part, file)
// Add other fields
writer.WriteField("mapping", "YOUR_MAPPING_COLUMN")
writer.WriteField("reference", "YOUR_REFERENCE")
// Close the writer to finalize the form
writer.Close()
// Create the request
req, err := http.NewRequest("POST", url, body)
if err != nil {
fmt.Println("Error:", err)
return
}
req.Header.Set("accept", "application/json")
req.Header.Set("X-User-Email", "username@domain.com")
req.Header.Set("X-Api-Key", "YOUR_API_KEY")
req.Header.Set("Content-Type", writer.FormDataContentType())
// Send the request
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
fmt.Println("Error:", err)
return
}
defer resp.Body.Close()
if resp.StatusCode == http.StatusOK {
body, _ := io.ReadAll(resp.Body)
fmt.Println("Response:", string(body)) // Output the response
} else {
fmt.Printf("Error: %d\n", resp.StatusCode)
}
}
Response (code 200):
{
"status": "File uploaded successfully",
"uid": "d53dec-bac2b5-34dfd1",
"records_total": 28391
}
GO
/show_lists
Have a look at all your lists
?uid is optional and will only show that specific list.
Request:
package main
import (
"fmt"
"io/ioutil"
"net/http"
)
func main() {
// Optional uid parameter
uid := "abc123-def456-ghi789"
url := fmt.Sprintf("https://api.listcleaner.net/show_lists?uid=%s", uid)
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("accept", "application/json")
req.Header.Add("X-User-Email", "username@domain.com")
req.Header.Add("X-Api-Key", "YOUR_API_KEY")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
fmt.Println("Error:", err)
return
}
defer resp.Body.Close()
if resp.StatusCode == http.StatusOK {
body, _ := ioutil.ReadAll(resp.Body)
fmt.Println(string(body)) // Output the response
} else {
fmt.Printf("Error: %d\n", resp.StatusCode)
}
}
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"
}
]
}
GO
/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:
package main
import (
"fmt"
"io/ioutil"
"net/http"
"os"
)
func main() {
// Parameters
uid := "abc123-def456-ghi789"
exportType := "all"
url := fmt.Sprintf("https://api.listcleaner.net/download_list?uid=%s&export_type=%s", uid, exportType)
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("accept", "*/*")
req.Header.Add("X-User-Email", "username@domain.com")
req.Header.Add("X-Api-Key", "YOUR_API_KEY")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
fmt.Println("Error:", err)
return
}
defer resp.Body.Close()
if resp.StatusCode == http.StatusOK {
body, _ := ioutil.ReadAll(resp.Body)
// Save the response to a file
err = ioutil.WriteFile("downloaded_list.csv", body, 0644)
if err != nil {
fmt.Println("Error saving file:", err)
return
}
fmt.Println("List downloaded successfully.")
} else {
fmt.Printf("Error: %d\n", resp.StatusCode)
}
}
GO
/delete_list
Remove your list from the panel
Request:
package main
import (
"fmt"
"io/ioutil"
"net/http"
)
func main() {
// Parameters
uid := "abc123-def456-ghi789"
url := fmt.Sprintf("https://api.listcleaner.net/delete_list?uid=%s", uid)
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("accept", "*/*")
req.Header.Add("X-User-Email", "username@domain.com")
req.Header.Add("X-Api-Key", "YOUR_API_KEY")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
fmt.Println("Error:", err)
return
}
defer resp.Body.Close()
if resp.StatusCode == http.StatusOK {
body, _ := ioutil.ReadAll(resp.Body)
fmt.Println(string(body)) // Output the response
} else {
fmt.Printf("Error: %d\n", resp.StatusCode)
}
}
Response (code 200):
{
"status": "List removed successfully"
}