Getting records
Bundles: what you pay for
Section titled “Bundles: what you pay for”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.
Unlock by ID
Section titled “Unlock by ID”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 theZemo-Productheader). 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 get402 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.
"""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 jsonimport osimport urllib.requestimport 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 requestresult = 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"))// 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 { randomUUID } from "node:crypto";
const BASE = process.env.ZEMO_API_BASE ?? "https://api.zemodata.com";
async function post(path, body, idempotencyKey) { const headers = { Authorization: `Bearer ${process.env.ZEMO_API_KEY}`, "Content-Type": "application/json" }; if (idempotencyKey) headers["Idempotency-Key"] = idempotencyKey; const response = await fetch(`${BASE}${path}`, { method: "POST", headers, body: JSON.stringify(body) }); if (!response.ok) throw new Error(`${response.status}: ${await response.text()}`); return response.json();}
const body = { entity: "person", product: process.env.ZEMO_PRODUCT ?? "demo-people", ids: [process.env.ZEMO_RECORD_ID], // up to 100 IDs per call bundles: ["profile", "work_email"], max_credits: 50, // never pay more than this for the call};
const estimate = (await post("/v1/estimate", body)).data;console.log("estimate:", estimate.credits, "credits");
const key = randomUUID(); // one key per logical request; reuse it only to retry the same requestconst result = await post("/v1/unlock", body, key);console.log("charged:", result.meta.credits_charged, "would charge:", result.meta.credits_would_charge);for (const item of result.data.records) { const emails = item.record.emails?.work ?? []; console.log(item.id, item.record.name.full, emails.map((email) => email.value));}for (const rejected of result.data.rejected) console.log("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.const again = await post("/v1/unlock", body, key);console.log("replayed:", again.meta.replayed ?? null);# Estimate the cost (free), then unlock records by ID with an Idempotency-Key.# Test keys (zd_test_…) never spend credits: meta.credits_would_charge shows what a live key would pay.set -euo pipefailBASE="${ZEMO_API_BASE:-https://api.zemodata.com}"PRODUCT="${ZEMO_PRODUCT:-demo-people}"
body="{\"entity\": \"person\", \"product\": \"$PRODUCT\", \"ids\": [\"$ZEMO_RECORD_ID\"], \"bundles\": [\"profile\", \"work_email\"], \"max_credits\": 50}"
curl --silent --show-error --fail-with-body \ -H "Authorization: Bearer $ZEMO_API_KEY" -H "Content-Type: application/json" \ -d "$body" "$BASE/v1/estimate"echo
key="unlock-$(date +%s)-$RANDOM" # one key per logical request; reuse it only to retry itfor attempt in first retry; do answer="$(curl --silent --show-error --fail-with-body \ -H "Authorization: Bearer $ZEMO_API_KEY" -H "Content-Type: application/json" \ -H "Idempotency-Key: $key" \ -d "$body" "$BASE/v1/unlock")" echo "$answer"done# On the retry a live key gets the stored answer, charged once ("replayed": true).# Test keys answer afresh each time, also for free.echo "replayed: $(printf '%s' "$answer" | sed -n 's/.*"replayed": *\([a-z]*\).*/\1/p')"Estimate first
Section titled “Estimate first”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.
A record by ID
Section titled “A record by ID”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.
Enrich from what you know
Section titled “Enrich from what you know”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 ismatched: 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
503until it is live.
"""Enrich a person from a work email: POST /v1/person/enrich (charged only on a match)."""
import jsonimport osimport urllib.requestimport 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")// Enrich a person from a work email: POST /v1/person/enrich (charged only on a match).import { randomUUID } from "node:crypto";
const BASE = process.env.ZEMO_API_BASE ?? "https://api.zemodata.com";
const response = await fetch(`${BASE}/v1/person/enrich`, { method: "POST", headers: { Authorization: `Bearer ${process.env.ZEMO_API_KEY}`, "Content-Type": "application/json", "Idempotency-Key": randomUUID(), }, body: JSON.stringify({ product: process.env.ZEMO_PRODUCT ?? "demo-people", match: { email: process.env.ZEMO_EMAIL }, // or { phone: "+18135550123" } bundles: ["profile", "work_email"], }),});if (!response.ok) throw new Error(`${response.status}: ${await response.text()}`);const { data } = await response.json();
if (data.matched) { console.log("matched", data.record_id, "likelihood", data.likelihood); console.log("charged bundles:", data.charged_bundles, "already owned:", data.already_owned_bundles);} else { console.log("no match: nothing charged");}# Enrich a person from a work email: POST /v1/person/enrich (charged only on a match).set -euo pipefailBASE="${ZEMO_API_BASE:-https://api.zemodata.com}"PRODUCT="${ZEMO_PRODUCT:-demo-people}"
answer="$(curl --silent --show-error --fail-with-body \ -H "Authorization: Bearer $ZEMO_API_KEY" \ -H "Content-Type: application/json" \ -H "Idempotency-Key: enrich-$(date +%s)-$RANDOM" \ -d "{\"product\": \"$PRODUCT\", \"match\": {\"email\": \"$ZEMO_EMAIL\"}, \"bundles\": [\"profile\", \"work_email\"]}" \ "$BASE/v1/person/enrich")"echo "$answer"if printf '%s' "$answer" | grep -q '"matched": *true'; then echo "matched $(printf '%s' "$answer" | sed -n 's/.*"record_id": *"\([^"]*\)".*/\1/p')"else echo "no match: nothing charged"fiBatch enrich (/enrich/batch, up to 100 items per call) is coming with the search engine.
Delivery is logged
Section titled “Delivery is logged”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.