TL;DR
- Verify:
POST https://mailexchange.com/api/v1/listswith up to 100,000 addresses, pollGET /v1/lists/{id}, readGET /v1/lists/{id}/results. - Filter: keep
state == "deliverable"; sendriskywith reasonlow_deliverability(catch-all) to a separate campaign; dropundeliverable. - Push: Instantly's
POST /api/v2/leads/addtakes up to 1,000 leads per call, withverify_leads_on_import,skip_if_in_workspaceandidempotency_key. - Limits: Instantly allows 100 requests per second and 6,000 per minute; both APIs answer 429 when you exceed them and 402 for plan or credit problems.
You have leads flowing from Clay, a scraper, a form or a CRM, and you want them in an Instantly campaign without anyone exporting CSVs. The safe version of that pipeline has one extra step in the middle: verify, then add. There's no ready-made Mail Exchange connector for Instantly yet, so this is the code-it-yourself route. It takes about 60 lines of Python.
What you need
- A Mail Exchange API key. Sign up, then create an API key in your account (Account > API keys). Reference: email verification API.
- An Instantly API key. Instantly's quickstart (checked 2026-11-22): Settings > Integrations > API Keys, select the scopes you need, and send it as
Authorization: Bearer YOUR_API_KEYtohttps://api.instantly.ai/api/v2. Adding leads needs one of the scopesleads:create,leads:all,all:createorall:all. - Two campaign IDs in Instantly: your main campaign and a separate one for catch-alls.
Step by step: the pipeline
- Collect the new leads and remove obvious junk (blank or malformed emails).
- Submit the email addresses to POST /v1/lists on the Mail Exchange API.
- Poll GET /v1/lists/{id} every 5 to 10 seconds until the status is done, or pass a callback_url and wait for the list.done webhook.
- Read GET /v1/lists/{id}/results in pages of up to 10,000 rows.
- Split the rows: deliverable to the main campaign, risky with reason low_deliverability to the catch-all campaign, everything else dropped.
- Send each group to Instantly with POST /api/v2/leads/add in chunks of up to 1,000 leads, with a fresh idempotency_key per chunk.
- Check each response for leads_uploaded, duplicated_leads and invalid_email_count, and log the rest.
Step 1-4: verify the list with Mail Exchange
One list holds up to 100,000 unique addresses. Addresses are trimmed and lower-cased, duplicates are removed and not charged, and you're charged one credit per unique address when you submit. Unknown results are refunded when the list finishes. Results come back as JSON (default 1,000 rows, at most 10,000 per request) or CSV. Full detail in verify a list with the API.
import os, time, uuid, requests
MX = "https://mailexchange.com/api/v1"
MX_H = {"Authorization": f"Bearer {os.environ['MAILEXCHANGE_API_KEY']}"}
def verify(emails):
r = requests.post(f"{MX}/lists", headers=MX_H, json={"emails": emails, "name": "instantly-import"})
r.raise_for_status() # 402 = not enough credits, 400 = over 100,000
list_id = r.json()["id"]
while True:
s = requests.get(f"{MX}/lists/{list_id}", headers=MX_H).json()
if s["status"] in ("done", "failed"):
break
time.sleep(10) # polls count toward your rate limit
rows, offset = [], 0
while True:
page = requests.get(f"{MX}/lists/{list_id}/results", headers=MX_H,
params={"offset": offset, "limit": 10000}).json()["results"]
rows += page
if len(page) < 10000:
break
offset += 10000
requests.delete(f"{MX}/lists/{list_id}", headers=MX_H) # remove the list and its data
return rows
Each row has email, state, reason, score, accept_all, role, free, disposable, mx and provider.
Step 5: decide what goes where
| Mail Exchange result | Where it goes | Why |
|---|---|---|
| deliverable / accepted_email | Main campaign | The mailbox accepted the address |
| risky / low_deliverability (catch-all) | Catch-all campaign | Can't be confirmed; keep its bounces away from the main campaign |
| risky / low_quality (role address) | Usually drop for cold email | info@, sales@: rarely the person you want |
| risky / disposable | Drop | Throwaway inbox |
| undeliverable | Drop | Will hard-bounce |
| unknown | Retry later | Credit refunded; re-submit in a later run |
The split matters because Instantly pauses a campaign above 5% bounces after 200 sends. In Mail Exchange's checks of 779,784 business addresses (17 Oct to 22 Nov 2026, mostly B2B contact lists), 18.1% were catch-all and 7.6% undeliverable, more than enough to trip that brake if they went in unfiltered.
def split(rows):
main, catch_all = [], []
for r in rows:
if r["state"] == "deliverable":
main.append(r["email"])
elif r["state"] == "risky" and r["reason"] == "low_deliverability":
catch_all.append(r["email"])
return main, catch_all
Step 6-7: add the leads to Instantly
From Instantly's add leads in bulk reference (checked 2026-11-22): POST /api/v2/leads/add takes a leads array of 1 to 1,000 objects and either a campaign_id or a list_id, not both. With a campaign, each lead must include email. Useful flags:
verify_leads_on_import: runs Instantly's own verification in the background (0.25 credit per lead). Set it tofalsefor leads you've already verified.skip_if_in_workspace: skips leads already anywhere in the workspace and overridesskip_if_in_campaignandskip_if_in_list.idempotency_key: 1-128 characters, makes retries of the same batch safe. Use a new key per batch.
IN = "https://api.instantly.ai/api/v2"
IN_H = {"Authorization": f"Bearer {os.environ['INSTANTLY_API_KEY']}"}
def push(emails, campaign_id):
for i in range(0, len(emails), 1000):
chunk = [{"email": e} for e in emails[i:i + 1000]]
body = {"campaign_id": campaign_id, "leads": chunk,
"verify_leads_on_import": False, "skip_if_in_workspace": True,
"idempotency_key": f"mx-{uuid.uuid4()}"}
r = requests.post(f"{IN}/leads/add", headers=IN_H, json=body)
if r.status_code == 429: # rate limited: wait and retry the same body
time.sleep(5); r = requests.post(f"{IN}/leads/add", headers=IN_H, json=body)
r.raise_for_status()
d = r.json()
print(d["leads_uploaded"], "added,", d["duplicated_leads"], "duplicates,",
d["invalid_email_count"], "invalid,", d.get("remaining_in_plan"), "left in plan")
rows = verify(new_emails) # new_emails: your list of addresses
main, catch_all = split(rows)
push(main, os.environ["INSTANTLY_MAIN_CAMPAIGN"])
push(catch_all, os.environ["INSTANTLY_CATCHALL_CAMPAIGN"])
In real use, carry your other columns through: the lead object accepts first_name, last_name, company_name, job_title, website, personalization and a custom_variables object. Extra properties are rejected. The response always includes leads_uploaded, duplicated_leads, skipped_count, invalid_email_count and in_blocklist; remaining_in_plan appears only when you pass a campaign_id.
Errors, limits and retries
| Code | Mail Exchange | Instantly |
|---|---|---|
| 401 | Missing or wrong key | Unauthorized |
| 402 | Not enough credits; nothing is created | No active paid plan |
| 429 | Per-key rate limit exceeded | Over 100 requests per second or 6,000 per minute, shared across the workspace |
Instantly: rate limits and the add-leads reference, checked 2026-11-22. Mail Exchange: errors, credits and rate limits.
Two practical points. Retry Instantly calls with the same idempotency_key so a timeout never adds a batch twice. And run unknowns again in the next cycle rather than sending them; their credit has already been refunded.
Close the loop with bounce events
Instantly can post webhook events when an email bounces (webhooks need the Hyper Growth plan or above, per Instantly's help center, checked 2026-11-22). Forward those bounces to Mail Exchange's optional POST /v1/feedback endpoint with {"events": [{"email": "...", "event": "bounced"}]}, and add the address to your own suppression list so it's never pushed again. See webhooks and callbacks.
FAQ
Can I verify leads automatically before they reach Instantly?
Yes, with a short script: submit the addresses to the Mail Exchange API, wait for the results, keep the deliverable ones, and add them to an Instantly campaign with POST /api/v2/leads/add. There is no ready-made Mail Exchange connector for Instantly yet.
How many leads can I add to Instantly in one API call?
Instantly's POST /api/v2/leads/add accepts between 1 and 1,000 leads per call, sent to either a campaign_id or a list_id. Larger lists need to be sent in chunks, ideally each with its own idempotency_key.
Should I set verify_leads_on_import when I already verified the leads?
No. verify_leads_on_import runs Instantly's own verification at 0.25 credit per lead. If the leads were already verified with Mail Exchange and filtered to deliverable, set it to false to avoid paying twice.
What are Instantly's API rate limits?
Instantly's API v2 allows no more than 100 requests per second and 6,000 requests per minute, shared across the workspace. Requests over either limit fail with HTTP 429.
To try this, start the free trial (25 checks) and create an API key in your account. API checks use the same monthly verifications as bulk uploads (plans from $49 a month for 10,000), and unknowns are refunded. Prefer no code? Upload the CSV in the app and follow the Instantly workflow.
