Base URL and description
The API reference in these docs is generated from that document: every endpoint, with its
parameters and response fields.
Authentication
Send a project token as a bearer token:403, and a revoked token gets 401.
The console calls the same endpoints with your session cookie instead: it reads every project of
the organizations you belong to, and any other project gets 403. Owners and admins issue project
tokens in the console, Settings › Agents and tokens › Access tokens › Create a token; a token is shown once.
An OAuth access token from Apsio’s sign-in (WorkOS AuthKit) issued for the API
(https://api.apsio.io) reads what its user can read, like the console session: memberships are
checked on every request, so a person removed from an organization loses its projects at once.
A token that names an organization (org_id, the organization chosen at sign-in) reads only
the Apsio organization linked to it. Tokens issued for the
MCP server work only through the MCP server, which passes them on with
its own credential; sent to the API directly they get 401, like a token for any other audience.
Every request with a project token or an access token, directly or through the MCP server, is
written to the organization’s audit log before anything is read, with the user or the project
token’s id (never the token), the route and, from the MCP server, the tool. If the entry cannot
be written the request fails with 503 and reads nothing. Requests from the console, with your
session, are not agent calls and are not written. The entries are in the audit log
(Settings › Activity).
GET /v1/projects lists the projects your credentials can read, with their apps: a project
token’s one project, or every project of your organizations.
You get project tokens in the console: owners and admins create them under Settings › Agents and tokens (Access tokens)
for one project, 7, 30, 90 or 365 days, with write scopes only if chosen, and see each one once.
Running the Apsio service locally from its repository, an operator can also mint one with
pnpm --filter @apsio/api token <project id> [ttl seconds], which writes the token’s row in
DATABASE_URL and signs it with the API_TOKEN_SECRET of your environment: every token needs
its row, or the API refuses it.X-Request-Id header; quote it when you report a
problem.
Endpoints
All paths start with/v1/projects/{projectId}.
Debug and release builds
Every view counts release builds unless asked otherwise: thebuild parameter (and the
build field of an Explore query) takes release (the default), debug or all. A debug build
is one the SDK reports as development in apsio.app.install.source (spec 2.3): installed from
Xcode or Android Studio, whoever installed it. Every other build is a release build,
TestFlight included, and so is data whose SDK does not say where the build came from. An issue
counts as a debug build’s when the session it happened in was one, so a crash whose session has not
reported yet still counts as a release build’s. It applies to release health, issues and their
counts, sessions, exits, vitals, performance, network and Explore; an issue’s detail and a
single session are shown whole.
See Explore, SQL and dashboards for what a query can read, its limits and
its errors.
POST /query takes {"sql": "..."} (JSON only) and runs it as a ClickHouse user of the project:
it reads only the six tables’ own columns (not ClickHouse’s virtual columns such as _part or
_part_offset, nor a map’s subcolumns such as attributes.keys: use mapKeys(attributes)) and
only the project’s rows, whatever the SQL says. No other table, system table,
setting or merge(), and no table function over another source; numbers(), values() and
view() work, within the read limit. It stops at 10 seconds, 50 million rows
read and 512 MB of memory, cuts the result at 10,000 rows or 12 MB (truncated), and runs two of the
project’s queries at once. The plan sets how many a minute (Pro and the trial 30, Enterprise 60;
not on Free). Every query lands in your organization’s audit log with
the SHA-256 and length of its SQL, never the text. 64-bit integers come back as strings, and
the rows and bytes read are rounded to 2 significant digits. An error says what kind it is
(query_syntax with its position, query_not_allowed, query_limit, query_busy,
query_failed, query_parameter), never ClickHouse’s own message.
An optional range ({"from": "...", "to": "..."}, RFC 3339, 90 days at most; from defaults to
a day before to, to to now) fills three placeholders as ClickHouse query parameters, never as
text in the SQL: {from:DateTime}, {to:DateTime} (exclusive) and {bucket:UInt32}, a step in
seconds that cuts the range into at most 120 points. The answer’s range says what they were.
/dashboards) are a project’s boards of panels, at most 20 boards a project
and 24 panels a board. A SQL panel holds a query like the one above and a chart (line, bar,
stat or table, its columns, a unit and an optional threshold line).
POST .../panels/{panelId}/run runs it the way POST /query does: the same limits, rate and
audit. A SQL panel needs a plan with run_query. A preset panel reads one of the routes above with
its parameters, on every plan and unmetered: crash_free (release-health/daily),
release_health (release-health/compare), performance_series, network_endpoints and
vitals. It answers {"preset": ..., "data": ...} with that route’s answer. The range is
widened to whole buckets, and a result is kept for a minute in the API (X-Apsio-Cache: hit),
never stored. Members create and edit boards; owners and admins delete them. Names, titles and
SQL are untrusted text.
Agents write only with a grant (D98), one per kind of write: dashboards:write for the
dashboard routes, issues:write for the issue state and merge routes. An OAuth access token’s client (its
client_id) needs the user’s grant for it in the organization, given in the console under
Settings › Agents and tokens. Without one a write answers 403 with grant_required, or
grant_expired when the grant went unused for 90 days, and grant_url, the console page that
gives it. The user’s role still applies. A project token writes only when minted with the
route’s scope (dashboards:write never deletes); any other token answers grant_required.
Build size checks (POST /projects/{projectId}/checks) come from CI, at most 20 a minute per
token: a project token with checks:write records a build’s sizes, and nothing else does, neither a
person nor an agent. That token holds no other scope and reads nothing but GET /projects, as it sits
in a CI secret. The answer compares the build with its baseline, the last run recorded for the
same app and format, and change.warning says it rose by warn_percent or more, 5 unless the run
sets another. A warning never blocks anything. Artefacts of different kinds never compare. An .ipa
or .aab is not what a user downloads, as the store cuts each device’s copy from it, so these sizes
show how a build changed, not what a user gets. GET lists the runs for anyone who reads the project.
A run’s branch and build names are stored as sent and shown to members, and a run is kept 400 days, so name branches
accordingly, or send another branch. Control and invisible characters answer 400.
Funnels and journeys read a session’s screens from its app.screen.view events (spec 8.6),
one each time a screen is shown, going back to it included. A session without any, from an SDK
before 8.6, is read from its app.screen.load spans (spec 8.1) instead: one per screen created,
so going back to a screen is not seen there. A session never counts from both, so no show
counts twice.
Users are counted by install id. When an app turns the install id off, user numbers are
null and only the session numbers are given.
An issue’s id is its fingerprint: the exception type and the top in-app frames of the stack
once symbolicated. When an occurrence arrives before its symbols, symbolicated is false
and missing_debug_ids lists every image of its stack without symbols, system frameworks
included. The in-app images to upload come from
GET /v1/projects/{projectId}/releases/{release}/missing-symbols, each with its kind
(app, framework for an Apple framework bundled in the app, native_library or
source_map; see frameworks bundled in the app).
After an upload, the
occurrence is symbolicated again and may move to another issue. grouping tells which rule
made the fingerprint: see Grouping.
In an issue’s latest occurrence, frames is the crashing thread symbolicated (function, file,
line, image, whether it is in your app), and raw_frames is the stack as the device sent it.
/issues takes kind (crash, error, anr, hang or abnormal_exit; every kind by
default), assignee (me, none or a member’s user id; me needs the console or an OAuth
access token, so a project token gets 400), new_in (the issues with occurrences in a
release and none in its app’s release before it, as /releases counts new_issues), and
sort: last_seen, occurrences, users or sessions, the biggest or newest first;
first_seen, by the issue’s birth, newest first; status (regressed, unresolved, resolved,
ignored) or kind (crash, ANR, hang, abnormal exit, handled error), each then by last_seen.
order=asc reverses any sort, and a cursor goes on only in its own sort and order. screen keeps the occurrences whose last screen
loaded before them was that screen; endpoint_method, endpoint_host and endpoint_template
keep those within 60 s after a failed request to that endpoint in the same session. daily=true adds each issue’s occurrences and sessions over the last 14 rolling
24-hour buckets, for a sparkline: they follow app_id and the flag filters, not release or
the range. Each issue
has first_seen_release, the release it was born in: its first occurrence ever, within your
plan’s retention, whatever the range.
Vitals percentiles are exact and weighted by each span’s sample weight. TTFD is listed only for
screens where the app called reportFullyDrawn(): Apsio never substitutes TTID for it. A hang
rate counts sessions with at least one hang (iOS), an ANR rate sessions with an ANR (Android),
from the hangs the SDK saw while the app ran (apsio.hang.source live): a hang that MetricKit
reports a day later can be the same one, so it counts only in hang durations. A record from an
SDK that does not send the source counts as MetricKit’s on iOS and as live elsewhere. A hang the
app was killed during (apsio.hang.unfinished) counts in the rates, but its duration is only a
lower bound: the duration percentiles and histogram leave it out, and durations.unfinished says
how many there were.
Frames come from the SDK’s per-screen counts while the app is in the foreground. Slow frames
missed the display’s refresh, frozen ones took over 700 ms. Slow and frozen frames per minute in
the foreground compare across platforms. The frame total, and the share of slow frames in it,
compare within one platform only: iOS counts every refresh of the display, also when nothing
changes, and Android only the frames it drew. Frame counts are sampled with their session and
reweighted like spans: a point from a session kept at a rate of 1/4 counts four times.
A cohort is defined by the same filters as /sessions (at least one besides app_id, which
narrows both sides). For each value of a dimension, difference is its share in the cohort minus
its share in the other sessions, and lift their ratio; values are ranked by difference, and
only over-represented ones are listed. Shares from a few sessions are noisy: min_sessions
(default 2) leaves out rarer values, and a small cohort deserves a higher one. With rank=share,
every value is listed, under-represented ones too, the biggest share in the cohort first and then in
the rest, and min_sessions counts both sides: who the cohort is against everyone else. When the cohort or
the rest is empty, comparable is false, no values are listed and note says why. Feature
flags come from the evaluation records (feature_flag.key and feature_flag.result.variant)
and from the feature_flag.<name> attributes a session carries after a rotation; network types
from network.connection.type. A cohort covers at most 30 days, and so do vitals.
Performance and network
What each measure means, and how the SDKs take it, is in Performance. Requests are grouped by the endpoint template:url.template when the app or its HTTP library
sends it (without any query or fragment), otherwise the path of url.full with every
segment that looks like an identifier or personal data (ids, UUIDs, long hexadecimal, phone
numbers, tokens, email addresses, free text) replaced by {id}. So
GET /orders/1001 and GET /orders/1002 are one endpoint, GET /orders/{id}. A request
failed when it got a 5xx or no response at all (error.type set, no status); 4xx responses are
counted on their own, since many are expected. Request counts and percentiles are reweighted by
session sampling, as vitals are; network percentiles are estimates (t-digest), app start and
screen percentiles are exact. A method other than the standard ones is _OTHER.
/sessions and /cohorts/compare take an endpoint (endpoint_method, endpoint_host and
endpoint_template, with endpoint_failed=true for failed requests only) or a screen
(screen, with min_ttid_ms for slow loads only), so the sessions behind a failing endpoint
or a slow screen are one request away.
Each sample request and trace carries apm_url, the same trace in your APM, built from the
project’s APM link (Settings › APM link): an https URL
with a {trace_id} placeholder, for example
https://app.datadoghq.com/apm/trace/{trace_id}. Apps send traceparent only to the hosts you
list, so the trace id is the one your backend saw. MetricKit histograms come from every user’s
day, not from sampled sessions; points with other bucket bounds than a release’s most common
ones are counted in excluded_points and not added. Performance views cover at most 30 days. buckets=fine adds even-width histograms with an overflow
bucket (fine_histogram): app start in 50 ms (cold), 25 ms (warm) or 10 ms (hot) buckets, screens in
100 ms, network latency in 100 ms and hang durations in 250 ms.
Examples
Release health since October 1:Time ranges and pages
fromandtoare RFC 3339 times. The default range is the last 7 days (395 days for one issue, 30 days for a release comparison, 14 days for the daily series).- How long a range may be depends on the data. Issues, release health (
/releases,/release-health/daily,/release-health/compare,/exits,/exits/daily) and missing symbols cover up to 395 days. Everything else covers up to 90 days, and session search, vitals and cohorts up to 30. - Your plan decides how far back data is kept: crashes and release health for 30 days on
Free and 13 months on Pro and the trial. A range may reach further back than that; it then
returns only what is kept. Responses from the crash and release-health endpoints carry
retention_days, the number of days your plan keeps, so an empty result for an older range reads as “not kept”, not “nothing happened”. - The daily series has one entry per UTC day. Without
fromit starts at midnight UTC 13 days beforeto, so it holds 14 days; the last day is partial (up toto), and so is the first whenfromis not at midnight. Days before your plan’s retention are left out. - A request that hits a query limit (time, memory or result size) gets
query_limitwith503or422: narrow the time range or pick an app. - Lists return
next_cursor. Pass it back ascursorfor the next page; it isnullon the last page.limitsets the page size.
Errors
Errors are JSON with a code and a message:invalid_request (400), unauthorized (401), forbidden (403), not_found
(404), erasing (410) or rate_limited (429). erasing means the project or its organization
is being deleted (subject says which): its data is no longer read, and the request is not worth
retrying.
Rate limits
Every caller has a request rate, counted by all of the API’s servers together:run_query also has the plan’s rate per project, and dashboard and issue changes (states,
merges and unmerges, counted together) their own. After too many requests with a token that is not valid, an address gets 429 for a while
before its tokens are checked again.
Past a limit the API answers 429 with the code rate_limited and a Retry-After header: the
seconds until the next request can succeed. Wait that long and retry; the budget refills
evenly, so there is no minute boundary to wait for.