curl call: one person lookup, the responses to handle when a call fails, and one asynchronous work email lookup that you submit, poll and read. You need curl and, for the polling loop, jq.
1
Set your key and Account ID
Create a key on the API page of the Forager Web App and copy your Account ID from My Account. Export both; every call below reads them from the environment, never from the command line history.The key travels in the
X-API-KEY header. See API key authentication.2
Run your first lookup
A person lookup costs 1 credit and takes a LinkedIn public identifier (the slug after The response is one person record. Trimmed, with fictional values:Keep
/in/) or a Forager person_id.Response (illustrative)
id: the phone and personal email lookups take it as person_id.3
Handle the responses that are not a 200
Add An empty list or an empty body on a contact lookup is a result, not an error: the person was found but no number or address is on record.
-w '\n%{http_code}\n' to see the status code with the body, then branch on it. The documented cases:This script retries a
429 twice, with a growing wait, and prints everything else:4
Submit an async work email lookup
The work email lookup answers
202 at once with a job_id, because verifying an address takes longer than a request should wait. Identify the person by name and company domain, or by LinkedIn public identifier.202 response (illustrative)
5
Poll until the job is terminal
Poll the job result until A completed job has 5 credits are charged only when
status is completed or failed. Polling is free. While the job is still running the response carries a Retry-After header that says how long to wait.result set to found (with emails) or not_found. A failed job has an error_code such as person_not_found or no_current_employer.Completed job (illustrative)
result is found. To skip polling, send a webhook_url with the submit request and Forager POSTs the result there. For more than a handful of people, use the bulk lookup instead of a loop of single lookups.Next steps
Choose the right endpoint
Match what you have to the endpoint you need, with each call’s credit cost.
Errors and rate limits
Every documented status code and limit.
Python quickstart
The same walkthrough with
requests.Node.js quickstart
The same walkthrough with
fetch.