Skip to content

SDKs

An SDK is a thin layer over the REST API. It introduces no new concepts: the same endpoints, the same field names, the same error codes. There are four things it does for you: it adds the authentication header, it turns cursor pagination into an iterator, it backs off and retries on 429 and 5xx responses, and it turns the error body into a typed exception.

Install

Terminal window
pip install zeo-radar

Python 3.10 and above are supported. Its only dependency is httpx.

First call

import os
from zeo_radar import ZeoRadar
client = ZeoRadar(api_key=os.environ["ZEO_RADAR_API_KEY"])
# list the brands
for brand in client.brands.list():
print(brand.id, brand.name, brand.status)
# pull visibility with a platform breakdown
report = client.reports.visibility(
brand_id="8f14a0c2-5b7e-4a91-9d33-6c2e10b4f7a5",
group_by="platform",
period="last_30d",
prompt_type="non-brand",
)
for row in report:
print("%-16s %5.1f%%" % (row.label, row.visibility * 100))

client.brands.list() returns an iterator, not a list. It follows the cursor for you and pulls pages until meta.next_cursor is empty. If you want a single page, use client.brands.list_page(limit=50); the object it returns carries the data, meta and error fields as they are.

Starting a measurement and waiting for it

run = client.runs.create(brand_id="8f14a0c2-5b7e-4a91-9d33-6c2e10b4f7a5")
print(run.id, run.status) # queued
finished = client.runs.wait(run.id, poll_seconds=30, timeout_seconds=3600)
print(finished.status) # done or failed

wait polls every 30 seconds and waits until it sees done or failed. If the timeout is exceeded it raises TimeoutError; it does not cancel the measurement, because there is no endpoint that cancels one.

Errors

from zeo_radar import RateLimitError, NotFoundError, ValidationError, ZeoRadarError
try:
client.reports.visibility(brand_id="wrong-id")
except NotFoundError as err:
print(err.code, err.message, err.request_id)
except RateLimitError as err:
print("wait", err.retry_after)
except ZeoRadarError as err:
print("unexpected:", err.code)

Every exception derives from the ZeoRadarError class and carries the code, message, field, status and request_id fields. request_id is what you quote in a support ticket.

Install

Terminal window
npm install @zeo/radar

Node.js 20 and above are supported. The package is ESM, type definitions ship inside it, and it has no extra dependencies.

First call

import { ZeoRadar } from "@zeo/radar";
const client = new ZeoRadar({ apiKey: process.env.ZEO_RADAR_API_KEY });
const brands = await client.brands.list();
for (const brand of brands) {
console.log(brand.id, brand.name, brand.status);
}
const rows = await client.reports.visibility({
brandId: "8f14a0c2-5b7e-4a91-9d33-6c2e10b4f7a5",
groupBy: "platform",
period: "last_30d",
promptType: "non-brand"
});
for (const row of rows) {
console.log(row.label, (row.visibility * 100).toFixed(1) + "%");
}

Pagination

For large lists there is an async iterator; only one page is held in memory:

for await (const answer of client.reports.answers.iterate({
brandId: "8f14a0c2-5b7e-4a91-9d33-6c2e10b4f7a5",
runId: "b21c74e9-0a35-4d88-9f27-51ac3e6b8042",
includeText: false,
limit: 200
})) {
process.stdout.write(answer.id + "," + answer.platform + "\n");
}

Errors

import { ZeoRadarError } from "@zeo/radar";
try {
await client.runs.create({ brandId: "8f14a0c2-5b7e-4a91-9d33-6c2e10b4f7a5" });
} catch (err) {
if (err instanceof ZeoRadarError && err.code === "run_in_progress") {
console.log("a measurement is already running");
} else {
throw err;
}
}
SubjectBehaviour
Namingsnake_case in REST, snake_case in Python, camelCase in JavaScript. Returned fields follow the same conversion
Base URLDefaults to https://api.zeoradar.com/v1, changeable with the baseUrl option
Timeout60 seconds per request, changeable with the timeout option
RetriesOnly 429, 500 and 503. Five attempts at most, exponential backoff, obeying Retry-After when the server sends one
PaginationThe iterator interface follows the cursor automatically
VersioningThe major version of the package is tied to the API version: 1.x releases speak /v1

If you are writing a client in another language, watch two things: the envelope is identical on every endpoint, so a single parser is enough; and the cursor is opaque, so do not parse it. The whole contract is on the response format page, and it does not change in a breaking way inside /v1.

feedback.question