Skip to content

Getting records

A record’s fields come in bundles. You ask for the bundles you want and pay for each one you receive. A bundle you already own (you bought it earlier, and it is still within your re-access period) is delivered again at no charge.

Entity Bundles
Person profile, work_email, personal_email, mobile, phone, home_address
Company company_profile, company_contacts

Name, job, employer, location, data grade and the has_* flags (for example has_mobile) always come with a record, free. The credit price of each bundle depends on your plan and your data product; POST /v1/estimate tells you the exact cost.

POST /v1/unlock takes up to 100 record IDs (zp_… for people, zc_… for companies), the bundles you want, and optionally:

  • product: the data product to use (or the Zemo-Product header). Every ID is re-checked against it.
  • required: bundles a record must have. A record missing one is not delivered and not charged.
  • max_credits: a ceiling. If the call would cost more, nothing is charged and you get 402 credits.max_exceeded.

The answer lists records (full values, with charged_bundles, already_owned_bundles and merged_from), charged (credits), already_owned (IDs delivered at no charge) and rejected with a reason for each ID not delivered: outside_product, not_found, suppressed (the person opted out) or required_missing. Rejected IDs are never charged. If two records were merged, the old ID answers with the surviving record and lists the old ID in merged_from.

python/unlock.py
"""Estimate the cost (free), then unlock records by ID with an Idempotency-Key.
Test keys (zd_test_…) read the test dataset and never spend credits:
meta.credits_would_charge shows what a live key would pay.
"""
import json
import os
import urllib.request
import uuid
BASE = os.environ.get("ZEMO_API_BASE", "https://api.zemodata.com")
SECRET = os.environ["ZEMO_API_KEY"]
def post(path: str, body: dict, idempotency_key: str = "") -> dict:
headers = {"Authorization": f"Bearer {SECRET}", "Content-Type": "application/json"}
if idempotency_key:
headers["Idempotency-Key"] = idempotency_key
request = urllib.request.Request(
f"{BASE}{path}", data=json.dumps(body).encode(), headers=headers, method="POST"
)
with urllib.request.urlopen(request, timeout=30) as response:
return json.load(response)
body = {
"entity": "person",
"product": os.environ.get("ZEMO_PRODUCT", "demo-people"),
"ids": [os.environ["ZEMO_RECORD_ID"]], # up to 100 IDs per call
"bundles": ["profile", "work_email"],
"max_credits": 50, # never pay more than this for the call
}
estimate = post("/v1/estimate", body)["data"]
print("estimate:", estimate["credits"], "credits")
key = str(uuid.uuid4()) # one key per logical request; reuse it only to retry the same request
result = post("/v1/unlock", body, idempotency_key=key)
meta = result["meta"]
print("charged:", meta["credits_charged"], "would charge:", meta.get("credits_would_charge"))
for item in result["data"]["records"]:
emails = item["record"].get("emails", {}).get("work", [])
print(item["id"], item["record"]["name"]["full"], [email["value"] for email in emails])
for rejected in result["data"]["rejected"]:
print("not delivered:", rejected["id"], rejected["reason"])
# With a live key, a retry with the same key and body returns the stored answer and charges
# nothing again (meta.replayed is true). Test keys answer afresh each time, also for free.
again = post("/v1/unlock", body, idempotency_key=key)
print("replayed:", again["meta"].get("replayed"))

POST /v1/estimate takes the same body as unlock and is free. It answers the total credits, a breakdown per bundle, the IDs you already own and an estimate_token valid for 10 minutes (bulk jobs will use it). The unlock sample above calls it first.

GET /v1/person/{id} and GET /v1/company/{id} return the record. Bundles you own come back with full values; the others are listed in locked_bundles (add ?preview=true for masked values, such as d•••@brightline-hvac.com). Ask for specific bundles with ?bundles=profile,work_email. Fetching does not charge: unlock to buy bundles. A record you own no bundle of is shown only when ?product= names a granted data product that holds it; otherwise the answer is 404 record.not_found.

POST /v1/person/enrich finds a person from an exact email or phone, and POST /v1/company/enrich finds a company from its web domain or phone. You are charged only on a match, and only for the bundles delivered.

  • min_likelihood (1 to 10): how sure the match must be.
  • required: bundles the match must have; otherwise the answer is matched: false, with nothing charged.
  • A malformed email, phone or domain, or no usable key, is 422 validation.
  • Matching by name (with a company, region or address) and by profile URL needs the search engine and answers 503 until it is live.
python/enrich.py
"""Enrich a person from a work email: POST /v1/person/enrich (charged only on a match)."""
import json
import os
import urllib.request
import uuid
BASE = os.environ.get("ZEMO_API_BASE", "https://api.zemodata.com")
body = {
"product": os.environ.get("ZEMO_PRODUCT", "demo-people"),
"match": {"email": os.environ["ZEMO_EMAIL"]}, # or {"phone": "+18135550123"}
"bundles": ["profile", "work_email"],
}
request = urllib.request.Request(
f"{BASE}/v1/person/enrich",
data=json.dumps(body).encode(),
headers={
"Authorization": f"Bearer {os.environ['ZEMO_API_KEY']}",
"Content-Type": "application/json",
"Idempotency-Key": str(uuid.uuid4()),
},
method="POST",
)
with urllib.request.urlopen(request, timeout=30) as response:
result = json.load(response)
data = result["data"]
if data["matched"]:
print("matched", data["record_id"], "likelihood", data["likelihood"])
print("charged bundles:", data["charged_bundles"], "already owned:", data["already_owned_bundles"])
else:
print("no match: nothing charged")

Batch enrich (/enrich/batch, up to 100 items per call) is coming with the search engine.

Every record delivered with full values is written to a data-access log with your organization, key, record, bundles and request ID, in the same transaction as the charge. See Privacy and compliance.