fetch (Node 18 or newer): one person lookup, a small client that handles the failure responses, and an asynchronous work email lookup that you submit, poll and read. No Forager package is needed, and none is published yet, so there is nothing to install.
1
Set your credentials
process.env; keep the key out of source files, logs and anything that ships to a browser. See API key authentication.2
Run your first lookup
A person lookup costs 1 credit and takes a LinkedIn public identifier (the slug after Run it with Keep
/in/) or a Forager person_id.first-lookup.mjs
node first-lookup.mjs. The response is one person record. Trimmed, with fictional values:Response (illustrative)
id: the phone and personal email lookups take it as person_id.3
Handle 403, 429 and running out of credits
resp.ok is false for every error. The cases below need different handling, so wrap fetch in a small client:forager-client.mjs
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 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.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.Test without spending credits
Stubfetch in your tests so they never reach api-v2.forager.ai. In Node 18 and later, globalThis.fetch can be replaced with a function that returns new Response(JSON.stringify(body), { status, headers }): return a 403 to check the auth error, a 429 then a 200 to check the retry, and a completed job body to check the polling loop.
Next steps
Nightly job postings sync
A complete Node.js script built on this client.
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.