Introduction
Base URL, authentication, and conventions for the Vectoral API.
The Vectoral API is JSON over HTTPS.
https://api.vectoral.cloud
Self-hosted deployments use your own base URL (default bind :8080).
Authentication
Every /v1 endpoint but one authenticates with your secret key as a bearer token:
Authorization: Bearer vg_live_xxx
Keys are vg_live_ followed by 43 base64url characters, and are shown once at creation —
only a hash is stored. The key resolves server-side to your customer, and everything is
scoped to that customer; there is no way to address another tenant's data.
Auth failures return 401 with the standard error envelope:
| Cause | Body |
|---|---|
No Authorization header, wrong scheme, or not a vg_live_ key |
{"error": "missing or malformed Authorization: Bearer <api key>"} |
| Unknown, expired, or revoked key | {"error": "invalid, expired, or revoked api key"} |
The one exception is the public browser endpoint
/v1/sensor/collect, which authenticates with your
publishable site key (pk_live_…) carried in the request body — so it can be
called directly from the browser.
Errors
Errors use a uniform envelope with the appropriate HTTP status:
{ "error": "account_id required" }
The message string is for humans and is not stable — branch on the status code, not the text.
| Status | Meaning |
|---|---|
400 |
Malformed request — invalid JSON, a body over the size cap, or a query parameter outside its allowed values |
401 |
Missing / malformed / invalid / expired / revoked key |
403 |
Key valid but not permitted — today only /v1/sensor/verify, for a token minted for another customer |
404 |
No such resource (e.g. an unknown account on account detail), or a route not enabled on this deployment |
500 |
Server error |
Fail-open scoring
/v1/score fails open: internal failures on our side don't
turn into errors for you. A signal that can't be computed is scored as missing, a failed
write still returns the verdict, and if scoring is unavailable you get a 200 with tier
low and reason scoring_unavailable — so a Vectoral problem never blocks your users. The
read endpoints and telemetry writes don't fail open: they return 500 and are safe to
retry (with event_id on writes).
Idempotency
Every write endpoint — /v1/score,
/v1/events/post-call,
/v1/identity, and /v1/labels —
accepts an optional event_id. Send one and a repeat of the same
(customer, event_id) writes nothing:
/v1/scorereplays the original verdict, unchanged, withduplicate: true.- The telemetry endpoints return
{ "ok": true, "duplicate": true }. Spend is not double-counted and reputation is not re-accrued.
This makes retries safe, which matters most on post-call telemetry — a retried cost event would otherwise inflate the account's spend history.
duplicate is omitted when false, so a caller that doesn't send event_id sees exactly
the responses it always did.
Conventions
- Body cap: 1 MiB per request; a larger body is a
400./v1/importis the one exception at 8 MiB. - Timestamps are RFC 3339; server-generated ones are UTC.
- Pagination on the list endpoints is offset-based:
limit(default 50, clamped to 200) andoffset, with atotalof all matches in the response. - Additive changes. Fields may be added to
/v1without notice — ignore ones you don't recognise. Renames, removals, and enum changes ship under a new prefix (/v2). GET /healthzis unauthenticated, for load balancers and uptime checks. It returns200with{"ok": true, "version": "…"}(pluscommitwhen known) while the database is reachable, and503with a plain-textdb unreachablewhen it isn't.