CControxity Docs
GuidesReferenceHTTP APIOpen Controxity
Reference

HTTP API v1

What an app sends to Controxity, and what it can ask. The SDKs use these; any language can.

What an app sends to Controxity. Every call carries the deployment's token:

Authorization: Bearer dep_...

The token stays on your server: it also reads update offers. Never put it in a web page or a mobile app.

Web pages and mobile apps use a browser key (pub_..., under Where it runs). It can only call the two POST routes below, at most 60 times a minute per deployment, and it works from any website. A report sent with it waits for a developer to start the analysis, because anyone can copy the key.

POST /api/v1/signals#

Errors, health and events, as codes and counts.

{
  "version": "1.4.2",
  "signals": [
    {"type": "error", "exception": "TypeError", "count": 3, "where": "api.orders",
     "frames": ["src/orders.js:42:createOrder", "src/routes.js:18:post"]},
    {"type": "health", "code": "database", "ok": false, "severity": "high"},
    {"type": "event", "name": "payment_failed", "count": 2}
  ]
}
TypeFieldsWhat Controxity does
errorexception (required), frames, count, where, codeAdds up per exception and innermost frame. Becomes a code finding the fixer can work on. code (http-403, play-403, timeout, ECONNREFUSED, 23505…) is explained in words when Controxity knows it.
healthcode (required), ok, severity (high, medium, low), reasonok: false raises a finding, ok: true clears it. Each code shows on Today's Health panel, with reason (a short code like play-403) when it fails. Name an outside service in lowercase snake_case: google_play.
eventname (required), countCounted.
checkname (required), held, brokenAn expectation: how many times it held and broke since the last send. Kept by day for 7 days; a broken one's problem says broken 3 of the 1,200 times it was checked.
flagname (required), on, off, errors_on, errors_offA switch: how many times the code asked about it and got on or off, and how many errors happened in requests where it was on or off. Added up; that's how a switch is judged (see GET /api/v1/flags).
versionplatform (required), version (required), countPhones or browsers of that kind seen on that version, with no error. A server relaying for its apps sends it (for example on each API call, with the version the app says it is), so Controxity can tell a fix has reached people, not only that it's in the code: it feeds fixed_in.reach in GET /api/v1/problems. The SDKs: clientVersion(platform, version) / client_version(...), counted and sent once a minute.

An error can carry expect: the name of an expectation that didn't hold (a code like total-not-negative, with "exception": "ExpectationFailed" and the frames of where it was checked). Each name is its own problem.

An error can carry trail: the steps that led to it, oldest first, at most 20, each {"step": "<code>", "ago": <ms before the error>}. A step is letters, digits, spaces and : . / - _ < > { } [ ], up to 100, with no run of 6 digits: route:POST /carts/:id, http:POST stripe.com 402 1204ms, cart.loaded. Others are dropped. Each problem keeps its newest 2 trails.

An error can carry input: the shape of what the failing code was given, never its values. Objects map name-like keys to shapes, an array holds one element shape ([] when empty), and every leaf is a type word: string, "", number, NaN, Infinity, bigint, boolean, null, undefined, date, function, bytes, object, map, set, symbol, circular, more, or up to four of them joined by |. [key] stands for keys that are data, ... for keys left out. Example: {"body": {"items": "undefined", "lines": [{"sku": "string"}]}}. Anything else in it is dropped; at most 6 deep and 150 parts. Each problem keeps its newest 3 different shapes (docs/site/repro.md).

An error can also carry version and component. A server uses them when it relays what its apps sent it, so a phone reports without a key or a store update: each error keeps the app version and part it came from.

A frame is file:line:function, or file:line:column:function for minified code (where everything is on one line), outermost first, with the innermost last. Paths are relative to the app's site or folder. A bundle's own hash in its file name (entry-3f9c2a1b7d.js) is taken out, so one error stays one problem across builds; with the build's source maps (below) each frame is translated back to the code people wrote.

version can be a release number (1.4.2) or the git commit the place runs (3f9c2a1, 3f9c2a1-dirty). With a commit, Controxity asks its copy of the code whether that commit holds a fix's own commit, so a fix shows as running and a problem only reopens on code that has its fix.

Privacy. Only these fields are read. Anything else, such as an error message or a request body, is dropped and never stored. A field that doesn't fit its shape, or looks like a secret, is dropped too. A signal not seen for 7 days falls away.

Limits: 200 signals and 256 KB per call.

Answer: {"accepted": 3, "dropped": 0}. 400 means the body can't be read, 401 an unknown token, 413 too much at once.

An error can also say "platform" (android, ios, huawei, windows, mac, linux, web, server): where it happened, when one place sends for several (a server relaying its apps' crashes). Each problem shows the platforms it was seen on.

Browsers: a share of visitors#

A browser key takes 60 sends a minute. With more visitors than that, only a share of them send, and Controxity finds the share by itself (or a person fixes it: Where it runs → the place's browser key). Each answer to a browser, a refusal (429) too, carries X-Controxity-Sample: <1-100>, the share that sends from now on. A browser outside the share sends nothing; one inside says the share it came from with "sample": 25 in the body, and Controxity counts each of its errors and events for the visitors who didn't send (×4 here). The browser SDK (0.2.0) does all of this.

POST /api/v1/sourcemaps#

A build's source maps, from the deploy, with the place's own key (not a browser key). They're kept by Controxity, never served to anyone, and each error from that build is translated with them as it arrives.

{
  "version": "3f9c2a1",
  "maps": {
    "_expo/static/js/web/entry-3f9c2a1b7d.js": {"version": 3, "sources": ["src/app.tsx"], "names": [], "mappings": "AAAA,..."},
    "index.js": "{\"version\":3,...}"
  }
}

The key of each map is the file's name as the errors' frames give it (a map can be an object or its JSON text). version is the version the errors from that build carry. A bundle whose name has its hash is found without it. Up to 200 MB per call; each app keeps its newest 30 builds.

Answer: {"saved": 2, "refused": {}}. refused names any file that wasn't a source map (version 3, with mappings).

POST /api/v1/release#

CI says a release was made, with the place's own key: {"version": "1.4.2", "commit": "3f9c2a1…", "branch": "main"}. commit is 7 to 40 hex characters; version up to 80 of letters, digits and . + - _ : /. From then on a place reporting that version is known to run that commit, so Controxity asks its copy of the code which fixes it holds. The newest 200 releases per app are kept. controxity release (sdk/js/cli.js, served at /sdk/cli.js) sends it.

Answer: {"ok": true, "version": "1.4.2", "commit": "3f9c2a1…", "branch": "main", "changed": false, "fixes": [{"code": "code:error:…", "text": "…", "version": "1.4.1"}], "fixes_since": "1a2b3c4d5e6f"}. changed: the version was said before with another commit. fixes: what this release carries since the release before it on that branch (fixes_since; with none, the last 30 days): each fix whose version's commit this commit holds and that one doesn't. null, with fixes_why, when Controxity's copy of the code doesn't have the commit yet.

POST /api/v1/heartbeat#

A server saying it's alive. Send one every every seconds (the SDKs: 60) when there's nothing else to send; signals count as a sign of life too. Only a server key: a browser's send key gets 401.

{"version": "1.4.2", "every": 60}

No heartbeat for 3 times every (at least 3 minutes): the place is down, and the people on the app are told; the next heartbeat makes it up again. {"stopping": true} says it's shutting down on purpose: no outage is counted, and the next heartbeat makes it up. Answer: {"ok": true}.

POST /api/v1/bugs#

What a person reported. They wrote this themselves, so it's kept as written.

{"title": "Booking failed", "what": "It spun for ever", "expected": "A confirmation", "steps": "Book, then pay", "version": "1.4.2"}

title or what is required, up to 64 KB. Answer: {"id": "bug-...", "state": "new"}.

GET /api/v1/bugs?ids=bug-1,bug-2#

Where those reports stand, for showing the reporter.

GET /api/v1/problems#

Where this app's errors and crashes stand, so the app's own server can show what happened next to each one (for example next to a phone's crash report in its admin page). Any app's key works, and each sees only its own app.

{"version": "1.0.4", "problems": [{"code": "code:error:apperror-app-screen-tsx-3-post", "exception": "AppError",
  "component": "mobile", "channel": "production", "platforms": ["android"], "frame": "app/screen.tsx:3:post", "where": "",
  "count": 2, "last": 1794150000.0, "state": "fixed", "note": "", "by": "Controxity", "at": 1794160000.0, "until": 0,
  "fixed_in": {"version": "1.0.4", "text": "The app no longer reports leaving mid-post as a crash.", "at": 1794160000.0},
  "versions": {"1.0.3": 2}, "after_fix": {"1.0.3": "before"}}]}

The SDKs: await controxity.problems() (Node.js) or controxity.problems() (Python); problemFor(list, report) / problem_for(list, error) finds the one an error is part of.

GET /api/v1/flags#

The switches (feature flags) people set for this place's product and channel: {"flags": {"new-checkout": {"on": true, "percent": 25}}, "every": 60}. A switch not listed was never set: the code's own default holds (off). percent is the share of uses that get it on (0 to 100); give the same answer to the same user each time (the SDKs hash the switch's name and an id of your choice). Ask about once a minute, and keep the last answer when Controxity can't be reached. A switch that's on turns itself off (unless a lead said it may not) when errors are plainly worse where it's on: more than twice the error rate of where it's off, and at least 1 in 100 more, with at least 10 errors and 50 uses. docs/site/flags.md.

GET /api/v1/rollouts#

For the app's own server when it serves its phones their over-the-air updates. A kind of phone set to roll out in stages (Places → Roll out in stages) is listed with the version, the share of phones that get it, and the version the rest stay on. A kind of phone not listed: every phone gets the newest. Ask about once a minute.

{"rollouts": [{"platform": "android", "version": "0.1.15", "percent": 10, "state": "rolling", "previous": "0.1.14"}]}

state is rolling, paused (stays at its share), halted (it looked worse: stays at its share until someone resumes it), stopped (percent is 0: no more phones get it; phones that have it keep it) or done (percent 100). Give the update to the same phones each time: the JS SDK's inRollout(rollout, installId) places each phone at 0–99 from a hash of the version and its install id.

Updates posted to your app (App settings → Your app's own dashboard)#

Instead of asking, your app's server can be told. Give Controxity an https address; it posts there, at most once a minute, whenever a problem is new, fixed, comes back, is ignored, or its fix reaches more places:

{"event": "problems", "app": "Voxity", "version": "0.1.4", "changed": [ /* each problem as GET /api/v1/problems gives it */ ]}

Each post carries X-Controxity-Signature: sha256=<HMAC-SHA256 of the raw body with the secret> (the secret is shown once, when updates are turned on). Check it before trusting the post: controxity.verifyUpdate(rawBody, signature, secret) (Node.js) or controxity.verify_update(raw_body, signature, secret) (Python). Answer with any 2xx; a post that doesn't arrive is sent again with the next change. "Send a test" posts {"event": "test", "changed": []}.

Controxity 1.132.0These pages are in the repository: docs/site