From 08e2491d63f9d861a1c570fae4b3aae1f540e5c0 Mon Sep 17 00:00:00 2001 From: Arslan Date: Wed, 25 Nov 2026 19:35:39 +0500 Subject: [PATCH] 0.3.0: include_company and include_emails on people search --- CHANGELOG.md | 12 ++++++++++++ README.md | 7 +++++-- examples/search.py | 1 + src/leadsets/_version.py | 2 +- src/leadsets/resources/people.py | 6 ++++-- src/leadsets/types.py | 7 +++++++ tests/test_client.py | 11 +++++++++++ 7 files changed, 41 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2af6d03..42f30de 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,18 @@ All notable changes to this package are documented here. The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and the project uses [Semantic Versioning](https://semver.org/). +## [0.3.0] - 2026-11-25 + +### Added + +- `people.search`: `include_company` (default True) and `include_emails` (default False, on with `has_verified_email`). + +### Changed + +- The API counts each person as one search record and their company as another, and each work email + as one enrichment record. Pass `include_company=False` for people only. +- Search results no longer carry work emails unless you ask for them with `include_emails=True`. + ## [0.2.0] - 2026-11-19 ### Added diff --git a/README.md b/README.md index ec8434a..38f9618 100644 --- a/README.md +++ b/README.md @@ -87,7 +87,7 @@ Keep the key out of source control. A free key is available at [leadsets.ai/sign | Method | Endpoint | Uses | | --- | --- | --- | -| `ls.people.search(**params)` | `POST /v1/people/search` | 1 search record per record returned | +| `ls.people.search(**params)` | `POST /v1/people/search` | 1 search record per person, 1 per company, 1 enrichment record per email | | `ls.people.enrich(**params)` | `POST /v1/people/enrich` | 1 enrichment record when found (+1 for a personal email) | | `ls.companies.search(**params)` | `POST /v1/companies/search` | 1 search record per record returned | | `ls.companies.enrich(**params)` | `POST /v1/companies/enrich` | 1 enrichment record when found | @@ -103,7 +103,9 @@ Responses are dataclasses: `res.items[0].email.status`. `obj.to_dict()` returns ### People search -Filters: `title` (add `match_headline=True` to also match the LinkedIn headline), `seniority` (`c_level`, `vp`, `head`, `director`, `manager`, `ic`), `function` (`revenue`, `marketing`, `engineering`, `product`, `ops`, `finance`, `hr`), `company_domain`, `company_keywords` / `exclude_company_keywords` (what their company does), `employees` (`"50-200"`, `"1000+"`, `"<50"`), `industry` (slugs such as `"saas"`), `country` (ISO 3166-1 alpha-2), `has_verified_email`, `max_age_days`, `exclude_stale`, `limit` (1–100, default 25) and `cursor`. A string or a list works wherever a list is accepted. +Filters: `title` (add `match_headline=True` to also match the LinkedIn headline), `seniority` (`c_level`, `vp`, `head`, `director`, `manager`, `ic`), `function` (`revenue`, `marketing`, `engineering`, `product`, `ops`, `finance`, `hr`), `company_domain`, `company_keywords` / `exclude_company_keywords` (what their company does), `employees` (`"50-200"`, `"1000+"`, `"<50"`), `industry` (slugs such as `"saas"`), `country` (ISO 3166-1 alpha-2), `has_verified_email`, `include_company`, `include_emails`, `max_age_days`, `exclude_stale`, `limit` (1–100, default 25) and `cursor`. A string or a list works wherever a list is accepted. + +Each person is one search record and their company another: pass `include_company=False` for people only. Work emails come with `include_emails=True` (or `has_verified_email`) and use 1 enrichment record each. Count before you pull, for free, and find the best contacts at one company in your order of preference: @@ -113,6 +115,7 @@ n = ls.companies.count(keywords=["clay", "gtm engineering"], exclude_keywords=[" res = ls.people.search( company_domain="northwind.io", priorities=[{"title": ["founder", "ceo"], "match_headline": True}, {"title": ["head of growth", "vp sales"]}], + include_emails=True, limit=3, ) for p in res.items: diff --git a/examples/search.py b/examples/search.py index 0fa4e78..90d8769 100644 --- a/examples/search.py +++ b/examples/search.py @@ -15,6 +15,7 @@ employees="20-200", country="US", industry="saas", + include_emails=True, # 1 enrichment record per email limit=10, ) diff --git a/src/leadsets/_version.py b/src/leadsets/_version.py index d3ec452..493f741 100644 --- a/src/leadsets/_version.py +++ b/src/leadsets/_version.py @@ -1 +1 @@ -__version__ = "0.2.0" +__version__ = "0.3.0" diff --git a/src/leadsets/resources/people.py b/src/leadsets/resources/people.py index ae19254..11bf334 100644 --- a/src/leadsets/resources/people.py +++ b/src/leadsets/resources/people.py @@ -34,7 +34,8 @@ def search( extra_headers: Mapping[str, str] | None = None, **params: Unpack[PeopleSearchParams], ) -> PeopleSearchResponse: - """POST /v1/people/search. 1 search record per record returned; empty results use none.""" + """POST /v1/people/search. 1 search record per person and 1 for their company, 1 enrichment + record per work email (``include_emails``); empty results use none.""" return self._client.request( "POST", "/people/search", @@ -159,7 +160,8 @@ async def search( extra_headers: Mapping[str, str] | None = None, **params: Unpack[PeopleSearchParams], ) -> PeopleSearchResponse: - """POST /v1/people/search. 1 search record per record returned; empty results use none.""" + """POST /v1/people/search. 1 search record per person and 1 for their company, 1 enrichment + record per work email (``include_emails``); empty results use none.""" return await self._client.request( "POST", "/people/search", diff --git a/src/leadsets/types.py b/src/leadsets/types.py index 1e60f3b..389b547 100644 --- a/src/leadsets/types.py +++ b/src/leadsets/types.py @@ -112,6 +112,11 @@ class PeopleSearchParams(TypedDict, total=False): #: ISO 3166-1 alpha-2 country codes, e.g. "US". country: _StrList has_verified_email: bool + #: Company details on each person (default True): one more search record per person. + include_company: bool + #: The work email on each person when one is found (default False, on with + #: ``has_verified_email``): 1 enrichment record each. + include_emails: bool max_age_days: int exclude_stale: bool #: 1–100. Default 25. Free plan: at most 10. @@ -295,7 +300,9 @@ class Person(Model): function_detail: str | None = None linkedin_url: str | None = None location: Location = dataclasses.field(default_factory=Location) + #: None when left out with ``include_company=False``. company: PersonCompany | None = None + #: On ``people.search``, set only with ``include_emails`` or ``has_verified_email``. email: Email | None = None #: Present on ``people.enrich`` with ``include_personal_email``. personal_email: Email | None = None diff --git a/tests/test_client.py b/tests/test_client.py index f9fe60f..05178a7 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -396,6 +396,17 @@ def test_count_sends_count_only(self, ls: Leadsets, mock: respx.MockRouter) -> N assert isinstance(sent, dict) assert sent["count_only"] is True + def test_include_options(self, ls: Leadsets, mock: respx.MockRouter) -> None: + bare = {k: v for k, v in person().items() if k not in ("company", "email")} + route = mock.post("/v1/people/search").respond( + json={"items": [bare], "next_cursor": None, "usage": {"enrich_records_counted": 0}, "request_id": "r"} + ) + res = ls.people.search(include_company=False, include_emails=True) + assert body(route) == {"include_company": False, "include_emails": True} + assert res.items[0].company is None + assert res.items[0].email is None + assert res.usage.enrich_records_counted == 0 + def test_priorities_and_new_fields(self, ls: Leadsets, mock: respx.MockRouter) -> None: route = mock.post("/v1/people/search").respond( json={