SDKs // TypeScript // Get started
First call
Last verified
Enrich a person with the Reverse Contact TypeScript SDK, read profile data, credits and request metadata, and handle lookups that return no match.
Install and configure the client, then enrich one person.
Enrich a person
This call enriches a person from a work email. It costs 2 credits when a person is found, and nothing when no profile matches.
Enrich a person
import ReverseContact from "@reverse-contact/sdk";
// CommonJS: const { ReverseContact } = require("@reverse-contact/sdk");
const client = new ReverseContact({ apiKey: process.env.RC_API_KEY });
const result = await client.enrich.person({ email: "jane.doe@acme.com" });
if (result === null) {
console.log("No confident match: nothing was charged");
} else {
const { person } = result.data;
console.log(person?.firstName, person?.lastName, person?.currentPositionTitle);
console.log("Credits used:", result.quotas?.creditsConsumed);
console.log("Request id:", result.metadata?.requestId);
}A non-null enrichment result has the fields below. Other JSON methods also return quotas, metadata and response. The shape of data depends on the method:
data: thedatafield of the API response. Enrich nests the profile indata.personordata.company. A cached fetch returns the profile directly indata, and Usage returnsdata: null. For a search page,datacontains the results. For a job,datacontains the acknowledgement.quotas: your credits and rate limits after this call, withcreditsConsumedfor the call itself.metadata:requestIdandexecutionTimeMs. Quote therequestIdwhen you contact support.response: the original HTTP response, including headers. The SDK has already read the body, so usedata.
quotas and metadata are optional. Some quota values and quotas.key can be null. Do not treat a missing snapshot as a zero balance: null, 0 and an empty array have different meanings.
Lookups that find nothing
enrich.person, enrich.company, fetch.person and fetch.company return null when the API answers 404 because nothing matched. These responses cost no credits. Check for null and move on without retrying.
A 404 outside a lookup, such as an unknown job id or a wrong base URL, raises NotFoundError.
For complete signatures, see client.enrich and client.fetch.
Return to the TypeScript SDK overview.
FAQ
Where is the person in an enrichment response?
client.enrich.person() returns the profile in result.data.person when a match is found. Cached client.fetch.person() returns the profile directly in result.data.
Does a person lookup with no match cost credits?
client.enrich.person() returns null for a no-match response and costs no credits. A successful person enrichment costs 2 credits.
Where can I find the request id and credits used?
result.metadata?.requestId identifies the request for support. result.quotas?.creditsConsumed reports the credits used by that call.