# Operations and trust — the concept

Vectros is the secure data, document, search, and AI back-end that applications are
built on. Once your application is in production, three operational concerns move to the
foreground: **knowing what happened** (webhooks and the activity log), **knowing what it
costs** (usage and billing), and **being able to take data back out or tear it down**
(teardown and erasure). This area covers those concerns and the trust posture that
underpins them.

The companion document, [compliance.md](compliance.md), goes deeper on the trust story —
the way sensitive data is handled, how history is retained, how tenants are isolated, and
an account of what the platform does *not* do. This page is the mental model;
the [how-to guide](how-to.md) shows the runnable calls; the [reference](reference.md) is
the exhaustive field-and-limit catalog.

## The shape of the operational surface

Everything in this area is reached through the **developer portal API** (`/developer/*`,
the self-serve console surface) or the **Vectros API** (`/v1/*`, the application data
plane). The Node SDK groups these calls under sub-clients by area —
`client.auth.getUsage()`, `client.auth.getAdminLogs()` — and the developer portal exposes
the same operations through a console UI for the human-in-the-loop cases (signing the
agreement, registering a webhook, watching usage).

One thing worth knowing up front, because it applies to every call on the API: a
request can carry a `Vectros-Version` header to pin the exact shape of the response it gets
back (fields, envelope, pagination, error bodies). It is entirely opt-in — omit it and
nothing changes — and it never affects behavior, only shape; see
[reference.md](reference.md#response-versioning-vectros-version) for the mechanics. The
Node SDK does not send this header, so SDK calls fall back to the calling credential's
own pinned version (or the platform floor) rather than an explicit choice — see
[reference.md](reference.md#response-versioning-vectros-version) for the exact resolution
order.

Three pillars:

- **Webhooks** let your application *react* to events that happen inside Vectros —
  asynchronously, after the fact, without polling. When a document finishes indexing or a
  record write completes, Vectros signs and POSTs a small envelope to an HTTPS endpoint
  you control.
- **Usage and billing** give you a single, reconcilable view of what your account has
  consumed in the current period: a monthly credit allowance for the data plane and a
  separate pre-paid balance for inference.
- **Teardown and erasure** are about removing data. Per-customer and per-context
  hard-delete is a first-class, implemented operation. End-subject right-to-erasure — the
  controller-driven "erase everything about this one person" workflow — is a separate,
  also implemented operation with documented limits; the distinction matters and is drawn
  explicitly below.

## Webhooks: events, not polling

A webhook in Vectros is a **registered HTTPS endpoint plus a list of event types you care
about**. When something of interest happens, Vectros builds a small JSON envelope,
signs it, and delivers it to your endpoint with at-least-once semantics and a bounded
retry schedule.

The events available today cover the three kinds of asynchronous work the platform does on
your behalf. Most are the indexing pipeline — the moment a document or record finishes (or
fails) indexing:

- `document.indexed` / `document.failed`
- `record.indexed` / `record.failed`

One covers async triggers — automation you declared, running without a request behind it:

- `trigger.failed`

One covers public views — a record's public readability changing:

- `public_view.changed`

That is deliberately a narrow surface: webhooks fire on
the asynchronous work that your synchronous API call kicked off. Indexing is the work that
happens *after* `200 OK` — embedding a document, building its search representation — so a
webhook is how your application learns "that document you ingested two seconds ago is now
searchable" without polling.

Three design choices define the webhook trust model, and each exists for a reason:

1. **Endpoints must live under a verified domain.** You cannot register a webhook URL
   whose hostname you have not proven you control. This closes the door on a malicious or
   careless registration pointing event traffic — which can carry identifiers — at an
   endpoint the registrant does not own.
2. **Every delivery is signed.** Each POST carries an HMAC-SHA256 signature over a
   current timestamp and the body. Your receiver recomputes the signature with the shared
   secret and rejects anything that does not match, or whose timestamp is stale. This is
   how you know a delivery genuinely came from Vectros and was not replayed.
3. **Delivery targets are re-validated at send time.** Even though the domain was verified
   at registration, the destination IP is re-resolved and re-checked immediately before
   every POST, so a DNS record that is flipped to an internal address after registration is
   caught before any bytes leave. This is the anti-SSRF gate, and it is the *real* security
   boundary — registration-time checks exist mostly to give you fast feedback on a bad URL.

Webhook registrations are **per environment**: your live tenant and your test tenant carry
separate registrations, so you can route test-mode events to a staging receiver and
live-mode events to production. The envelope itself carries a `livemode` flag so a single
receiver can tell them apart if you prefer to consolidate.

If your endpoint keeps failing, Vectros retries on a widening backoff and, after a run of
consecutive failures, **auto-disables** the registration so a dead endpoint does not
accumulate an unbounded retry backlog. You re-enable it explicitly once you have fixed the
receiver, which also resets the failure counter. A webhook is also disabled (with
`disabledReason` `domain_unverified`) if its domain stops being verified for your account;
re-verify the domain first, because re-enabling needs a currently verified domain.

## Usage and billing: two axes, one report

Vectros meters usage on **two axes**, and a single usage report shows both:

- **A monthly credit allowance** covers data-plane work — record writes, document
  ingests, searches, reads beyond your plan's included read and data-out allowances,
  the execution time of your trigger scripts, the per-call platform fee of each
  inference call (0.2 credit for a call of up to a minute, then 1 credit per 5 minutes of the
  call's duration), and the platform fees of agent runs (see the [pricing page](../pricing.md)).
  It resets each calendar month. The report
  tells you how much of the period's allowance you have consumed.
- **A pre-paid inference balance** covers AI calls (chat, RAG, and document-ask) and the model
  calls of agent runs. It is a
  ledger, denominated in milli-cents (thousandths of a cent), that draws down as you make inference calls on a
  balance-billed account and is topped up out of band. It does not reset monthly the way the credit allowance does. An inference
  call made against an exhausted balance is refused with a `402` carrying
  `errorCode: "INSUFFICIENT_BALANCE"` — branch on the `errorCode`, not the message text, and
  distinguish it from `SUBSCRIPTION_LIMIT_EXCEEDED` (a plan cap rather than an empty ledger). A
  call whose balance step could not complete for another reason is not a shortage and is not a `402`:
  `429` with `errorCode: "BALANCE_BUSY"` means your balance was momentarily busy with other concurrent
  requests of yours, and `503` with `errorCode: "BALANCE_UNAVAILABLE"` means a temporary service fault
  interrupted the step; both carry `Retry-After`, so retry after that many seconds rather than topping up.
  The two meet at the per-call platform fee: it counts against the monthly credit allowance, so
  an inference call is also refused with `SUBSCRIPTION_LIMIT_EXCEEDED` once that allowance is
  used up, whatever the balance (a call routed to your own provider skips that check).

Keeping these separate is intentional: data-plane work and model inference have very
different cost structures, and conflating them into one number would make neither legible.
The usage report keeps them in distinct sections so you can reason about each.

The report is also **broken down per environment**. Your account-level totals are the sum
of your live tenant and your test tenant, each reported separately — so you can see what
production is costing versus what your test traffic is costing, and the two reconcile up to
the account total, for a credential with cross-context reach. **A credential confined to a
single app context sees only that context's usage** — its totals narrow to the one context,
and the environment it isn't bound to reads `null` rather than the other environment's real
figures; see [reference.md](reference.md#getusage--the-report) for the exact contract and
its two narrower exceptions.

A subtle but important property: **plain `GET` reads are exempt from the per-tenant business
rate limit, and within your plan's included read and data-out allowances reads draw nothing from
the monthly credit allowance.** Past those allowances, read and data-out overage does draw it, and
so does script execution time, whether a trigger fired the script or you called `POST /v1/scripts/execute` — see the [pricing page](../pricing.md) for the model and
[reference.md](reference.md#usage-and-billing) for the exact fields. Metering is keyed at the
account and tenant level and ticks as operations dispatch, so the counts you read are
near-real-time, eventually consistent with in-flight settlement.

**Trigger scripts add a charge that is not proportional to what you stored or fetched.** A
script runs your code for a variable span while everything else is priced per operation, so
execution time is metered on its own: each billable operation your script performs includes
execution time paid for by the fee that operation already charged, each execution carries a
small fixed platform baseline, and you are charged only for the span beyond what your
operations included. The report publishes every term so you can check the arithmetic
yourself.

Access to the usage report is itself scoped. A token needs the `billing:r` permission to
read it; a token without that permission is rejected. This means you can hand a read-only
billing view to an internal dashboard without granting it any data access.

## Teardown and erasure: two different operations

This is the distinction the rest of the platform's trust story rests on, so it gets stated
plainly.

**Per-customer / per-context hard-delete is implemented and is a real operation.** When you
delete a context (the isolation boundary that holds one customer's or one application's
records, documents, folders, and schemas), the platform runs an owner-filtered cascade that
removes the data under that boundary. Tenant-level teardown — decommissioning an entire
test or live tenant — is likewise a first-class lifecycle operation. If you need to remove
*a whole customer's footprint* because they have offboarded, this is the mechanism, and it
works today. A tenant teardown reports complete once no data of the tenant is accessible, not
once every copy is physically gone: the tenant's search documents can remain in the search
index storage, typically for about a week and at most 30 days afterwards (the Vectros API does not return them), and
recovery copies are a further bounded residual. The
[compliance guide](compliance.md#tenant-and-context-isolation) states both.

**End-subject right-to-erasure is a separate thing, and it is bounded.** The "erase
everything about this one individual across the account" workflow — the
data-controller obligation under privacy regimes — runs as an asynchronous request. You name the contexts to sweep (or omit them to sweep every
context in your account). The subject's identity is account-wide, so it is deleted only when
the request covers every context; a request that names only some contexts erases those and
keeps the identity, and the certificate says so (`identityRetained`). It returns a certificate
of what was deleted, what was retained because another owner shares it, and a count of
references to the subject. It requires your root account credential, never a
scoped one, because erasure is irreversible. It has limits you should evaluate for your
obligations, listed in the [reference](reference.md) and the [compliance guide](compliance.md):
audit-history `purge` is supported for user, org and client subjects, deletes the stored audit
payloads asynchronously, and does not consult your compliance-retention setting, and the count of
remaining references only sees schema `reference` fields that have a reverse index.

Do not conflate the two. "We can delete a customer's context" is a decommissioning
operation. Per-individual erasure is a different operation with a different scope, and a
data export endpoint is reserved and returns `501` today.

## How this fits the rest of the platform

The operational surface sits on top of the same isolation and access primitives the data
plane uses. Webhook registrations, usage records, and teardown are all **tenant-scoped**:
there is no request shape that lets you read another tenant's deliveries, another tenant's
usage, or trigger another tenant's teardown. The activity log derives the tenant from your
credential, not from a request parameter — there is simply no input channel to point it at
someone else's tenant.

The deeper trust mechanisms — how sensitive fields are destroyed before they are persisted,
how audit and version history are retained, how the edge is hardened — are the subject of
[compliance.md](compliance.md). Read that next if you are evaluating Vectros for a regulated
workload.

## Where to go next

- [how-to.md](how-to.md) — register and verify a webhook against a synthetic endpoint, and
  read your usage report, with runnable calls.
- [reference.md](reference.md) — the exhaustive field, limit, envelope, and error catalog
  for webhooks, usage, the activity log, and teardown.
- [compliance.md](compliance.md) — the full trust posture: the three sensitive-data
  mechanisms, audit and version retention, tenant isolation, edge security, and a
  list of what is reserved or not covered.
