export type CreateApiIcypeasApiFindCompaniesArgs = {body: {query: Record, pagination?: Record | undefined}}; export type CreateApiIcypeasApiFindCompaniesOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Search the Icypeas lead database for companies. Returns {total, leads[], pagination}, paginated (pagination.size 1-200, default 100; pass back pagination.token with the same query for the next page). query filters (any other key is rejected): include/exclude lists {"include":[...],"exclude":[...]} (max 200 values each) for name, lid (LinkedIn vanity id, e.g. "google"), urn (LinkedIn numeric id as string, e.g. "1527"), companyId (domain, website, URN, LinkedIn URL or vanity name), type (Privately Held, Sole Proprietorship, Self-Employed, Partnership, Public Company, Nonprofit, Educational Institution, Government Agency), industry (LinkedIn industry names, e.g. "Software Development"), location (prefer ISO country codes like "US"; "Paris, France" narrows to a city; values are OR'd), keyword (free text across the company profile), domain (bare domain like "acme.com"); ranges for headcount and revenue using only the keys ">", ">=", "<", "<=" with numeric values, e.g. {"headcount":{">=":11,"<=":200}} (gte/lte/min/max/from/to and string numbers are rejected); headcountGrowth {"timespan":"6months"|"12months"|"24months","min":-10,"max":50} (timespan required; min/max are percentages -100 to 10000). Example: {"query":{"industry":{"include":["Software Development"]},"location":{"include":["DE"]},"headcount":{">=":11,"<=":200}},"pagination":{"size":50}} * * POST /icypeas/api/find-companies */ export const createApiIcypeasApiFindCompanies = async (args: CreateApiIcypeasApiFindCompaniesArgs, options?: CreateApiIcypeasApiFindCompaniesOptions) => { const {baseUrl = "https://api.orthogonal.com/mpp", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") const url = `${baseUrl.replace(/\/+$/, '')}/icypeas/api/find-companies${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };