"""Dealright Leads API client for Python 3.9 or later. Standard library only. Copy this file next to your code. It has no dependencies. Generated from docs/openapi.json by leads/scripts/gen-dev-docs.mjs. Do not edit: run the script. OpenAPI leads operations sha256: 3af5b10b284d551659e7875b08b570a5940d24ca5994a352a664e4218aabbcd8 import os from dealright_leads import DealrightLeads client = DealrightLeads(api_key=os.environ["DEALRIGHT_API_KEY"]) page = client.search_companies(q="plumbing", state="ID", limit=5) Docs: https://dealright.ai/developers """ from __future__ import annotations import json import urllib.error import urllib.parse import urllib.request from typing import Any, Dict, Optional, TypedDict DEFAULT_BASE_URL = "https://api.dealright.ai" # The edge refuses the default urllib User-Agent (Cloudflare error 1010), so the client names itself. USER_AGENT = "dealright-leads-python/3af5b10b284d" # The stable error codes of the API: branch on code, never on the words of error. ERROR_CODES = ("bad_request", "unauthorized", "forbidden", "not_found", "payment_required", "unlock_required", "company_reveal_required", "not_top_level", "conflict", "gone", "rate_limited", "in_progress", "day_limit", "upstream_failed", "unavailable", "not_offered") class DealrightLeadsError(Exception): """A refusal of the API. status is the HTTP status; code the stable error code (or None); body is the JSON body, with "error" in words.""" def __init__(self, status: int, body: Optional[Dict[str, Any]], retry_after: Optional[float]): self.status = status self.body = body self.retry_after = retry_after c = (body or {}).get("code") self.code: Optional[str] = c if c in ERROR_CODES else None super().__init__(f"HTTP {status}{' ' + c if c else ''}: {(body or {}).get('error', 'no error message')}") class CsvAnswer(TypedDict): """The answer of a CSV route: the text, and the headers (X-Leads-* carry the row count, the charge and the cursor).""" text: str headers: Dict[str, str] def _seg(value: str) -> str: return urllib.parse.quote(str(value), safe="") def _drop_none(d: Dict[str, Any]) -> Dict[str, Any]: return {k: v for k, v in d.items() if v is not None} class DealrightLeads: """The Leads API. api_key: an API key of your organization (dlr_...), from https://leads.dealright.ai/developers.""" def __init__(self, api_key: str, base_url: str = DEFAULT_BASE_URL, timeout: float = 60.0): if not api_key: raise ValueError("DealrightLeads: api_key is missing") self.api_key = api_key self.base_url = base_url.rstrip("/") self.timeout = timeout def _call(self, method: str, path: str, query: Optional[Dict[str, Any]] = None, body: Any = None, csv: bool = False) -> Any: q = {k: str(v) for k, v in (query or {}).items() if v is not None and v != ""} url = self.base_url + path + ("?" + urllib.parse.urlencode(q) if q else "") headers = {"Accept": "text/csv" if csv else "application/json", "User-Agent": USER_AGENT} data = None if body is not None: headers["Content-Type"] = "application/json" data = json.dumps(body).encode("utf-8") req = urllib.request.Request(url, data=data, headers=headers, method=method) # Unredirected: urllib copies normal headers to the URL of a redirect, on any host; the key must not follow. req.add_unredirected_header("Authorization", "Bearer " + self.api_key) try: with urllib.request.urlopen(req, timeout=self.timeout) as res: text = res.read().decode("utf-8") if csv: return {"text": text, "headers": {k.lower(): v for k, v in res.headers.items()}} return json.loads(text) if text else None except urllib.error.HTTPError as e: raw = e.read().decode("utf-8", "replace") try: parsed = json.loads(raw) except ValueError: parsed = {"error": raw[:300]} retry = e.headers.get("Retry-After") raise DealrightLeadsError(e.code, parsed, float(retry) if retry and retry.isdigit() else None) from None def search_companies(self, *, q: Any = None, state: Any = None, sector: Any = None, industry: Any = None, city: Any = None, zip: Any = None, emp_min: Any = None, emp_max: Any = None, has_phone: Any = None, has_email: Any = None, has_owner: Any = None, has_people: Any = None, registered: Any = None, licensed: Any = None, form5500: Any = None, hide_sunk: Any = None, near: Any = None, miles: Any = None, sig: Any = None, skill: Any = None, service: Any = None, founded_min: Any = None, founded_max: Any = None, naics: Any = None, sic: Any = None, site: Any = None, site_pages: Any = None, ownership: Any = None, revenue: Any = None, metro: Any = None, language: Any = None, has_postings: Any = None, posting_title: Any = None, posted_within: Any = None, changed: Any = None, changed_within: Any = None, bbox: Any = None, funding_min: Any = None, funded_since: Any = None, parent: Any = None, independent: Any = None, succession_min: Any = None, tech: Any = None, model: Any = None, niche: Any = None, has_mobile: Any = None, landline_only: Any = None, has_direct_dial: Any = None, activity: Any = None, activity_min: Any = None, activity_within: Any = None, tag: Any = None, include_domains: Any = None, exclude_domains: Any = None, include_list: Any = None, exclude_list: Any = None, sort: Any = None, offset: Any = None, limit: Any = None) -> Any: """Search companies (contact values masked until unlocked). GET /v3/leads/companies. Permission: search. q: Words in the company name, site text or industry. Several values: a|b. Exact: =value. Not: !value. state: US states as 2-letter codes, separated by commas. `!ID` leaves a state out. sector: One sector of the Dealright taxonomy, as GET /v3/leads/facets lists it. industry: Industry name. Several values: a|b. Exact: =value. Not: !value. city: City name. Several values: a|b. Exact: =value. Not: !value. zip: ZIP code. emp_min: Fewest employees, a whole number. emp_max: Most employees, a whole number. has_phone: Only companies with a phone. Give 1 to turn it on; any other value is ignored. has_email: Only companies with an email. Give 1 to turn it on; any other value is ignored. has_owner: Only companies with a named owner. Give 1 to turn it on; any other value is ignored. has_people: Only companies with named people. Give 1 to turn it on; any other value is ignored. registered: Only companies matched to a state business registry record. Give 1 to turn it on; any other value is ignored. licensed: Only companies matched to a licence record. Give 1 to turn it on; any other value is ignored. form5500: Only companies with a Form 5500 benefit plan filing. Give 1 to turn it on; any other value is ignored. hide_sunk: Leave out network, toll-free-only, template and chain sites. Give 1 to turn it on; any other value is ignored. near: Centre of a radius search: a 5-digit ZIP code or a city as `City, ST`. miles: Radius in miles around `near`, 1 to 250. sig: Signals that the company site shows, separated by commas. skill: A service or skill that the company site names. Several values: a|b. Exact: =value. Not: !value. service: Services, keywords or credentials of the company site, each equal to one whole tag (case does not matter): `wills` does not match `wills and trusts`. Several: a|b (up to 20). Not: !value. founded_min: Earliest founding year, 4 digits. founded_max: Latest founding year, 4 digits. naics: NAICS codes of 2 to 6 digits; each is a prefix match (`5413` matches `541310`). Several: a|b. Not: !code. sic: SIC 1987 codes of 2 to 4 digits; each is a prefix match (`87` matches `8711`). Exact: =code (4 digits). Several: a|b. Not: !code. A SIC code is a crosswalk mapping of the company's 6-digit NAICS 2022 code (Census concordances), never a reported code: the search keeps the companies whose NAICS code maps to it. A company with no 6-digit NAICS code has no SIC code. site: Words and phrases in the text of the company's own site (homepage, key pages and crawl pages). Words in one value are all required; "quotes" make a phrase; several values: a|b; !value leaves out the companies that match it. Each word matches by its stem: plumber matches plumbers. site_pages: The pages that `site` searches: `all` (the default) the homepage, the key pages and up to 20 crawl pages of the site (50,000 characters at most); `home` the homepage only. ownership: Ownership classes: family, owner_operated, franchise, multi_location, group, parent, employee_owned, nonprofit. Several: a|b. Not: !class. revenue: Estimated revenue bands: lt500k, 500k_1m, 1m_2.5m, 2.5m_5m, 5m_10m, 10m_25m, 25m_plus. An estimate from employees and industry averages (Census SUSB 2022), never a reported figure. Several: a|b. Not: !band. metro: Metro areas (Census Core Based Statistical Areas, OMB July 2023): a 5-digit CBSA code (14260) or a CBSA title (Boise City, ID; case does not matter), from the company's ZIP code. Several: a|b. Not: !value. A company with no ZIP code, or a ZIP code in no CBSA, has no metro area and matches no value; Not keeps it. language: Website languages as ISO 639-1 codes (en, es, de): the language that the homepage declares (html lang), else the language that its text reads as. Several: a|b. Not: !code. A company whose language is unknown matches no code; Not keeps it. has_postings: 1: only companies with a job posting on the pages of their site that Dealright stored (schema.org JobPosting data, or a careers page of one job). A company with no posting found is unknown, not one that does not hire. posting_title: Words of a job title (2 to 120 characters): only companies with a posting whose title has every word, for example `technician` or `dental assistant`. posted_within: Days, 1 to 365: only companies with a posting dated in the last N days (its datePosted, or the date of the page). A posting with no date never matches. With posting_title, the same posting must match both. changed: Business events: only companies with an event of one of these types in the last `changed_within` months. Types: owner_changed, person_added, person_removed, location_added, phone_changed, service_added, ownership_changed, site_alive, job_change (a person who joined the company from another site), site_dead and site_parked (a site that is a company again only matches these after it came back). Several: a|b. History starts at 2026-10: the first events are those of 2026-11. changed_within: The months of the `changed` filter, 1 to 12, counted back from the month of the index. Default 3. bbox: Map area: west,south,east,north in decimal degrees. Only companies whose point (site point, else ZIP centroid) is in the area. With bbox, limit may be up to 2000. funding_min: SEC Form D: the least total amount sold, in whole US dollars (up to 12 digits). Only companies with a joined Form D filing match. funded_since: SEC Form D: the earliest newest date of first sale, as YYYY-MM-DD, YYYY-MM or YYYY. Only companies with a joined Form D filing match. parent: A domain: only the sites of the group whose parent site it is (schema 8). The company page names the parent of a company in `group.parent`. independent: Only companies with a family or owner-operated class and no sign of a group, of several locations, of a franchise or of a parent (schema 8). Give 1 to turn it on; any other value is ignored. succession_min: The least succession signal, 0 to 100 (schema 8). Refused with a `note` until the signal is turned on: it is a heuristic, not yet measured against real sales. tech: Products that the company homepage loads, by name (Shopify, Google Analytics, HubSpot); a bare value is a prefix. Several values: a|b. Exact: =value. Not: !value. model: Business model: b2b, b2c, both. Several: a|b. Not: !model. niche: Niche of the industry label, for example Criminal defense. Several values: a|b. Exact: =value. Not: !value. has_mobile: Only rows with a business phone whose number block is wireless (an estimate: a ported number keeps its block). For people, a phone of the company. Give 1 to turn it on; any other value is ignored. landline_only: Only rows whose every business phone is in a landline block (an unknown phone fails it). For people, the phones of the company. Give 1 to turn it on; any other value is ignored. has_direct_dial: Only rows with a person-level number that is not the main company number. The index has no person-level numbers yet, so it answers no rows and a note. Give 1 to turn it on; any other value is ignored. activity: Activity signal kinds: hiring, funding, new_location, site_change, news. Several: a|b (a company with a signal of one of them in the window). Signals of the company's own site and of public records, not third-party intent data. activity_min: The least Activity signals score, 1 to 100: hiring 25, funding (SEC Form D) 30, new location 20, other site change 15, news 10; each kind counts one time. activity_within: The window of the activity filters and of each row's `activity_signals`, in days back from today: 1 to 365. Default 90. tag: Tags of the organization, by name (any case) or id. Several: a|b (a row with one of them). Exact name: =Name. Not: !name. With only tags to include and no other filter, the answer is the tagged rows, in key order. With other filters, the tags filter the rows of each page of the search, so a page can have fewer rows than `limit`, and `note` says so. include_domains: A list of domains: only these companies. Each entry is a domain, a URL or an email address; commas, spaces, semicolons or line ends separate entries, and an entry that is not a domain is left out. The two lists hold 500 domains at most together. A list with no domain is refused. The other filters apply too. exclude_domains: A list of domains to leave out, written as `include_domains` (for example the companies that you already work with). include_list: The `id` of a saved list (GET /v3/leads/lists): only the companies of that list, read by the API (no cap of 500). The companies of a list are its companies and the companies of its people. A list that you do not see answers 404; a list with no company answers no rows and a `note`. exclude_list: The `id` of a saved list: leave out the companies of that list (for example the companies that you already work with). sort: `name` or `employees`. Any other value, or none, is the default rank. offset: Rows to skip, 0 to 9900. Default 0. limit: Rows in the page, 1 to 200 (1 to 2000 with bbox). Default 25.""" return self._call("GET", f"/v3/leads/companies", query={"q": q, "state": state, "sector": sector, "industry": industry, "city": city, "zip": zip, "emp_min": emp_min, "emp_max": emp_max, "has_phone": has_phone, "has_email": has_email, "has_owner": has_owner, "has_people": has_people, "registered": registered, "licensed": licensed, "form5500": form5500, "hide_sunk": hide_sunk, "near": near, "miles": miles, "sig": sig, "skill": skill, "service": service, "founded_min": founded_min, "founded_max": founded_max, "naics": naics, "sic": sic, "site": site, "site_pages": site_pages, "ownership": ownership, "revenue": revenue, "metro": metro, "language": language, "has_postings": has_postings, "posting_title": posting_title, "posted_within": posted_within, "changed": changed, "changed_within": changed_within, "bbox": bbox, "funding_min": funding_min, "funded_since": funded_since, "parent": parent, "independent": independent, "succession_min": succession_min, "tech": tech, "model": model, "niche": niche, "has_mobile": has_mobile, "landline_only": landline_only, "has_direct_dial": has_direct_dial, "activity": activity, "activity_min": activity_min, "activity_within": activity_within, "tag": tag, "include_domains": include_domains, "exclude_domains": exclude_domains, "include_list": include_list, "exclude_list": exclude_list, "sort": sort, "offset": offset, "limit": limit}, body=None) def search_people(self, *, q: Any = None, name: Any = None, title: Any = None, company: Any = None, state: Any = None, city: Any = None, role: Any = None, level: Any = None, department: Any = None, sector: Any = None, domain: Any = None, edu: Any = None, skill: Any = None, near: Any = None, miles: Any = None, exp_min: Any = None, has_postings: Any = None, posting_title: Any = None, posted_within: Any = None, has_mobile: Any = None, landline_only: Any = None, has_direct_dial: Any = None, activity: Any = None, activity_min: Any = None, activity_within: Any = None, tag: Any = None, include_list: Any = None, exclude_list: Any = None, offset: Any = None, limit: Any = None) -> Any: """Search people named on a company site or licence. GET /v3/leads/people. Permission: search. q: Words in the name, the title or the company of the person. Several values: a|b. Exact: =value. Not: !value. name: Name of the person. Several values: a|b. Exact: =value. Not: !value. title: Job title. Several values: a|b. Exact: =value. Not: !value. company: Company name. Several values: a|b. Exact: =value. Not: !value. state: US states as 2-letter codes, separated by commas. city: The city of the person's company, as the city filter of the company search. Several values: a|b. Exact: =value. Not: !value. role: Role groups of the people: technical (IT, technical staff, systems and network administrators, developers, data people, IT managers, the CTO, the CIO, the VP or head of technology) or executive (the C-suite: a chief officer, the president, the founder, the owner), or the two (technical,executive). From the title words and the department; one tested rule set. A person with no title in a group is left out: unknown, not a negative. Each person row has role_groups. level: Seniority levels, separated by commas. department: Departments, separated by commas. sector: One sector of the Dealright taxonomy. domain: Only the people of the company with this domain. edu: Schools or degrees that the company site names, separated by commas. skill: A skill that the company site names. Several values: a|b. Exact: =value. Not: !value. near: Centre of a radius search: a 5-digit ZIP code or a city as `City, ST`. miles: Radius in miles around `near`, 1 to 250. exp_min: Years, 1 to 60: only people whose bio on the company site states at least this many years of experience ("15 years of experience", "practicing since 2001"). A person whose site states none is unknown and never matches (schema 15). has_postings: 1: only the people of companies with a job posting (the company filter of the same name). posting_title: Words of a job title: only the people of companies with a posting whose title has every word. posted_within: Days, 1 to 365: only the people of companies with a posting dated in the last N days. has_mobile: Only rows with a business phone whose number block is wireless (an estimate: a ported number keeps its block). For people, a phone of the company. Give 1 to turn it on; any other value is ignored. landline_only: Only rows whose every business phone is in a landline block (an unknown phone fails it). For people, the phones of the company. Give 1 to turn it on; any other value is ignored. has_direct_dial: Only rows with a person-level number that is not the main company number. The index has no person-level numbers yet, so it answers no rows and a note. Give 1 to turn it on; any other value is ignored. activity: Activity signal kinds: hiring, funding, new_location, site_change, news. Several: a|b (a company with a signal of one of them in the window). Signals of the company's own site and of public records, not third-party intent data. activity_min: The least Activity signals score, 1 to 100: hiring 25, funding (SEC Form D) 30, new location 20, other site change 15, news 10; each kind counts one time. activity_within: The window of the activity filters and of each row's `activity_signals`, in days back from today: 1 to 365. Default 90. tag: Tags of the organization, by name (any case) or id. Several: a|b (a row with one of them). Exact name: =Name. Not: !name. With only tags to include and no other filter, the answer is the tagged rows, in key order. With other filters, the tags filter the rows of each page of the search, so a page can have fewer rows than `limit`, and `note` says so. include_list: The `id` of a saved list (GET /v3/leads/lists): only the people of the companies of that list (its companies and the companies of its people). A list that you do not see answers 404. exclude_list: The `id` of a saved list: leave out the people of the companies of that list. offset: Rows to skip, 0 to 9900. Default 0. limit: Rows in the page, 1 to 200. Default 25.""" return self._call("GET", f"/v3/leads/people", query={"q": q, "name": name, "title": title, "company": company, "state": state, "city": city, "role": role, "level": level, "department": department, "sector": sector, "domain": domain, "edu": edu, "skill": skill, "near": near, "miles": miles, "exp_min": exp_min, "has_postings": has_postings, "posting_title": posting_title, "posted_within": posted_within, "has_mobile": has_mobile, "landline_only": landline_only, "has_direct_dial": has_direct_dial, "activity": activity, "activity_min": activity_min, "activity_within": activity_within, "tag": tag, "include_list": include_list, "exclude_list": exclude_list, "offset": offset, "limit": limit}, body=None) def similar_people(self, *, domain: Any, name: Any, limit: Any = None) -> Any: """People like one person: same title and level at similar companies. GET /v3/leads/people/similar. Permission: search. domain: The domain of the company of the person. name: The name of the person as the company page or the people search gives it. limit: Rows, 1 to 50. Default 25.""" return self._call("GET", f"/v3/leads/people/similar", query={"domain": domain, "name": name, "limit": limit}, body=None) def facets(self) -> Any: """The values of the search filters, with counts. GET /v3/leads/facets. Permission: search.""" return self._call("GET", f"/v3/leads/facets", query=None, body=None) def places(self, *, q: Any = None) -> Any: """Location typeahead: states, cities and ZIP codes with counts. GET /v3/leads/places. Permission: search. q: The text typed so far (60 characters at most).""" return self._call("GET", f"/v3/leads/places", query={"q": q}, body=None) def get_company(self, domain: str, *, role: Any = None, wait_seconds: Any = None) -> Any: """One company page (contact values masked until unlocked). GET /v3/leads/companies/{domain}. Permission: search. role: Role groups of the people: technical (IT, technical staff, systems and network administrators, developers, data people, IT managers, the CTO, the CIO, the VP or head of technology) or executive (the C-suite: a chief officer, the president, the founder, the owner), or the two (technical,executive). From the title words and the department; one tested rule set. A person with no title in a group is left out: unknown, not a negative. Each person row has role_groups. wait_seconds: Seconds, 0 to 50: hold the answer while the full scrape is queued or running, until it ends or the time runs out. Default 0: answer at once.""" return self._call("GET", f"/v3/leads/companies/{_seg(domain)}", query={"role": role, "wait_seconds": wait_seconds}, body=None) def similar_companies(self, domain: str, *, limit: Any = None, exclude: Any = None) -> Any: """Companies like one company, ranked (contact values masked). GET /v3/leads/companies/{domain}/similar. Permission: search. limit: Rows, 1 to 50. Default 25. exclude: Leave out companies: `lists` (in the lists of the organization that the caller sees), `unlocked` (unlocked by the organization) or `lists,unlocked`.""" return self._call("GET", f"/v3/leads/companies/{_seg(domain)}/similar", query={"limit": limit, "exclude": exclude}, body=None) def company_judge(self, domain: str) -> Any: """The judge verdicts of one company page. GET /v3/leads/companies/{domain}/judge. Permission: search.""" return self._call("GET", f"/v3/leads/companies/{_seg(domain)}/judge", query=None, body=None) def start_company_judge(self, domain: str) -> Any: """Start the judge on one company page. POST /v3/leads/companies/{domain}/judge. Permission: search.""" return self._call("POST", f"/v3/leads/companies/{_seg(domain)}/judge", query=None, body=None) def company_news(self, domain: str) -> Any: """News articles about one company, from GDELT. GET /v3/leads/companies/{domain}/news. Permission: search.""" return self._call("GET", f"/v3/leads/companies/{_seg(domain)}/news", query=None, body=None) def similar_to_seeds(self, *, seeds: Any = None, list_id: Any = None, exclude: Any = None, limit: Any = None) -> Any: """Companies like several seed companies or a list, ranked (contact values masked). GET /v3/leads/similar. Permission: search. seeds: Seed companies: 1 to 10 domains, URLs or email addresses, separated by commas. Give this or `list_id`. list_id: A list of the organization: its first 10 companies are the seeds. Give this or `seeds`. exclude: Leave out companies: `lists` (in the lists of the organization that the caller sees), `unlocked` (unlocked by the organization) or `lists,unlocked`. limit: Rows, 1 to 50. Default 25.""" return self._call("GET", f"/v3/leads/similar", query={"seeds": seeds, "list_id": list_id, "exclude": exclude, "limit": limit}, body=None) def market(self, *, industry: Any = None, sector: Any = None, naics: Any = None, state: Any = None, zip: Any = None, near: Any = None, miles: Any = None) -> Any: """The size and the structure of one market (free). GET /v3/leads/market. Permission: search. industry: An industry label or words of one, with the modifiers of the company search (`=label` for an exact label) sector: A top-level sector of the taxonomy naics: NAICS codes of 2 to 6 digits, each a prefix, `|` between them, `!code` for Not state: Two-letter states, separated by commas zip: A ZIP prefix of 3 to 5 digits: 3 digits is about one metro area near: A radius centre: a 5-digit ZIP or `City, ST` miles: The radius in miles, 1 to 250 (default 25)""" return self._call("GET", f"/v3/leads/market", query={"industry": industry, "sector": sector, "naics": naics, "state": state, "zip": zip, "near": near, "miles": miles}, body=None) def company_events(self, domain: str, *, type_: Any = None, months: Any = None) -> Any: """What changed on one company's site, month over month. GET /v3/leads/companies/{domain}/events. Permission: search. type: Event types, separated by |: owner_changed, person_added, person_removed, location_added, phone_changed, service_added, ownership_changed, site_dead, site_parked, site_alive, job_change months: Only the events of the last 1 to 120 months of the index""" return self._call("GET", f"/v3/leads/companies/{_seg(domain)}/events", query={"type": type_, "months": months}, body=None) def bulk_lookup(self, *, values: Any) -> Any: """Bulk lookup of domains, URLs, emails or company names (masked). POST /v3/leads/bulk. Permission: search.""" return self._call("POST", f"/v3/leads/bulk", query=None, body=_drop_none({"values": values})) def bulk_lookup_people(self, *, people: Any) -> Any: """Bulk lookup of people by name and company (masked). POST /v3/leads/bulk/people. Permission: search. people: Each item: {first_name, last_name, company}.""" return self._call("POST", f"/v3/leads/bulk/people", query=None, body=_drop_none({"people": people})) def ask(self, *, q: Any, kind: Any = None) -> Any: """Turn a sentence into search filters (natural-language search). POST /v3/leads/ask. Permission: search. q: The sentence that says which companies or people to find. kind: Fix the search. Without it, the sentence decides. One of: companies, people.""" return self._call("POST", f"/v3/leads/ask", query=None, body=_drop_none({"q": q, "kind": kind})) def search_investors(self, *, q: Any = None, ftype: Any = None, state: Any = None, band: Any = None, pf_min: Any = None, kind: Any = None, sort: Any = None, offset: Any = None, limit: Any = None) -> Any: """Search investment adviser firms (the SEC register): private equity, venture and other private funds. GET /v3/leads/investors. Permission: search. q: Text in the firm name or legal name. ftype: Fund types, commas between: pe, vc, hedge, real_estate, other. A firm that advises a private fund of one of the types. state: Office states (2-letter codes), commas between. band: AUM bands 1 to 4, commas between: 1 under $100M, 2 $100M to $1B, 3 $1B to $10B, 4 $10B and over. pf_min: The least number of private funds. kind: Registered advisers or exempt reporting advisers. sort: The order: aum (default, largest first), name or funds. offset: Rows to skip. limit: Rows in the page.""" return self._call("GET", f"/v3/leads/investors", query={"q": q, "ftype": ftype, "state": state, "band": band, "pf_min": pf_min, "kind": kind, "sort": sort, "offset": offset, "limit": limit}, body=None) def investor_facets(self) -> Any: """The values of the investor filters, with counts. GET /v3/leads/investors/facets. Permission: search.""" return self._call("GET", f"/v3/leads/investors/facets", query=None, body=None) def sba_acquisitions(self, domain: str) -> Any: """Acquisitions financed by SBA 7(a) loans in the industry and state of one company (SBA 7(a) FOIA). GET /v3/leads/companies/{domain}/sba-acquisitions. Permission: search.""" return self._call("GET", f"/v3/leads/companies/{_seg(domain)}/sba-acquisitions", query=None, body=None) def company_holders(self, domain: str, *, up: Any = None, down: Any = None) -> Any: """The direct 1-hop holder chain of one company. GET /v3/leads/companies/{domain}/holders. Permission: search. up: Levels of holders above the company (clamped to 0 or 1 on free reads; deeper hops require a Dossier). down: Levels of holdings below the company (clamped to 0 or 1 on free reads; deeper hops require a Dossier).""" return self._call("GET", f"/v3/leads/companies/{_seg(domain)}/holders", query={"up": up, "down": down}, body=None) def company_reveals(self, domain: str) -> Any: """The reveal history of one company in your organization. GET /v3/leads/companies/{domain}/reveals. Permission: search.""" return self._call("GET", f"/v3/leads/companies/{_seg(domain)}/reveals", query=None, body=None) def unlock(self, *, domains: Any) -> Any: """Unlock companies: their emails and phones, charged once each. POST /v3/leads/unlock. Permission: unlock.""" return self._call("POST", f"/v3/leads/unlock", query=None, body=_drop_none({"domains": domains})) def account(self) -> Any: """The plan and the leads and cost of this month. GET /v3/leads/account. Permission: account.""" return self._call("GET", f"/v3/leads/account", query=None, body=None) def reveal(self, *, domain: Any, first_name: Any, last_name: Any) -> Any: """Reveal the work email of one person at an unlocked company. POST /v3/leads/reveal. Permission: reveal.""" return self._call("POST", f"/v3/leads/reveal", query=None, body=_drop_none({"domain": domain, "first_name": first_name, "last_name": last_name})) def reveal_line_type(self, *, domain: Any, phone: Any) -> Any: """Reveal the exact line type of one business phone of an unlocked company. POST /v3/leads/reveal/line-type. Permission: reveal.""" return self._call("POST", f"/v3/leads/reveal/line-type", query=None, body=_drop_none({"domain": domain, "phone": phone})) def verify_emails(self, *, emails: Any) -> Any: """Verify work email addresses (SMTP check, no message sent). POST /v3/leads/verify. Permission: reveal. emails: 1 to 100 work email addresses. Case and spaces around an address do not count; each address is checked one time.""" return self._call("POST", f"/v3/leads/verify", query=None, body=_drop_none({"emails": emails})) def reveal_person(self, *, domain: Any, first_name: Any, last_name: Any, types: Any = None) -> Any: """Reveal the work email and phone of one person, each value with its proof. POST /v3/leads/reveal/person. Permission: reveal. domain: The domain of the unlocked company of the person. types: email, phone or the two (the default). Each item is one of: email, phone.""" return self._call("POST", f"/v3/leads/reveal/person", query=None, body=_drop_none({"domain": domain, "first_name": first_name, "last_name": last_name, "types": types})) def reveal_people(self, *, people: Any, types: Any = None, dry_run: Any = None, max_cents: Any = None) -> Any: """Reveal the contacts of up to 25 people; dry_run gives the cost first. POST /v3/leads/reveal/people. Permission: reveal. people: Each item: {domain, first_name, last_name}. types: email, phone or the two (the default), for every person. Each item is one of: email, phone. dry_run: true: the cost of the batch, person by person; no source is asked and nothing is charged. max_cents: The most cents that the batch may charge: a person who could pass it is not started.""" return self._call("POST", f"/v3/leads/reveal/people", query=None, body=_drop_none({"people": people, "types": types, "dry_run": dry_run, "max_cents": max_cents})) def dossier(self, domain: str, *, tier: Any = None) -> Any: """The Dossier of one company: preview, progress and result. GET /v3/leads/companies/{domain}/dossier. Permission: search. tier: standard ($1,000/mo / $199 single-deal test) or institutional ($2,500/mo / $399 single-deal test). Default standard.""" return self._call("GET", f"/v3/leads/companies/{_seg(domain)}/dossier", query={"tier": tier}, body=None) def buy_dossier(self, domain: str, *, tier: Any = None) -> Any: """Order a Business or Bank-Grade Institutional Dossier. POST /v3/leads/companies/{domain}/dossier. Permission: reveal. tier: standard ($1,000/mo / $199 single-deal test) or institutional ($2,500/mo / $399 single-deal test). Default standard. One of: standard, institutional.""" return self._call("POST", f"/v3/leads/companies/{_seg(domain)}/dossier", query=None, body=_drop_none({"tier": tier})) def intel_report(self, domain: str, *, tier: Any = None) -> Any: """Preview, status, or completed Diligence Report for one company. GET /v3/intel/reports/{domain}. Permission: search. tier: Report tier: standard ($1,000/mo Basic / $199 single-deal test) or institutional ($2,500/mo Bank-Grade / $399 single-deal test).""" return self._call("GET", f"/v3/intel/reports/{_seg(domain)}", query={"tier": tier}, body=None) def order_intel_report(self, domain: str, *, tier: Any = None) -> Any: """Order and generate a Business or Institutional Diligence Report. POST /v3/intel/reports/{domain}. Permission: reveal. tier: One of: standard, institutional.""" return self._call("POST", f"/v3/intel/reports/{_seg(domain)}", query=None, body=_drop_none({"tier": tier})) def intel_graph(self, domain: str) -> Any: """Universal Knowledge Graph view for a company (1-hop free; multi-hop unlocked by report). GET /v3/intel/graph/{domain}. Permission: search.""" return self._call("GET", f"/v3/intel/graph/{_seg(domain)}", query=None, body=None) def intel_kg_node(self, id: str, *, limit: Any = None) -> Any: """Lookup any entity node and its provenance-backed edges in Arnor v4 KG. GET /v3/intel/kg/node/{id}. Permission: search. limit: Maximum incoming/outgoing edges per direction (default 100).""" return self._call("GET", f"/v3/intel/kg/node/{_seg(id)}", query={"limit": limit}, body=None) def intel_kg_dominance(self, id: str, *, peers: Any = None, as_of: Any = None) -> Any: """Competitive Dominance & Asymmetric Delta analysis in Arnor v4 KG. GET /v3/intel/kg/dominance/{id}. Permission: search. peers: Optional comma-separated peer entity IDs. as_of: Optional bitemporal date (YYYY-MM-DD or RFC3339).""" return self._call("GET", f"/v3/intel/kg/dominance/{_seg(id)}", query={"peers": peers, "as_of": as_of}, body=None) def intel_kg_supply_chain(self, id: str, *, hops: Any = None, as_of: Any = None) -> Any: """Multi-Tier Supply Chain, SPOF, HHI & Contagion Risk trace in Arnor v4 KG. GET /v3/intel/kg/supply-chain/{id}. Permission: search. hops: Maximum traversal hop depth (default 3, max 6). as_of: Optional bitemporal date (YYYY-MM-DD or RFC3339).""" return self._call("GET", f"/v3/intel/kg/supply-chain/{_seg(id)}", query={"hops": hops, "as_of": as_of}, body=None) def intel_kg_power(self, *, coalition: Any, state_usd: Any = None, as_of: Any = None) -> Any: """Coalition Power Index vs state USD benchmark in Arnor v4 KG. GET /v3/intel/kg/power. Permission: search. coalition: Comma-separated coalition entity node IDs. state_usd: Optional state or market benchmark in USD. as_of: Optional bitemporal date (YYYY-MM-DD or RFC3339).""" return self._call("GET", f"/v3/intel/kg/power", query={"coalition": coalition, "state_usd": state_usd, "as_of": as_of}, body=None) def intel_kg_bill(self, id: str, *, as_of: Any = None) -> Any: """Legislative Lineage & Bill Attribution in Arnor v4 KG. GET /v3/intel/kg/bill/{id}. Permission: search. as_of: Optional bitemporal date (YYYY-MM-DD or RFC3339).""" return self._call("GET", f"/v3/intel/kg/bill/{_seg(id)}", query={"as_of": as_of}, body=None) def list_lists(self) -> Any: """The lists of the organization. GET /v3/leads/lists. Permission: search.""" return self._call("GET", f"/v3/leads/lists", query=None, body=None) def create_list(self, *, name: Any) -> Any: """Make a list. POST /v3/leads/lists. Permission: lists.""" return self._call("POST", f"/v3/leads/lists", query=None, body=_drop_none({"name": name})) def get_list(self, id: str, *, kind: Any = None, offset: Any = None, limit: Any = None) -> Any: """One page of the companies or the people of a list (masked). GET /v3/leads/lists/{id}. Permission: search.""" return self._call("GET", f"/v3/leads/lists/{_seg(id)}", query={"kind": kind, "offset": offset, "limit": limit}, body=None) def update_list(self, id: str, *, name: Any = None, shared: Any = None) -> Any: """Rename a list; make it shared or private. PATCH /v3/leads/lists/{id}. Permission: lists.""" return self._call("PATCH", f"/v3/leads/lists/{_seg(id)}", query=None, body=_drop_none({"name": name, "shared": shared})) def delete_list(self, id: str) -> Any: """Delete a list and its rows. DELETE /v3/leads/lists/{id}. Permission: lists.""" return self._call("DELETE", f"/v3/leads/lists/{_seg(id)}", query=None, body=None) def get_list_investors(self, id: str, *, offset: Any = None, limit: Any = None) -> Any: """One page of the investor firms of a list. GET /v3/leads/lists/{id}/investors. Permission: search.""" return self._call("GET", f"/v3/leads/lists/{_seg(id)}/investors", query={"offset": offset, "limit": limit}, body=None) def add_to_list(self, id: str, *, companies: Any = None, people: Any = None, investors: Any = None) -> Any: """Add companies, people and investor firms to a list. POST /v3/leads/lists/{id}/rows. Permission: lists. people: Each item: {domain, name}.""" return self._call("POST", f"/v3/leads/lists/{_seg(id)}/rows", query=None, body=_drop_none({"companies": companies, "people": people, "investors": investors})) def remove_from_list(self, id: str, *, companies: Any = None, people: Any = None, investors: Any = None) -> Any: """Remove companies, people and investor firms from a list. POST /v3/leads/lists/{id}/rows/remove. Permission: lists. people: Each item: {domain, name}.""" return self._call("POST", f"/v3/leads/lists/{_seg(id)}/rows/remove", query=None, body=_drop_none({"companies": companies, "people": people, "investors": investors})) def list_keys(self, *, kind: Any = None) -> Any: """The keys of every list that the caller sees, in one read. GET /v3/leads/list-keys. Permission: search.""" return self._call("GET", f"/v3/leads/list-keys", query={"kind": kind}, body=None) def list_tags(self) -> Any: """The tags of the organization. GET /v3/leads/tags. Permission: search.""" return self._call("GET", f"/v3/leads/tags", query=None, body=None) def create_tag(self, *, name: Any, color: Any = None) -> Any: """Make a tag. POST /v3/leads/tags. Permission: lists. color: One of: gray, red, orange, yellow, green, teal, blue, purple, pink.""" return self._call("POST", f"/v3/leads/tags", query=None, body=_drop_none({"name": name, "color": color})) def update_tag(self, id: str, *, name: Any = None, color: Any = None) -> Any: """Rename a tag or change its color. PATCH /v3/leads/tags/{id}. Permission: lists. color: One of: gray, red, orange, yellow, green, teal, blue, purple, pink.""" return self._call("PATCH", f"/v3/leads/tags/{_seg(id)}", query=None, body=_drop_none({"name": name, "color": color})) def delete_tag(self, id: str) -> Any: """Delete a tag. DELETE /v3/leads/tags/{id}. Permission: lists.""" return self._call("DELETE", f"/v3/leads/tags/{_seg(id)}", query=None, body=None) def tag_rows(self, id: str, *, companies: Any = None, people: Any = None) -> Any: """Put a tag on companies and people. POST /v3/leads/tags/{id}/rows. Permission: lists. people: Each item: {domain, name}.""" return self._call("POST", f"/v3/leads/tags/{_seg(id)}/rows", query=None, body=_drop_none({"companies": companies, "people": people})) def untag_rows(self, id: str, *, companies: Any = None, people: Any = None) -> Any: """Take a tag off companies and people. POST /v3/leads/tags/{id}/rows/remove. Permission: lists. people: Each item: {domain, name}.""" return self._call("POST", f"/v3/leads/tags/{_seg(id)}/rows/remove", query=None, body=_drop_none({"companies": companies, "people": people})) def list_notes(self, *, domain: Any, name: Any = None) -> Any: """The notes on a company or a person. GET /v3/leads/notes. Permission: search. domain: The company: a domain, a URL or an email address name: A person of the company, by name: only the notes on that person""" return self._call("GET", f"/v3/leads/notes", query={"domain": domain, "name": name}, body=None) def create_note(self, *, domain: Any, body: Any, name: Any = None) -> Any: """Write a note on a company or a person. POST /v3/leads/notes. Permission: lists. domain: The company: a domain, a URL or an email address name: A person of the company, by name, for a note on that person body: The text of the note, 1 to 5000 characters""" return self._call("POST", f"/v3/leads/notes", query=None, body=_drop_none({"domain": domain, "name": name, "body": body})) def update_note(self, id: str, *, body: Any) -> Any: """Change the text of a note. PATCH /v3/leads/notes/{id}. Permission: lists.""" return self._call("PATCH", f"/v3/leads/notes/{_seg(id)}", query=None, body=_drop_none({"body": body})) def delete_note(self, id: str) -> Any: """Delete a note. DELETE /v3/leads/notes/{id}. Permission: lists.""" return self._call("DELETE", f"/v3/leads/notes/{_seg(id)}", query=None, body=None) def list_searches(self) -> Any: """The saved searches of the organization. GET /v3/leads/searches. Permission: search.""" return self._call("GET", f"/v3/leads/searches", query=None, body=None) def save_search(self, *, name: Any, kind: Any, query: Any) -> Any: """Save a search. POST /v3/leads/searches. Permission: lists. kind: One of: companies, people.""" return self._call("POST", f"/v3/leads/searches", query=None, body=_drop_none({"name": name, "kind": kind, "query": query})) def set_search_alert(self, id: str, *, alert: Any) -> Any: """Set the alert of a saved search: off, daily or weekly. PATCH /v3/leads/searches/{id}. Permission: lists. alert: One of: off, daily, weekly.""" return self._call("PATCH", f"/v3/leads/searches/{_seg(id)}", query=None, body=_drop_none({"alert": alert})) def delete_search(self, id: str) -> Any: """Delete a saved search. DELETE /v3/leads/searches/{id}. Permission: lists.""" return self._call("DELETE", f"/v3/leads/searches/{_seg(id)}", query=None, body=None) def new_search_results(self, id: str, *, offset: Any = None, limit: Any = None) -> Any: """The new rows that the alert of a saved search found (masked). GET /v3/leads/searches/{id}/new. Permission: search.""" return self._call("GET", f"/v3/leads/searches/{_seg(id)}/new", query={"offset": offset, "limit": limit}, body=None) def mark_search_seen(self, id: str) -> Any: """Mark the new rows of the alert of a saved search as seen. POST /v3/leads/searches/{id}/seen. Permission: lists.""" return self._call("POST", f"/v3/leads/searches/{_seg(id)}/seen", query=None, body=None) def run_search(self, id: str, *, offset: Any = None, limit: Any = None) -> Any: """Run a saved search: one page, and the count of new results. POST /v3/leads/searches/{id}/run. Permission: search.""" return self._call("POST", f"/v3/leads/searches/{_seg(id)}/run", query={"offset": offset, "limit": limit}, body=None) def delete_automation(self, id: str) -> Any: """Turn the automation of a saved search off. DELETE /v3/leads/searches/{id}/automation. Permission: lists.""" return self._call("DELETE", f"/v3/leads/searches/{_seg(id)}/automation", query=None, body=None) def automation_cost(self, id: str, *, unlock_n: Any) -> Any: """What the unlocks of an automation run cost now. GET /v3/leads/searches/{id}/automation/cost. Permission: search. unlock_n: 1 to 200""" return self._call("GET", f"/v3/leads/searches/{_seg(id)}/automation/cost", query={"unlock_n": unlock_n}, body=None) def list_profiles(self) -> Any: """The fit profiles and personas of the organization. GET /v3/leads/profiles. Permission: search.""" return self._call("GET", f"/v3/leads/profiles", query=None, body=None) def create_profile(self, *, name: Any, kind: Any, criteria: Any) -> Any: """Make a fit profile or a persona. POST /v3/leads/profiles. Permission: lists. kind: One of: companies, people. criteria: Each item: {field (industry|sector|naics|state|near|employees|has_owner|has_phone|has_email|ownership|sig|founded|grade|rating|reviews|title|level|department), mode (must|nice|exclude), weight?, values?, min?, max?, miles?}.""" return self._call("POST", f"/v3/leads/profiles", query=None, body=_drop_none({"name": name, "kind": kind, "criteria": criteria})) def update_profile(self, id: str, *, name: Any = None, criteria: Any = None) -> Any: """Change the name or the criteria of a profile. PATCH /v3/leads/profiles/{id}. Permission: lists. criteria: Each item: {field (industry|sector|naics|state|near|employees|has_owner|has_phone|has_email|ownership|sig|founded|grade|rating|reviews|title|level|department), mode (must|nice|exclude), weight?, values?, min?, max?, miles?}.""" return self._call("PATCH", f"/v3/leads/profiles/{_seg(id)}", query=None, body=_drop_none({"name": name, "criteria": criteria})) def delete_profile(self, id: str) -> Any: """Delete a fit profile or a persona. DELETE /v3/leads/profiles/{id}. Permission: lists.""" return self._call("DELETE", f"/v3/leads/profiles/{_seg(id)}", query=None, body=None) def search_by_profile(self, id: str, *, q: Any = None, state: Any = None, sector: Any = None, industry: Any = None, city: Any = None, zip: Any = None, emp_min: Any = None, emp_max: Any = None, has_phone: Any = None, has_email: Any = None, has_owner: Any = None, has_people: Any = None, registered: Any = None, licensed: Any = None, form5500: Any = None, hide_sunk: Any = None, near: Any = None, miles: Any = None, sig: Any = None, skill: Any = None, service: Any = None, founded_min: Any = None, founded_max: Any = None, naics: Any = None, sic: Any = None, site: Any = None, site_pages: Any = None, ownership: Any = None, revenue: Any = None, metro: Any = None, language: Any = None, has_postings: Any = None, posting_title: Any = None, posted_within: Any = None, changed: Any = None, changed_within: Any = None, bbox: Any = None, funding_min: Any = None, funded_since: Any = None, parent: Any = None, independent: Any = None, succession_min: Any = None, tech: Any = None, model: Any = None, niche: Any = None, has_mobile: Any = None, landline_only: Any = None, has_direct_dial: Any = None, activity: Any = None, activity_min: Any = None, activity_within: Any = None, tag: Any = None, include_domains: Any = None, exclude_domains: Any = None, include_list: Any = None, exclude_list: Any = None, sort: Any = None, offset: Any = None, limit: Any = None, name: Any = None, title: Any = None, company: Any = None, role: Any = None, level: Any = None, department: Any = None, domain: Any = None, edu: Any = None, exp_min: Any = None, score_min: Any = None, order: Any = None) -> Any: """A search scored by a fit profile or a persona (masked rows). GET /v3/leads/profiles/{id}/search. Permission: search.""" return self._call("GET", f"/v3/leads/profiles/{_seg(id)}/search", query={"q": q, "state": state, "sector": sector, "industry": industry, "city": city, "zip": zip, "emp_min": emp_min, "emp_max": emp_max, "has_phone": has_phone, "has_email": has_email, "has_owner": has_owner, "has_people": has_people, "registered": registered, "licensed": licensed, "form5500": form5500, "hide_sunk": hide_sunk, "near": near, "miles": miles, "sig": sig, "skill": skill, "service": service, "founded_min": founded_min, "founded_max": founded_max, "naics": naics, "sic": sic, "site": site, "site_pages": site_pages, "ownership": ownership, "revenue": revenue, "metro": metro, "language": language, "has_postings": has_postings, "posting_title": posting_title, "posted_within": posted_within, "changed": changed, "changed_within": changed_within, "bbox": bbox, "funding_min": funding_min, "funded_since": funded_since, "parent": parent, "independent": independent, "succession_min": succession_min, "tech": tech, "model": model, "niche": niche, "has_mobile": has_mobile, "landline_only": landline_only, "has_direct_dial": has_direct_dial, "activity": activity, "activity_min": activity_min, "activity_within": activity_within, "tag": tag, "include_domains": include_domains, "exclude_domains": exclude_domains, "include_list": include_list, "exclude_list": exclude_list, "sort": sort, "offset": offset, "limit": limit, "name": name, "title": title, "company": company, "role": role, "level": level, "department": department, "domain": domain, "edu": edu, "exp_min": exp_min, "score_min": score_min, "order": order}, body=None) def export_count(self, *, list: Any = None, kind: Any = None, cursor: Any = None, q: Any = None, state: Any = None, sector: Any = None, industry: Any = None, city: Any = None, zip: Any = None, emp_min: Any = None, emp_max: Any = None, has_phone: Any = None, has_email: Any = None, has_owner: Any = None, has_people: Any = None, registered: Any = None, licensed: Any = None, form5500: Any = None, hide_sunk: Any = None, near: Any = None, miles: Any = None, sig: Any = None, skill: Any = None, service: Any = None, founded_min: Any = None, founded_max: Any = None, naics: Any = None, sic: Any = None, site: Any = None, site_pages: Any = None, ownership: Any = None, revenue: Any = None, metro: Any = None, language: Any = None, has_postings: Any = None, posting_title: Any = None, posted_within: Any = None, changed: Any = None, changed_within: Any = None, bbox: Any = None, funding_min: Any = None, funded_since: Any = None, parent: Any = None, independent: Any = None, succession_min: Any = None, tech: Any = None, model: Any = None, niche: Any = None, has_mobile: Any = None, landline_only: Any = None, has_direct_dial: Any = None, activity: Any = None, activity_min: Any = None, activity_within: Any = None, tag: Any = None, include_domains: Any = None, exclude_domains: Any = None, include_list: Any = None, exclude_list: Any = None, sort: Any = None, name: Any = None, title: Any = None, company: Any = None, role: Any = None, level: Any = None, department: Any = None, domain: Any = None, edu: Any = None, exp_min: Any = None) -> Any: """Dry run of a CSV export: the row counts and the unlock cost. GET /v3/leads/export/count. Permission: search. list: The id of a list: export the rows of the list in place of a search. kind: `companies` (the default) or `people`. With `people`, the filters are those of GET /v3/leads/people. cursor: The row to start from: the X-Leads-Next-Cursor (or `next_cursor`) of the call before. Default 0. q: Words in the company name, site text or industry. Several values: a|b. Exact: =value. Not: !value. state: US states as 2-letter codes, separated by commas. `!ID` leaves a state out. sector: One sector of the Dealright taxonomy, as GET /v3/leads/facets lists it. industry: Industry name. Several values: a|b. Exact: =value. Not: !value. city: City name. Several values: a|b. Exact: =value. Not: !value. zip: ZIP code. emp_min: Fewest employees, a whole number. emp_max: Most employees, a whole number. has_phone: Only companies with a phone. Give 1 to turn it on; any other value is ignored. has_email: Only companies with an email. Give 1 to turn it on; any other value is ignored. has_owner: Only companies with a named owner. Give 1 to turn it on; any other value is ignored. has_people: Only companies with named people. Give 1 to turn it on; any other value is ignored. registered: Only companies matched to a state business registry record. Give 1 to turn it on; any other value is ignored. licensed: Only companies matched to a licence record. Give 1 to turn it on; any other value is ignored. form5500: Only companies with a Form 5500 benefit plan filing. Give 1 to turn it on; any other value is ignored. hide_sunk: Leave out network, toll-free-only, template and chain sites. Give 1 to turn it on; any other value is ignored. near: Centre of a radius search: a 5-digit ZIP code or a city as `City, ST`. miles: Radius in miles around `near`, 1 to 250. sig: Signals that the company site shows, separated by commas. skill: A service or skill that the company site names. Several values: a|b. Exact: =value. Not: !value. service: Services, keywords or credentials of the company site, each equal to one whole tag (case does not matter): `wills` does not match `wills and trusts`. Several: a|b (up to 20). Not: !value. founded_min: Earliest founding year, 4 digits. founded_max: Latest founding year, 4 digits. naics: NAICS codes of 2 to 6 digits; each is a prefix match (`5413` matches `541310`). Several: a|b. Not: !code. sic: SIC 1987 codes of 2 to 4 digits; each is a prefix match (`87` matches `8711`). Exact: =code (4 digits). Several: a|b. Not: !code. A SIC code is a crosswalk mapping of the company's 6-digit NAICS 2022 code (Census concordances), never a reported code: the search keeps the companies whose NAICS code maps to it. A company with no 6-digit NAICS code has no SIC code. site: Words and phrases in the text of the company's own site (homepage, key pages and crawl pages). Words in one value are all required; "quotes" make a phrase; several values: a|b; !value leaves out the companies that match it. Each word matches by its stem: plumber matches plumbers. site_pages: The pages that `site` searches: `all` (the default) the homepage, the key pages and up to 20 crawl pages of the site (50,000 characters at most); `home` the homepage only. ownership: Ownership classes: family, owner_operated, franchise, multi_location, group, parent, employee_owned, nonprofit. Several: a|b. Not: !class. revenue: Estimated revenue bands: lt500k, 500k_1m, 1m_2.5m, 2.5m_5m, 5m_10m, 10m_25m, 25m_plus. An estimate from employees and industry averages (Census SUSB 2022), never a reported figure. Several: a|b. Not: !band. metro: Metro areas (Census Core Based Statistical Areas, OMB July 2023): a 5-digit CBSA code (14260) or a CBSA title (Boise City, ID; case does not matter), from the company's ZIP code. Several: a|b. Not: !value. A company with no ZIP code, or a ZIP code in no CBSA, has no metro area and matches no value; Not keeps it. language: Website languages as ISO 639-1 codes (en, es, de): the language that the homepage declares (html lang), else the language that its text reads as. Several: a|b. Not: !code. A company whose language is unknown matches no code; Not keeps it. has_postings: 1: only companies with a job posting on the pages of their site that Dealright stored (schema.org JobPosting data, or a careers page of one job). A company with no posting found is unknown, not one that does not hire. posting_title: Words of a job title (2 to 120 characters): only companies with a posting whose title has every word, for example `technician` or `dental assistant`. posted_within: Days, 1 to 365: only companies with a posting dated in the last N days (its datePosted, or the date of the page). A posting with no date never matches. With posting_title, the same posting must match both. changed: Business events: only companies with an event of one of these types in the last `changed_within` months. Types: owner_changed, person_added, person_removed, location_added, phone_changed, service_added, ownership_changed, site_alive, job_change (a person who joined the company from another site), site_dead and site_parked (a site that is a company again only matches these after it came back). Several: a|b. History starts at 2026-10: the first events are those of 2026-11. changed_within: The months of the `changed` filter, 1 to 12, counted back from the month of the index. Default 3. bbox: Map area: west,south,east,north in decimal degrees. Only companies whose point (site point, else ZIP centroid) is in the area. With bbox, limit may be up to 2000. funding_min: SEC Form D: the least total amount sold, in whole US dollars (up to 12 digits). Only companies with a joined Form D filing match. funded_since: SEC Form D: the earliest newest date of first sale, as YYYY-MM-DD, YYYY-MM or YYYY. Only companies with a joined Form D filing match. parent: A domain: only the sites of the group whose parent site it is (schema 8). The company page names the parent of a company in `group.parent`. independent: Only companies with a family or owner-operated class and no sign of a group, of several locations, of a franchise or of a parent (schema 8). Give 1 to turn it on; any other value is ignored. succession_min: The least succession signal, 0 to 100 (schema 8). Refused with a `note` until the signal is turned on: it is a heuristic, not yet measured against real sales. tech: Products that the company homepage loads, by name (Shopify, Google Analytics, HubSpot); a bare value is a prefix. Several values: a|b. Exact: =value. Not: !value. model: Business model: b2b, b2c, both. Several: a|b. Not: !model. niche: Niche of the industry label, for example Criminal defense. Several values: a|b. Exact: =value. Not: !value. has_mobile: Only rows with a business phone whose number block is wireless (an estimate: a ported number keeps its block). For people, a phone of the company. Give 1 to turn it on; any other value is ignored. landline_only: Only rows whose every business phone is in a landline block (an unknown phone fails it). For people, the phones of the company. Give 1 to turn it on; any other value is ignored. has_direct_dial: Only rows with a person-level number that is not the main company number. The index has no person-level numbers yet, so it answers no rows and a note. Give 1 to turn it on; any other value is ignored. activity: Activity signal kinds: hiring, funding, new_location, site_change, news. Several: a|b (a company with a signal of one of them in the window). Signals of the company's own site and of public records, not third-party intent data. activity_min: The least Activity signals score, 1 to 100: hiring 25, funding (SEC Form D) 30, new location 20, other site change 15, news 10; each kind counts one time. activity_within: The window of the activity filters and of each row's `activity_signals`, in days back from today: 1 to 365. Default 90. tag: Tags of the organization, by name (any case) or id. Several: a|b (a row with one of them). Exact name: =Name. Not: !name. With only tags to include and no other filter, the answer is the tagged rows, in key order. With other filters, the tags filter the rows of each page of the search, so a page can have fewer rows than `limit`, and `note` says so. include_domains: A list of domains: only these companies. Each entry is a domain, a URL or an email address; commas, spaces, semicolons or line ends separate entries, and an entry that is not a domain is left out. The two lists hold 500 domains at most together. A list with no domain is refused. The other filters apply too. exclude_domains: A list of domains to leave out, written as `include_domains` (for example the companies that you already work with). include_list: The `id` of a saved list (GET /v3/leads/lists): only the companies of that list, read by the API (no cap of 500). The companies of a list are its companies and the companies of its people. A list that you do not see answers 404; a list with no company answers no rows and a `note`. exclude_list: The `id` of a saved list: leave out the companies of that list (for example the companies that you already work with). sort: `name` or `employees`. Any other value, or none, is the default rank. name: Name of the person. Several values: a|b. Exact: =value. Not: !value. title: Job title. Several values: a|b. Exact: =value. Not: !value. company: Company name. Several values: a|b. Exact: =value. Not: !value. role: Role groups of the people: technical (IT, technical staff, systems and network administrators, developers, data people, IT managers, the CTO, the CIO, the VP or head of technology) or executive (the C-suite: a chief officer, the president, the founder, the owner), or the two (technical,executive). From the title words and the department; one tested rule set. A person with no title in a group is left out: unknown, not a negative. Each person row has role_groups. level: Seniority levels, separated by commas. department: Departments, separated by commas. domain: Only the people of the company with this domain. edu: Schools or degrees that the company site names, separated by commas. exp_min: Years, 1 to 60: only people whose bio on the company site states at least this many years of experience ("15 years of experience", "practicing since 2001"). A person whose site states none is unknown and never matches (schema 15).""" return self._call("GET", f"/v3/leads/export/count", query={"list": list, "kind": kind, "cursor": cursor, "q": q, "state": state, "sector": sector, "industry": industry, "city": city, "zip": zip, "emp_min": emp_min, "emp_max": emp_max, "has_phone": has_phone, "has_email": has_email, "has_owner": has_owner, "has_people": has_people, "registered": registered, "licensed": licensed, "form5500": form5500, "hide_sunk": hide_sunk, "near": near, "miles": miles, "sig": sig, "skill": skill, "service": service, "founded_min": founded_min, "founded_max": founded_max, "naics": naics, "sic": sic, "site": site, "site_pages": site_pages, "ownership": ownership, "revenue": revenue, "metro": metro, "language": language, "has_postings": has_postings, "posting_title": posting_title, "posted_within": posted_within, "changed": changed, "changed_within": changed_within, "bbox": bbox, "funding_min": funding_min, "funded_since": funded_since, "parent": parent, "independent": independent, "succession_min": succession_min, "tech": tech, "model": model, "niche": niche, "has_mobile": has_mobile, "landline_only": landline_only, "has_direct_dial": has_direct_dial, "activity": activity, "activity_min": activity_min, "activity_within": activity_within, "tag": tag, "include_domains": include_domains, "exclude_domains": exclude_domains, "include_list": include_list, "exclude_list": exclude_list, "sort": sort, "name": name, "title": title, "company": company, "role": role, "level": level, "department": department, "domain": domain, "edu": edu, "exp_min": exp_min}, body=None) def export_count_selection(self, *, domains: Any = None, people: Any = None, cursor: Any = None) -> Any: """Dry run of a CSV export of a selection of companies or people. POST /v3/leads/export/count. Permission: search. domains: The companies: a domain, a URL or an email address of each. Give `domains` or `people`. people: The people: the company domain and the name of each, as in a person row of the search or of a list. Give `domains` or `people`. Each item: {domain, name}.""" return self._call("POST", f"/v3/leads/export/count", query=None, body=_drop_none({"domains": domains, "people": people, "cursor": cursor})) def export_csv(self, *, list: Any = None, kind: Any = None, unlock: Any = None, cursor: Any = None, q: Any = None, state: Any = None, sector: Any = None, industry: Any = None, city: Any = None, zip: Any = None, emp_min: Any = None, emp_max: Any = None, has_phone: Any = None, has_email: Any = None, has_owner: Any = None, has_people: Any = None, registered: Any = None, licensed: Any = None, form5500: Any = None, hide_sunk: Any = None, near: Any = None, miles: Any = None, sig: Any = None, skill: Any = None, service: Any = None, founded_min: Any = None, founded_max: Any = None, naics: Any = None, sic: Any = None, site: Any = None, site_pages: Any = None, ownership: Any = None, revenue: Any = None, metro: Any = None, language: Any = None, has_postings: Any = None, posting_title: Any = None, posted_within: Any = None, changed: Any = None, changed_within: Any = None, bbox: Any = None, funding_min: Any = None, funded_since: Any = None, parent: Any = None, independent: Any = None, succession_min: Any = None, tech: Any = None, model: Any = None, niche: Any = None, has_mobile: Any = None, landline_only: Any = None, has_direct_dial: Any = None, activity: Any = None, activity_min: Any = None, activity_within: Any = None, tag: Any = None, include_domains: Any = None, exclude_domains: Any = None, include_list: Any = None, exclude_list: Any = None, sort: Any = None, name: Any = None, title: Any = None, company: Any = None, role: Any = None, level: Any = None, department: Any = None, domain: Any = None, edu: Any = None, exp_min: Any = None, format: Any = None) -> CsvAnswer: """CSV export of a search or a list; unlock=true opens the rows first. GET /v3/leads/export.csv. Permission: search; unlock when unlock is on. list: The id of a list: export the rows of the list in place of a search. kind: `companies` (the default) or `people`. With `people`, the filters are those of GET /v3/leads/people. unlock: `true` first opens each company of this call that has a contact value, at the unlock price. Companies only. cursor: The row to start from: the X-Leads-Next-Cursor (or `next_cursor`) of the call before. Default 0. q: Words in the company name, site text or industry. Several values: a|b. Exact: =value. Not: !value. state: US states as 2-letter codes, separated by commas. `!ID` leaves a state out. sector: One sector of the Dealright taxonomy, as GET /v3/leads/facets lists it. industry: Industry name. Several values: a|b. Exact: =value. Not: !value. city: City name. Several values: a|b. Exact: =value. Not: !value. zip: ZIP code. emp_min: Fewest employees, a whole number. emp_max: Most employees, a whole number. has_phone: Only companies with a phone. Give 1 to turn it on; any other value is ignored. has_email: Only companies with an email. Give 1 to turn it on; any other value is ignored. has_owner: Only companies with a named owner. Give 1 to turn it on; any other value is ignored. has_people: Only companies with named people. Give 1 to turn it on; any other value is ignored. registered: Only companies matched to a state business registry record. Give 1 to turn it on; any other value is ignored. licensed: Only companies matched to a licence record. Give 1 to turn it on; any other value is ignored. form5500: Only companies with a Form 5500 benefit plan filing. Give 1 to turn it on; any other value is ignored. hide_sunk: Leave out network, toll-free-only, template and chain sites. Give 1 to turn it on; any other value is ignored. near: Centre of a radius search: a 5-digit ZIP code or a city as `City, ST`. miles: Radius in miles around `near`, 1 to 250. sig: Signals that the company site shows, separated by commas. skill: A service or skill that the company site names. Several values: a|b. Exact: =value. Not: !value. service: Services, keywords or credentials of the company site, each equal to one whole tag (case does not matter): `wills` does not match `wills and trusts`. Several: a|b (up to 20). Not: !value. founded_min: Earliest founding year, 4 digits. founded_max: Latest founding year, 4 digits. naics: NAICS codes of 2 to 6 digits; each is a prefix match (`5413` matches `541310`). Several: a|b. Not: !code. sic: SIC 1987 codes of 2 to 4 digits; each is a prefix match (`87` matches `8711`). Exact: =code (4 digits). Several: a|b. Not: !code. A SIC code is a crosswalk mapping of the company's 6-digit NAICS 2022 code (Census concordances), never a reported code: the search keeps the companies whose NAICS code maps to it. A company with no 6-digit NAICS code has no SIC code. site: Words and phrases in the text of the company's own site (homepage, key pages and crawl pages). Words in one value are all required; "quotes" make a phrase; several values: a|b; !value leaves out the companies that match it. Each word matches by its stem: plumber matches plumbers. site_pages: The pages that `site` searches: `all` (the default) the homepage, the key pages and up to 20 crawl pages of the site (50,000 characters at most); `home` the homepage only. ownership: Ownership classes: family, owner_operated, franchise, multi_location, group, parent, employee_owned, nonprofit. Several: a|b. Not: !class. revenue: Estimated revenue bands: lt500k, 500k_1m, 1m_2.5m, 2.5m_5m, 5m_10m, 10m_25m, 25m_plus. An estimate from employees and industry averages (Census SUSB 2022), never a reported figure. Several: a|b. Not: !band. metro: Metro areas (Census Core Based Statistical Areas, OMB July 2023): a 5-digit CBSA code (14260) or a CBSA title (Boise City, ID; case does not matter), from the company's ZIP code. Several: a|b. Not: !value. A company with no ZIP code, or a ZIP code in no CBSA, has no metro area and matches no value; Not keeps it. language: Website languages as ISO 639-1 codes (en, es, de): the language that the homepage declares (html lang), else the language that its text reads as. Several: a|b. Not: !code. A company whose language is unknown matches no code; Not keeps it. has_postings: 1: only companies with a job posting on the pages of their site that Dealright stored (schema.org JobPosting data, or a careers page of one job). A company with no posting found is unknown, not one that does not hire. posting_title: Words of a job title (2 to 120 characters): only companies with a posting whose title has every word, for example `technician` or `dental assistant`. posted_within: Days, 1 to 365: only companies with a posting dated in the last N days (its datePosted, or the date of the page). A posting with no date never matches. With posting_title, the same posting must match both. changed: Business events: only companies with an event of one of these types in the last `changed_within` months. Types: owner_changed, person_added, person_removed, location_added, phone_changed, service_added, ownership_changed, site_alive, job_change (a person who joined the company from another site), site_dead and site_parked (a site that is a company again only matches these after it came back). Several: a|b. History starts at 2026-10: the first events are those of 2026-11. changed_within: The months of the `changed` filter, 1 to 12, counted back from the month of the index. Default 3. bbox: Map area: west,south,east,north in decimal degrees. Only companies whose point (site point, else ZIP centroid) is in the area. With bbox, limit may be up to 2000. funding_min: SEC Form D: the least total amount sold, in whole US dollars (up to 12 digits). Only companies with a joined Form D filing match. funded_since: SEC Form D: the earliest newest date of first sale, as YYYY-MM-DD, YYYY-MM or YYYY. Only companies with a joined Form D filing match. parent: A domain: only the sites of the group whose parent site it is (schema 8). The company page names the parent of a company in `group.parent`. independent: Only companies with a family or owner-operated class and no sign of a group, of several locations, of a franchise or of a parent (schema 8). Give 1 to turn it on; any other value is ignored. succession_min: The least succession signal, 0 to 100 (schema 8). Refused with a `note` until the signal is turned on: it is a heuristic, not yet measured against real sales. tech: Products that the company homepage loads, by name (Shopify, Google Analytics, HubSpot); a bare value is a prefix. Several values: a|b. Exact: =value. Not: !value. model: Business model: b2b, b2c, both. Several: a|b. Not: !model. niche: Niche of the industry label, for example Criminal defense. Several values: a|b. Exact: =value. Not: !value. has_mobile: Only rows with a business phone whose number block is wireless (an estimate: a ported number keeps its block). For people, a phone of the company. Give 1 to turn it on; any other value is ignored. landline_only: Only rows whose every business phone is in a landline block (an unknown phone fails it). For people, the phones of the company. Give 1 to turn it on; any other value is ignored. has_direct_dial: Only rows with a person-level number that is not the main company number. The index has no person-level numbers yet, so it answers no rows and a note. Give 1 to turn it on; any other value is ignored. activity: Activity signal kinds: hiring, funding, new_location, site_change, news. Several: a|b (a company with a signal of one of them in the window). Signals of the company's own site and of public records, not third-party intent data. activity_min: The least Activity signals score, 1 to 100: hiring 25, funding (SEC Form D) 30, new location 20, other site change 15, news 10; each kind counts one time. activity_within: The window of the activity filters and of each row's `activity_signals`, in days back from today: 1 to 365. Default 90. tag: Tags of the organization, by name (any case) or id. Several: a|b (a row with one of them). Exact name: =Name. Not: !name. With only tags to include and no other filter, the answer is the tagged rows, in key order. With other filters, the tags filter the rows of each page of the search, so a page can have fewer rows than `limit`, and `note` says so. include_domains: A list of domains: only these companies. Each entry is a domain, a URL or an email address; commas, spaces, semicolons or line ends separate entries, and an entry that is not a domain is left out. The two lists hold 500 domains at most together. A list with no domain is refused. The other filters apply too. exclude_domains: A list of domains to leave out, written as `include_domains` (for example the companies that you already work with). include_list: The `id` of a saved list (GET /v3/leads/lists): only the companies of that list, read by the API (no cap of 500). The companies of a list are its companies and the companies of its people. A list that you do not see answers 404; a list with no company answers no rows and a `note`. exclude_list: The `id` of a saved list: leave out the companies of that list (for example the companies that you already work with). sort: `name` or `employees`. Any other value, or none, is the default rank. name: Name of the person. Several values: a|b. Exact: =value. Not: !value. title: Job title. Several values: a|b. Exact: =value. Not: !value. company: Company name. Several values: a|b. Exact: =value. Not: !value. role: Role groups of the people: technical (IT, technical staff, systems and network administrators, developers, data people, IT managers, the CTO, the CIO, the VP or head of technology) or executive (the C-suite: a chief officer, the president, the founder, the owner), or the two (technical,executive). From the title words and the department; one tested rule set. A person with no title in a group is left out: unknown, not a negative. Each person row has role_groups. level: Seniority levels, separated by commas. department: Departments, separated by commas. domain: Only the people of the company with this domain. edu: Schools or degrees that the company site names, separated by commas. exp_min: Years, 1 to 60: only people whose bio on the company site states at least this many years of experience ("15 years of experience", "practicing since 2001"). A person whose site states none is unknown and never matches (schema 15). format: The CSV layout: the Dealright columns (the default) or the import columns of a CRM.""" return self._call("GET", f"/v3/leads/export.csv", query={"list": list, "kind": kind, "unlock": unlock, "cursor": cursor, "q": q, "state": state, "sector": sector, "industry": industry, "city": city, "zip": zip, "emp_min": emp_min, "emp_max": emp_max, "has_phone": has_phone, "has_email": has_email, "has_owner": has_owner, "has_people": has_people, "registered": registered, "licensed": licensed, "form5500": form5500, "hide_sunk": hide_sunk, "near": near, "miles": miles, "sig": sig, "skill": skill, "service": service, "founded_min": founded_min, "founded_max": founded_max, "naics": naics, "sic": sic, "site": site, "site_pages": site_pages, "ownership": ownership, "revenue": revenue, "metro": metro, "language": language, "has_postings": has_postings, "posting_title": posting_title, "posted_within": posted_within, "changed": changed, "changed_within": changed_within, "bbox": bbox, "funding_min": funding_min, "funded_since": funded_since, "parent": parent, "independent": independent, "succession_min": succession_min, "tech": tech, "model": model, "niche": niche, "has_mobile": has_mobile, "landline_only": landline_only, "has_direct_dial": has_direct_dial, "activity": activity, "activity_min": activity_min, "activity_within": activity_within, "tag": tag, "include_domains": include_domains, "exclude_domains": exclude_domains, "include_list": include_list, "exclude_list": exclude_list, "sort": sort, "name": name, "title": title, "company": company, "role": role, "level": level, "department": department, "domain": domain, "edu": edu, "exp_min": exp_min, "format": format}, body=None, csv=True) def export_csv_selection(self, *, domains: Any = None, people: Any = None, cursor: Any = None, unlock: Any = None, format: Any = None) -> CsvAnswer: """CSV export of a selection of companies or people; unlock opens companies first. POST /v3/leads/export.csv. Permission: search; unlock when unlock is on. domains: The companies: a domain, a URL or an email address of each. Give `domains` or `people`. people: The people: the company domain and the name of each, as in a person row of the search or of a list. Give `domains` or `people`. Each item: {domain, name}. format: One of: default, hubspot, salesforce, pipedrive, zoho.""" return self._call("POST", f"/v3/leads/export.csv", query=None, body=_drop_none({"domains": domains, "people": people, "cursor": cursor, "unlock": unlock, "format": format}), csv=True) def automation_file(self, id: str) -> CsvAnswer: """The last export file of the automation of a saved search. GET /v3/leads/searches/{id}/automation/export.csv. Permission: search.""" return self._call("GET", f"/v3/leads/searches/{_seg(id)}/automation/export.csv", query=None, body=None, csv=True) def billing(self) -> Any: """The plan, the subscription state and the use of this month. GET /v3/leads/billing. Permission: account.""" return self._call("GET", f"/v3/leads/billing", query=None, body=None) def usage(self, *, month: Any = None) -> Any: """The leads, reveals and cents of a month. GET /v3/leads/usage. Permission: account.""" return self._call("GET", f"/v3/leads/usage", query={"month": month}, body=None) def usage_csv(self, *, month: Any = None) -> CsvAnswer: """The leads opened and the reveals of a month as CSV. GET /v3/leads/usage.csv. Permission: account.""" return self._call("GET", f"/v3/leads/usage.csv", query={"month": month}, body=None, csv=True) def settings(self) -> Any: """The contact, privacy and limit settings of the organization. GET /v3/leads/settings. Permission: account.""" return self._call("GET", f"/v3/leads/settings", query=None, body=None)