Skip to main content
Technical implementation

Passiro API reference: filters, pagination and errors

The API v1 endpoints, their parameters, cursor pagination, the statistics window, time fields and errors, with examples to run from your server.

This reference is for developers who read consent data from their own server. To create a key and send your first request, start with Access the Passiro API, then use this page for the details.

Base URL, authentication and scope

All endpoints are under https://passiro.com/api/v1 and answer with JSON over HTTPS. Send the key in the header Authorization: Bearer followed by the key, which starts with psk_. A key belongs to one domain and returns only that domain's data, which every successful answer names in site (id and domain); a site, domain or site_id parameter cannot select another website and is rejected with 400. The key and the domain's plan, Business or Enterprise, are checked on every request, so a deleted key stops working at once. Keys are server-side secrets: never put one in a URL, in front-end code or in a log. The API sends no CORS headers, so a web page on another site cannot call it from a browser; call it from your server.

Endpoints

  • GET /api/v1/consent/cookies: the detected cookies and trackers of the domain, with category, provider, expiry and description. It takes no parameters. It is an inventory, not a stream of consent events: cookie_stats counts cookies, so an empty cookies list says nothing about consent records.
  • GET /api/v1/consent/records: the consent records, newest first, with stable paging. Parameters: limit, offset, before and before_id.
  • GET /api/v1/consent/statistics: totals, rates, categories, countries, banner versions and a daily trend for a window of days. Parameter: window_days.

Records: parameters and pagination

limit sets the page size: 1 to 500, default 50. offset skips records: 0 to 100,000, default 0. To page further, use the cursor, which is a pair: before, an ISO-8601 time with a time zone, and before_id, the 26-character consent_id of the last record you received. Take both from next_before and next_before_id in the previous response and URL-encode them. An empty or malformed value is rejected with 400 rather than reset to a default; before_id without before is invalid, and a nonzero offset cannot be combined with the cursor. A parameter sent twice or as a list (limit[]=5), and any parameter the endpoint does not know, is rejected with 400 as well.

Records are ordered by occurred_at and then by consent_id, so records with the same time keep a fixed order and the paired cursor neither skips nor repeats them. before without before_id is still accepted and returns the records strictly older than that time, which leaves out records with exactly the boundary's time, so always send both when you follow a cursor. Each consent_id appears once, also when the archive received the same event twice. The API does not take a snapshot: a new record is newer than your cursor and appears when you start again from the first page, but a record can reach Passiro a few minutes after it occurred, so a run that starts at the newest records can miss one that arrives late; start the next run a few minutes back to catch it. Each record is one stored event: do not deduplicate on consent_uuid, and do not treat a consent_id as a browser or a person. In a record's categories, analytics is always present next to statistics with the same value: they are one category, so never add them together. A shortened response with synthetic values:

{
"ok": true,
"source": "archive",
"site": { "id": 4700000, "domain": "example.com" },
"data_as_of": "2026-11-24T09:16:02.000000Z",
"stats": {
"total": 121,
"accepted_all_30d": 40,
"rejected_all_30d": 31,
"period_30d": { "start": "2026-10-25T09:16:30Z", "end": "2026-11-24T09:16:30Z" }
},
"limit": 50,
"offset": 0,
"before": null,
"before_id": null,
"next_before": "2026-11-20T09:14:03.512000Z",
"next_before_id": "01JD0000000000000000000050",
"records": [
{
"consent_id": "01JD0000000000000000000001",
"consent_uuid": "3f2b8c1e-0000-4000-8000-000000000001",
"categories": { "necessary": true, "statistics": true, "marketing": false, "preferences": false, "analytics": true },
"classification": "custom",
"geo_country": "DE",
"banner_version": "2.11.1",
"timestamp": "2026-11-24 10:15:00",
"occurred_at": "2026-11-24T09:15:00.243000Z"
}
]
}

Example: a test domain has 121 records and you page with limit=50. The pages hold 50, 50 and 21 records. After the third page, next_before and next_before_id are both null, so you have everything. A page that fails is not an empty page: retry the same request with the same cursor and never move on to the next page.

A complete paging client

This Python 3 example uses only the standard library. It reads the key from the PASSIRO_API_KEY environment variable, uses HTTPS with a timeout, checks the status before it reads the body, keeps the same cursor when it retries, waits as long as Retry-After asks after 429 or 503, and stops with an error after a few attempts instead of reporting an incomplete result as finished. It never prints the key or the records.

import json, os, time, urllib.error, urllib.parse, urllib.request

BASE = "https://passiro.com/api/v1/consent/records"
KEY = os.environ["PASSIRO_API_KEY"]
ATTEMPTS = 4


def wait_seconds(err):
try:
return int(err.headers.get("Retry-After", "30"))
except ValueError:
return 30


def get_page(params):
url = BASE + "?" + urllib.parse.urlencode(params)
request = urllib.request.Request(url, headers={"Authorization": "Bearer " + KEY})
for attempt in range(1, ATTEMPTS + 1):
try:
with urllib.request.urlopen(request, timeout=30) as response:
return json.load(response)
except urllib.error.HTTPError as err:
if err.code in (429, 503) and attempt < ATTEMPTS:
time.sleep(wait_seconds(err))
continue
raise RuntimeError("Request failed with HTTP %d" % err.code) from None
except (urllib.error.URLError, TimeoutError):
if attempt < ATTEMPTS:
time.sleep(5 * attempt)
continue
raise RuntimeError("Passiro API not reachable") from None


def all_records():
records = []
params = {"limit": 500}
while True:
page = get_page(params)
if not page.get("ok"):
raise RuntimeError("Unexpected response: %s" % page.get("error"))
records.extend(page["records"])
cursor = (page.get("next_before"), page.get("next_before_id"))
if cursor == (None, None):
return records
if None in cursor:
raise RuntimeError("Incomplete cursor in the response")
params = {"limit": 500, "before": cursor[0], "before_id": cursor[1]}


if __name__ == "__main__":
print("Fetched %d records" % len(all_records()))

Statistics

The statistics cover a window of days that you choose with window_days: a whole number from 1 to 366, default 90 (the Statistics page in the dashboard starts at 30 days). The window is the window_days times 24 hours before the moment of your request, in UTC; it includes window_start and excludes window_end, and the response echoes window_days, window_start and window_end. Every figure follows the window except total_all_time, which counts the domain's whole history. An empty, zero, negative, decimal or larger value is rejected with 400 invalid_window_days, which also gives max_window_days. from, to and days are not supported and return 400 unsupported_parameter. The daily trend groups records by calendar day in trend_time_zone (Europe/Copenhagen), so its first and last day can be partial.

acceptance_rate in API v1 is accepted_all divided by total, times 100, rounded to one decimal, and 0.0 when there is no data: it counts full acceptance only. optional_acceptance_rate is accepted_all plus custom, divided by total, times 100, rounded and empty the same way: the share of records that accepted at least one optional category. custom holds the records that accepted some but not all optional categories, and rejected_all those that accepted none. Example: 200 records with 90 accepted_all, 30 custom and 80 rejected_all give an acceptance_rate of 45.0 and an optional_acceptance_rate of 60.0. Acceptance rate on the Statistics page also means at least one optional category, but it counts only banners that ask before tracking and leaves out automatic choices and a repeat of an identical choice within five minutes, so it can differ from optional_acceptance_rate; compare the two only for the same period. total counts every stored record in the window, each consent_id once, and total_all_time the history available for the domain. categories counts, for analytics, marketing and preferences, the records that granted that category, partial choices included; necessary is not counted. cookie_stats in the cookies response counts cookies, not choices.

Freshness and response times

Records and statistics are answered from Passiro's copy of your domain's consent archive, which is kept up to date every few minutes, so an answer normally takes well under a second. data_as_of in both responses says when the copy was last read from the archive, in UTC, and a record reaches the archive about a minute after it occurs. A copy older than an hour is never served: the API answers 503 consent_archive_unavailable until it is current again. The first requests after a key is created for a large domain can also answer 503, with Retry-After, for a few minutes while the copy is built. accepted_all_30d and rejected_all_30d in the records response always cover the fixed 30 days before the request, shown in stats.period_30d. HEAD returns the same status as GET without reading any records, so it is a cheap check of a key and its parameters.

Time fields

occurred_at is the authoritative time of a record: ISO-8601 in UTC with Z, and the value the cursor uses. timestamp is an older field kept unchanged for existing integrations: the same moment in the time zone of Passiro's servers (Europe/Copenhagen) as YYYY-MM-DD HH:MM:SS, without a zone marker. Use occurred_at for calculations and paging, and do not convert timestamp with a fixed offset, because the offset is one hour in winter and two in summer. data_as_of, window_start, window_end and the times in stats.period_30d are UTC with Z as well.

Errors and retries

An error answer has a stable code and a safe explanation, {"ok":false,"error":"CODE","message":"EXPLANATION"}, with hint, max_offset or retry_after where they help. Answers to HEAD and OPTIONS have no body. What each status means and what to do:

  • 400: a parameter is wrong, for example invalid_limit, invalid_offset, offset_too_large (with max_offset), invalid_before, invalid_before_id, offset_with_before, invalid_window_days (with max_window_days) or unsupported_parameter (with parameter). Correct the request; sending it again unchanged gives the same answer.
  • 401 invalid_api_key, with the header WWW-Authenticate: Bearer: the key is missing, wrong or deleted, or its domain was deleted. Check the Authorization header and the key under API, without sharing the key; a dashboard login never replaces the key. 403 plan_required: the key is valid, but the domain's plan does not include the API; check the plan.
  • 404 not_found: the path is not one of the documented routes. 405 method_not_allowed: the endpoints accept GET, HEAD and OPTIONS only; HEAD answers with the status of GET and no body, OPTIONS with 204 and an Allow header.
  • 429 rate_limited: too many requests for the key. Wait for the time in the Retry-After header, also given as retry_after, before you send the same request again. When a limit applies, the headers RateLimit-Limit, RateLimit-Remaining and RateLimit-Reset show it.
  • 503 consent_archive_unavailable: the consent archive is temporarily unavailable, or the domain's copy is being prepared. Wait for Retry-After (30 or 60 seconds), retry the same request with the same cursor a limited number of times, and treat the run as failed if it keeps failing. It never means an empty result or the end of the list.

Try it in the dashboard

Under API in the dashboard, select one of your keys under Test endpoints and choose Try it next to an endpoint. Fill in the parameters you want, leaving a field empty for its default, and choose Send request. You see the HTTP status, the time the request took, the parameters the API applied and the JSON or a readable error. A request stops after 30 seconds, and Cancel stops it earlier. After 503 or 429 a countdown shows the Retry-After time before you can retry the same request. A failed request never moves the cursor; Next page fills before and before_id from a successful answer. The key's Last used time updates when the server accepts the request. For a first request from your own server, see Access the Passiro API.

Related guides