@generect/sdk
v0.1.1
Published
Official TypeScript SDK for the Generect Live API
Readme
@generect/sdk (TypeScript)
npm install @generect/sdkimport { Generect } from "@generect/sdk";
const g = new Generect({ apiKey: process.env.GENERECT_API_KEY! });
const count = await g.search.databaseLeadsCount({ job_titles: ["marketing manager"], locations: ["Germany"] });
const leads = await g.search.databaseLeads({ job_titles: ["marketing manager"], locations: ["Germany"], per_page: 10 });
console.log(leads.data, "cost:", leads.meta?.amount_charged, "USD");
const email = await g.email.find({ lead_id: (leads.data as any[])[0].id }); // billed only if a valid email is found
const job = await g.enrich.databaseLeadsBulk(urls.map((u) => ({ linkedin_url: u }))); // ≤50 items
const done = await g.enrich.waitLeadsBulk(job.meta!.job_id as string); // polls until completed / error- Automatic retries with exponential backoff on
429/5xx. - Typed errors:
InsufficientBalanceError(402),RateLimitError(429),AuthenticationError(401)… - Every response exposes its real USD cost:
resp.meta?.amount_charged. - Works on Node ≥18, edge runtimes, and browsers (bring your own fetch if needed).
Docs: https://docs.generect.com · Errors: https://docs.generect.com/api-reference/errors
