Skip to content

Search and count

POST /v1/count says how many records of a data product match a filter, with optional facets (the most common values of a field, with their counts).

{ "entity": "person", "product": "fl-restaurant-owners",
"filter": { "all": [ { "field": "job.role.rank", "gte": 90 }, { "field": "has_mobile", "eq": true } ] },
"facets": ["location.place"] }

The answer has data.count and data.facets (each bucket has code, label and count).

python/count.py
"""Count the records a filter selects: POST /v1/count (free).
Not live yet: count needs the search engine and answers 503 `unavailable` today.
"""
import json
import os
import urllib.request
BASE = os.environ.get("ZEMO_API_BASE", "https://api.zemodata.com")
body = {
"entity": "person",
"product": os.environ.get("ZEMO_PRODUCT", "demo-people"),
"filter": {"all": [{"field": "has_work_email", "eq": True}]},
}
request = urllib.request.Request(
f"{BASE}/v1/count",
data=json.dumps(body).encode(),
headers={"Authorization": f"Bearer {os.environ['ZEMO_API_KEY']}", "Content-Type": "application/json"},
method="POST",
)
with urllib.request.urlopen(request, timeout=30) as response:
print(json.load(response)["data"]["count"], "records")

POST /v1/person/search and POST /v1/company/search return pages of matching records with contact values hidden: you see names, jobs, employers, places and has_* flags (for example has_mobile), and owned_bundles for records you already own. Then unlock the IDs you want.

  • size: up to 100 per page; sort: sortable fields (the order always ends with id).
  • next_cursor gets the next page (see Pagination); a cursor lasts 10 minutes and only works for the same query and key.
  • exclude_owned: true skips records you already own.
  • Paging stops at your plan’s depth (10,000 by default): beyond it the answer is 422 search.depth_exceeded. Use a bulk job to take everything a filter selects.
  • GET /v1/autocomplete?field=company.name&q=bri&product=… suggests values of a text field.
  • GET /v1/products lists your products with a record count (see Data products).
  • GET /v1/fields, GET /v1/taxonomy/categories, GET /v1/taxonomy/roles and GET /v1/geo/places give the fields and codes filters use.