Recipe prompt
What you’ll build
A batch enrichment job. It takes a file of people, sends them to Forager in one request, waits for the batch to finish, and writes a result for every input row, found or not. Use this instead of the single lookup for enrichment runs, because the single lookup is rate limited for interactive use.Steps
1
Prepare the rows
Each row identifies a person one of two ways:
first_name, last_name and domain, or linkedin_public_identifier alone. A row with a domain and an identifier is refused, so check this before you send. Forager collapses duplicates in a request into one lookup, but deduplicate on your side too so your row count matches your records.2
Submit the batch
Send a
POST to Bulk work email lookup with email_lookups. The response has a batch_id, item_count and status.3
Poll until the batch completes
Poll Bulk work email lookup status and results.
status is queued, running, completed or failed. results stays empty until the batch is completed, so an empty list is never a partial answer. Polling is free.4
Match results to your rows
Each item in
results has submitted_index, the zero-based position of the row you sent, along with status, result, emails, error_code and submitted_lookup. Use submitted_index to write each result back to its row. Treat the outcomes like this:If the batch itself ends with
status failed, results is empty. Resubmit those rows in a new batch, cap the retries, then mark the rows as errors.Example result item (illustrative values)The spec describes each entry in emails as an address with a verdict, but types it as a string, so check the shape you receive before you parse it.Handle the edge cases
- Not found.
not_foundis a normal result. Keep it, so you do not look the same person up again. - Partial results. A completed batch can mix found, not found and failed rows. Retry only the retryable failures, in a new batch, and cap the retries.
- Rejected batch. Your credit balance must cover the whole batch, otherwise the batch is rejected and nothing is charged. Check your balance before large runs.
- 403. The key is missing or invalid. Fix the credentials; do not retry.
- 429. Back off and retry. The poll loop above backs off on a
429instead of failing. See errors and rate limits. - Credits. Each lookup in a batch costs 5 credits, charged only when an address is found. Polling never costs credits. See credit pricing.
Related
Bulk work emails
The guide behind this recipe.
Waterfall step
Use a single lookup inside a pipeline.
Bulk work email lookup
Request and response reference.