Authentication
View as MarkdownOpen in ChatGPTOpen in Claude
Every /v1 request (except the public tools and the widget) needs an API key in the Authorization header:
Authorization: Bearer mf_live_0123456789abcdef...Private and public keys
Create keys in Dashboard → API keys and pick a type:
- Private (
mf_live_...): must be kept secret; only use it in server-side code where it will not be exposed. Shown once; we store only its SHA-256 hash. It has the scopes below and an optional IP allowlist. - Public (
mf_pub_...): can be used publicly, e.g. in your website's JavaScript. It only callsPOST /v1/verifyandGET /v1/verify/{id}, and only with anOriginheader that exactly matches one of its allowed origins (scheme included, likehttps://example.com); other or missing origins get 403origin_not_allowed. Any other endpoint (lists, credits, monitors, hooks, tools, MCP) answers 403public_key_not_allowed. It has its own rate limit (bursts of 10, 2 per second) and a daily cap (default 500, up to 50,000; past it 429daily_cap_reached). Responses carry CORS headers for its origins and never show your balance. Signup widget keys are public keys.
// In the browser, on https://example.com (listed on the key)
const res = await fetch("https://api.mails.fit/v1/verify", {
method: "POST",
headers: { Authorization: "Bearer mf_pub_...", "Content-Type": "application/json" },
body: JSON.stringify({ email: "jane@example.org", wait: 5 }),
});Scopes
Each private key has scopes:
| Scope | Allows |
|---|---|
verify | POST /v1/verify, POST /v1/verify/batch, GET /v1/verify/{id}, email finder, domain search, blacklist monitors, enrichment, verify.completed hooks |
lists | /v1/lists upload, progress, download and monitoring, list.* hooks |
GET /v1/credits works with any key. A request without the needed scope gets 403 missing_scope.
IP allowlist
A private key can be limited to IP addresses or CIDR ranges (up to 50, IPv4 or IPv6), set when you create it or later under API keys → Allowed IPs. A request from any other address gets 403 ip_not_allowed and is not charged. Leave the list empty to allow any IP.
{ "error": { "code": "ip_not_allowed", "message": "This API key is not allowed from 198.51.100.7. ..." } }Good practice
- Keep private keys on the server side. In a browser, use a public key (
mf_pub_...) or the widget. - Give each app or agent its own key, so you can revoke one without touching the others. Revoking takes effect at once.
- The account email address must be confirmed before keys work (403
email_not_verified). - Failed authentication attempts are limited per client IP; after too many you get 429 with
Retry-After.
Check a key
curl https://api.mails.fit/v1/credits -H "Authorization: Bearer $MAILSFIT_KEY"const res = await fetch("https://api.mails.fit/v1/credits", {
headers: { Authorization: `Bearer ${process.env.MAILSFIT_KEY}` },
});
console.log(await res.json()); // { balance: 100 }import os, requests
res = requests.get(
"https://api.mails.fit/v1/credits",
headers={"Authorization": f"Bearer {os.environ['MAILSFIT_KEY']}"},
timeout=10,
)
print(res.json()) # {'balance': 100}req, _ := http.NewRequest("GET", "https://api.mails.fit/v1/credits", nil)
req.Header.Set("Authorization", "Bearer "+os.Getenv("MAILSFIT_KEY"))
res, err := http.DefaultClient.Do(req)
if err != nil {
log.Fatal(err)
}
defer res.Body.Close()
io.Copy(os.Stdout, res.Body) // {"balance":100}$ch = curl_init("https://api.mails.fit/v1/credits");
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ["Authorization: Bearer " . getenv("MAILSFIT_KEY")],
]);
echo curl_exec($ch); // {"balance":100}let credits: serde_json::Value = reqwest::Client::new()
.get("https://api.mails.fit/v1/credits")
.bearer_auth(std::env::var("MAILSFIT_KEY")?)
.send()
.await?
.json()
.await?;
println!("{credits}"); // {"balance":100}