Trigger AI enrichment, track its progress, and enrich records in bulk.
Enrichment fills in what you don’t already know — firmographics, financials, headcount, and signals — by combining AI with data providers. This guide is the task-oriented companion to the enrichment concept: how to trigger it, know when it’s done, and run it across many records.
Create a company with at least a canonicalName — and a website when you have one — before enriching. The more identifying detail you provide, the more accurate the result.
Don’t hold a request open waiting for results. Instead, poll the company and compare two timestamps:
Field
Meaning
lastEnrichmentStartedAt
When the most recent run began.
lastEnrichedAt
When enrichment last completed and wrote values.
A run is still in progress while lastEnrichmentStartedAt is newer than lastEnrichedAt.
import osimport timeimport requestsBASE = "https://api.metal.ai/v1"headers = { "x-metal-client-id": os.environ["METAL_CLIENT_ID"], "x-metal-api-key": os.environ["METAL_API_KEY"],}def wait_for_enrichment(company_id, timeout=300, interval=10): requests.post(f"{BASE}/companies/{company_id}/enrich", headers=headers) deadline = time.time() + timeout while time.time() < deadline: company = requests.get(f"{BASE}/companies/{company_id}", headers=headers).json()["data"] started = company.get("lastEnrichmentStartedAt") finished = company.get("lastEnrichedAt") if finished and (not started or finished >= started): return company time.sleep(interval) raise TimeoutError(f"Enrichment for {company_id} did not finish in {timeout}s")
Prefer not to poll? Configure a webhook trigger so Metal notifies your system when enrichment completes.
Looping enrich one company at a time works, but it’s slow and burns through rate limits. To enrich many records efficiently, add them to a list and enrich at the list level — Metal computes enriched columns across every entry.
1
Collect the records
Add the companies you want to enrich to a list.
2
Enrich the list
Trigger enrichment at the list level so it fans out across all entries.
3
Read results
Read the list entries to pull enriched values for every company at once.