Find emails from company websites in Airtable (automation script)
Airtable automations can run a script, and scripts can call external APIs with fetch. That is enough to enrich a table of companies without an extra integration platform.
Use your own token. Create an API token in Apify under Settings, Integrations, and put it in the tool's secret or credential store. Never paste it into a shared sheet or a public workflow. The examples say YOUR_APIFY_TOKEN; replace it. Sending the token in the Authorization: Bearer header is safer than putting it in the URL, because URLs end up in logs.
Setup
- Table
Companieswith aWebsitefield and two empty fields:Email(single line text) andEmail status(single line text). - Create an automation. Trigger: "When a record matches conditions" (Website is not empty and Email is empty), or a button for a manual run.
- Add the action "Run a script". Add input variables
recordId(the record's ID),website(the Website field) andapifyToken(your token).
The token as an automation input is visible to anyone who can edit the automation, so use a dedicated Apify token and delete it when the project ends.
The script
const { recordId, website, apifyToken } = input.config();
const res = await fetch(
"https://api.apify.com/v2/acts/datagleaner~website-contact-details-scraper/run-sync-get-dataset-items" +
"?maxTotalChargeUsd=0.05&fields=domain,bestEmail,status",
{
method: "POST",
headers: { "Authorization": "Bearer " + apifyToken, "Content-Type": "application/json" },
body: JSON.stringify({ websites: [website], maxPagesPerSite: 4 })
}
);
if (!res.ok) throw new Error(res.status + " " + await res.text());
const items = await res.json();
const hit = items[0] || {};
await base.getTable("Companies").updateRecordAsync(recordId, {
"Email": hit.bestEmail || "",
"Email status": hit.status || "missing"
});
The fetch part, run in Node against the live Actor with ["basecamp.com","sitemaps.org"], returned:
[{"domain":"basecamp.com","bestEmail":"jason@basecamp.com","status":"ok"},{"domain":"sitemaps.org","bestEmail":null,"status":"noContacts"}]
Notes
- One record per run keeps the script simple; Airtable limits automation runs per month by plan, so for thousands of records export to CSV and use the Python version.
- Airtable script actions have a time limit per run. A single-site call finishes in a few seconds, well inside it.
What comes back
A JSON array with one object per site. Output order is not guaranteed to match input order (in our test, sitemaps.org came back before mozilla.org), so always match rows on domain, never on position. A real response for three sites, with fields=domain,bestEmail,status,failureReason:
[
{"domain": "basecamp.com", "bestEmail": "jason@basecamp.com", "status": "ok", "failureReason": null},
{"domain": "sitemaps.org", "bestEmail": null, "status": "noContacts", "failureReason": "no_contact_found"},
{"domain": "mozilla.org", "bestEmail": "trademark-permissions@mozilla.com", "status": "ok", "failureReason": null}
]
Without fields each object is large (around 60 keys: every email with the page it was found on and a kind, phones, 14 social networks, contact-form URLs, pages crawled). Ask only for what you need. A site that publishes no email still returns a row, with bestEmail: null. Junk input such as "not a site" returns a row with status: "invalidUrl" instead of failing the call.
What it costs
The Actor charges $0.002 for each site where an email is found and nothing for sites without one. 1,000 sites with 600 hits is about $1.20, and a 4-site test is under a cent. Apify's free plan includes monthly credit. The maxTotalChargeUsd query parameter in the examples is a hard cap on what one call can spend: the run stops when it is reached, so a typo cannot cost more than you set. Expect an email on roughly half to two-thirds of small-business sites and less on large brands; in our five-site test three sites gave one.
Try it: Website Contact Details Scraper on Apify. $0.002 per site with an email, nothing for sites without. The Apify free plan includes monthly credit, so a test run costs nothing out of pocket.
Related guides
- Find emails from a website list in Clay with an HTTP API column
- Clay: find a contact email per row with the Run Apify Actor action
- Find emails from a list of websites in n8n with Apify
- Find emails from a website list in Make (formerly Integromat)
- Find emails from a company website in Zapier with Webhooks
- Find emails from a website list in Google Sheets (Apps Script)