Lists
View as MarkdownOpen in ChatGPTOpen in Claude
Upload a whole list, follow its progress, then download the results. Duplicate addresses are checked and charged once; unknown results are refunded. Needs a key with the lists scope.
Upload
POST /v1/lists takes either:
- multipart with a
filepart (CSV or XLSX, up to 50 MB and 1,000,000 rows) and optionalname,email_column(header name or 0-based index) andwebhook_url; or - JSON: an array of addresses, or
{"emails": [...], "name": "...", "webhook_url": "https://..."}(up to 5 MB).
It answers 202 with the list. A list may hold up to twice your credit balance in distinct addresses (at least 1,000), and at most 3 lists may be open at once. Processing pauses when credits run out and resumes when you add credits.
curl https://api.mails.fit/v1/lists \
-H "Authorization: Bearer $MAILSFIT_KEY" \
-F file=@contacts.csv \
-F name="March newsletter" \
-F webhook_url=https://example.com/hooks/mailsfitimport { readFile } from "node:fs/promises";
const form = new FormData();
form.append("file", new Blob([await readFile("contacts.csv")]), "contacts.csv");
form.append("name", "March newsletter");
const res = await fetch("https://api.mails.fit/v1/lists", {
method: "POST",
headers: { Authorization: `Bearer ${process.env.MAILSFIT_KEY}` },
body: form,
});
const list = await res.json(); // { id, status: "ingesting", ... }with open("contacts.csv", "rb") as f:
res = requests.post(
"https://api.mails.fit/v1/lists",
headers={"Authorization": f"Bearer {os.environ['MAILSFIT_KEY']}"},
files={"file": ("contacts.csv", f, "text/csv")},
data={"name": "March newsletter"},
timeout=120,
)
list_id = res.json()["id"]var buf bytes.Buffer
w := multipart.NewWriter(&buf)
part, _ := w.CreateFormFile("file", "contacts.csv")
f, err := os.Open("contacts.csv")
if err != nil {
log.Fatal(err)
}
io.Copy(part, f)
w.WriteField("name", "March newsletter")
w.Close()
req, _ := http.NewRequest("POST", "https://api.mails.fit/v1/lists", &buf)
req.Header.Set("Authorization", "Bearer "+os.Getenv("MAILSFIT_KEY"))
req.Header.Set("Content-Type", w.FormDataContentType())
res, err := http.DefaultClient.Do(req)$ch = curl_init("https://api.mails.fit/v1/lists");
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ["Authorization: Bearer " . getenv("MAILSFIT_KEY")],
CURLOPT_POSTFIELDS => [
"file" => new CURLFile("contacts.csv", "text/csv"),
"name" => "March newsletter",
],
]);
$list = json_decode(curl_exec($ch), true);let file = reqwest::multipart::Part::bytes(std::fs::read("contacts.csv")?).file_name("contacts.csv");
let form = reqwest::multipart::Form::new().part("file", file).text("name", "March newsletter");
let list: serde_json::Value = reqwest::Client::new()
.post("https://api.mails.fit/v1/lists")
.bearer_auth(std::env::var("MAILSFIT_KEY")?)
.multipart(form) // reqwest feature "multipart"
.send()
.await?
.json()
.await?;Progress
GET /v1/lists/{id} returns status (ingesting, processing, paused, done, failed), rows, unique_emails, progress counts by status and eta_seconds. GET /v1/lists returns your 100 most recent lists. Poll every few seconds, or pass webhook_url and wait for list.completed (see Webhooks).
curl https://api.mails.fit/v1/lists/77 -H "Authorization: Bearer $MAILSFIT_KEY"{
"id": 77,
"name": "March newsletter",
"status": "processing",
"rows": 12000,
"unique_emails": 11640,
"progress": { "pending": 0, "queued": 5210, "deliverable": 5102, "risky": 911, "undeliverable": 380, "unknown": 37 },
"eta_seconds": 640
}Download
GET /v1/lists/{id}/download streams CSV: your original rows and columns, then mf_status, mf_reason, mf_score, mf_suggestion, mf_disposable, mf_free, mf_role and mf_catch_all. Filter with ?filter=deliverable or a comma list such as ?filter=deliverable,risky. Cells a spreadsheet would run as formulas are prefixed with '. Before the list is done the answer is 409.
curl -o clean.csv "https://api.mails.fit/v1/lists/77/download?filter=deliverable" \
-H "Authorization: Bearer $MAILSFIT_KEY"Monitoring
PUT /v1/lists/{id}/monitor re-verifies a finished list every 7 or 30 days and reports changed results (list.monitor_changed). See the API reference for the body.