Every API here is available over the APIs.io API and to AI agents over MCP.
openapi: 3.2.0
info:
title: VITNA API (Phase 1) Owner API
version: 1.1.0
description: 'The compliance evidence layer for AI agents. Pre-flight compliance checks agents call before they act (consent, breach reportability, EU AI Act classification, cross-border), and audit-grade, signed records of what they did. Phase 1 surface covers region routing labels (one database region is in use today), DPIA/ROPA generation, Data Subject Rights (scoped: answerable only for events linked to a subject via principal_ref at ingest, from the point linkage begins; earlier events are permanently unattributable and cannot be linked retroactively), consent lifecycle, Sahamati AA integration, breach notification, and INR/Razorpay billing for DPDP-IN owners (switched off pending merchant onboarding). Also includes one-command agent self-provisioning (/api/setup, mints a restricted trial key with no signup), a destructive-action safety pre-flight (/api/preflight/action-check), scoped engagement sessions with signed evidence bundles (/api/engagement/*), and account claim by a person, from the claim link (/claim).'
contact:
name: COSTRINITY
email: dpo@costrinity.xyz
url: https://www.costrinity.xyz/
license:
name: Proprietary
url: https://vitna.costrinity.xyz/terms
servers:
- url: https://vitna.costrinity.xyz
description: Production
- url: https://vigil-staging.vercel.app
description: Staging (preview branch)
tags:
- name: owner
paths:
/api/owners/notification-prefs/test:
post:
summary: Fire a synthetic notification to verify operator's configured channel works
description: 'Signed-in owner only. A request carrying an API key (x-vitna-key, x-vigil-key, x-api-key or Authorization: Bearer, a restricted trial key included) is refused 403 session_required before anything is sent: the test posts to the owner''s channels and reports where it sent. Its email goes where real copies go, the account address the owner confirmed with an emailed code, never a channel''s own email field; with no confirmed address the email entry says why it was not sent (since 2026-10-29: the test mailed whatever address had been typed into the channel). One test a minute for each channel, counted on each server instance (429 test_paced with retry_after_seconds); a test with nothing to send (no confirmed address or email notices off, and no webhook) is not counted.'
tags:
- owner
security:
- Session: []
responses:
'200':
description: Dispatched
'403':
description: 'session_required: an API key cannot run the test'
'429':
description: 'test_paced: this channel sent a test less than a minute ago; retry_after_seconds says how long to wait'
operationId: postApiOwnersNotificationPrefsTest
x-operation-id-source: derived
/api/owners/grievance-officer:
get:
summary: Read operator's Grievance Officer config (DPDP §9)
description: 'Signed-in owner: the officer as stored, or fallback_email (the account address) while none is set. API key: officer_configured and officer_label only, never the officer''s name, address or phone and never the account address.'
tags:
- owner
security:
- Session: []
- ApiKey: []
- Bearer: []
responses:
'200':
description: Officer config or null (session); officer_configured (API key)
operationId: getApiOwnersGrievanceOfficer
x-operation-id-source: derived
post:
summary: Set operator's Grievance Officer (DPDP §9 / LGPD Art 41)
description: 'Signed-in owner: always. API key: only while no officer is set; once one is set, a key is refused 403 session_required, so an agent can designate the first officer but never replace the owner''s choice.'
tags:
- owner
security:
- Session: []
- ApiKey: []
- Bearer: []
responses:
'200':
description: Recorded
'403':
description: 'session_required: an officer is already set and only the signed-in owner can replace it'
operationId: postApiOwnersGrievanceOfficer
x-operation-id-source: derived
/api/owners:
post:
summary: Sign in with an email address and password (step 1 of 2), or sign up…
description: 'Since 2026-11-02 the right password signs nobody in by itself: VITNA emails a 6-digit code to the address, sets the HttpOnly cookie vitna_signin (10 minutes) and answers {second_step:{factor:''email_code''}}; POST /api/auth/verify-pin with the code finishes the sign-in. An unknown address, a wrong password, an account with no password, a placeholder address and an unclaimed trial all get the same 401 after the same single bcrypt compare. Only after the right password does an answer say anything about the code: 403 second_step_unavailable when no code can be emailed to the address, 429 code_send_limit (3 codes per 15 minutes, 10 a day), which still sets vitna_signin and names second_step, so the newest code already emailed can be entered. While VITNA''s mail cannot reach Gmail, an address whose mail Google handles (Gmail or a Google Workspace domain) signs in with its password alone and gets {owner} and the session cookie here; a Workspace domain is told by its MX records (a DNS error or a timeout asks for the code). A temporary password answers {password_change_required: true} with a one-hour session for /api/auth/set-password only. Sign-up (mode signup) takes a password of at least 12 characters and takes the same second step, which also confirms the address.'
tags:
- owner
requestBody:
required: true
content:
application/json:
schema:
type: object
required:
- email
- password
properties:
email:
type: string
password:
type: string
mode:
type: string
enum:
- signin
- signup
description: signin when omitted.
name:
type: string
description: Sign-up only.
responses:
'200':
description: '{second_step:{factor:''email_code''}} with the vitna_signin cookie; or {owner} with the session cookie (mail Google handles); or {password_change_required:true}'
'201':
description: 'Sign-up: {second_step:{factor:''email_code''}} with the vitna_signin cookie, or {owner} with the session cookie (mail Google handles)'
'400':
description: Email and password required; on sign-up, a password that breaks the rules for a new one, or an address no code can reach
'401':
description: Incorrect email or password. (one answer for every refusal before the right password), or temp_password_expired
'403':
description: 'second_step_unavailable: the password is right but no sign-in code can be emailed to the address'
'409':
description: 'Sign-up: an account with this email already exists'
'429':
description: 'Too many sign-in attempts, or code_send_limit (after the right password: with second_step and the vitna_signin cookie, no new code sent)'
'503':
description: signin_unavailable or code_not_sent
operationId: postApiOwners
x-operation-id-source: derived
/api/owners/delete-account:
post:
summary: Full operator account deletion (DPDP §12 / GDPR Art 17)
description: 'Signed-in owner only, with confirm: true in the body. A request carrying an API key (any header form, a restricted trial key included, even beside a session cookie) is refused 403 session_required and deletes nothing.'
tags:
- owner
security:
- Session: []
responses:
'200':
description: Deleted
'400':
description: 'confirm: true required'
'401':
description: 'session_required: no signed-in session'
'403':
description: 'session_required: the request carried an API key. Or the owner_id is not the signed-in owner'
operationId: postApiOwnersDeleteAccount
x-operation-id-source: derived
/api/owners/detection-settings:
get:
summary: Read the owner's detection settings (which checks are on, block / warn /…
description: 'Signed-in owner only (since 2026-11-01). With an API key (x-vitna-key, x-vigil-key, x-api-key or Authorization: Bearer, a restricted trial key included, even beside a session cookie) it is refused 403 session_required before anything is read: the settings say which checks only warn or log, which would tell an agent what VITNA will not block. Defaults when never saved.'
tags:
- owner
security:
- Session: []
parameters:
- name: owner_id
in: query
schema:
type: string
format: uuid
responses:
'200':
description: '{settings}'
'401':
description: 'Unauthorized: no signed-in session, or owner_id names another account'
'403':
description: 'session_required: the request carried an API key'
operationId: getApiOwnersDetectionSettings
x-operation-id-source: derived
put:
summary: Change the owner's detection settings (signed-in owner only)
description: 'Signed-in owner only, from the signed-in browser. With an API key (x-vitna-key, x-vigil-key, x-api-key or Authorization: Bearer, a restricted trial key included, even beside a session cookie) it is refused 403 session_required and nothing is saved, because a key that could set a check to log_only or turn recording off would switch off the checks on itself and on every other agent on the account. Before 2026-10-05 any key of the owner could change them.'
tags:
- owner
security:
- Session: []
parameters:
- name: owner_id
in: query
schema:
type: string
format: uuid
requestBody:
content:
application/json:
schema:
type: object
properties:
checks:
type: object
additionalProperties:
type: boolean
actions:
type: object
additionalProperties:
type: string
enum:
- block
- warn
- log_only
default_action:
type: string
enum:
- block
- warn
- log_only
audit:
type: object
properties:
record_allowed:
type: boolean
record_blocked:
type: boolean
responses:
'200':
description: '{settings} as saved, after validation'
'401':
description: 'forbidden: no signed-in session, or the owner_id is not the signed-in owner'
'403':
description: 'session_required: the request carried an API key'
operationId: putApiOwnersDetectionSettings
x-operation-id-source: derived
/api/owners/enforcement:
get:
summary: 'Read the account''s enforcement mode: enforce, or shadow (evaluate and record…'
description: 'Signed-in owner only. With an API key (x-vitna-key, x-vigil-key, x-api-key or Authorization: Bearer, a restricted trial key included, even beside a session cookie) it is refused 403 session_required: an agent that could read the mode would learn, without making a call, that VITNA answers allow to what it would block or hold. (A shadowed answer says so, as do the records a key can read once a call has been shadowed.) since is when the current mode was switched on, null for an account never switched (enforcing).'
tags:
- owner
security:
- Session: []
parameters:
- name: owner_id
in: query
schema:
type: string
format: uuid
responses:
'200':
description: '{mode: "enforce"|"shadow", since}'
'401':
description: 'forbidden: no signed-in session, or the owner_id is not the signed-in owner'
'403':
description: 'session_required: the request carried an API key'
'503':
description: mode_read_failed
operationId: getApiOwnersEnforcement
x-operation-id-source: derived
put:
summary: Switch the account between enforcing and shadow mode (signed-in owner only)
description: 'Signed-in owner only, from the signed-in browser. With an API key (x-vitna-key, x-vigil-key, x-api-key or Authorization: Bearer, a restricted trial key included, even beside a session cookie) it is refused 403 session_required before the body is read, because a key that could turn on shadow mode would switch off its own containment. Switching to shadow also needs a sign-in within the last 10 minutes (403 reauth_required otherwise); switching back to enforcing never does. One switch covers every agent and session on the account. In shadow mode POST /api/engagement/action and POST /api/preflight/action-check evaluate every call as when enforcing, record the verdict (on the preflight, unless detection settings turn off recording of flagged checks) with its reason marked "shadow, not enforced: ", and answer allow (allowed) with shadow.would_have, so guards and SDKs forward the call; no hold opens and no hold or block alert is sent, while a burst still raises the rate alert. Bait is denied and alerted in either mode. The switch is one row in VITNA''s security log (kind enforcement_mode_changed, with from, to, IP address and user agent; not listed by GET /api/audit-log), timed by the database; when it cannot be written, nothing changed. Each switch is posted to the owner''s alert webhook, where one is set, as an enforcement_mode_changed event with no address in it, and, once product mail is live, emailed to the account''s address, if the owner confirmed it with an emailed code and email notices are on, with the IP address it came from. GET /api/webhooks/compliance/deliveries lists these notices to the signed-in owner only: since 2026-11-01 it refuses an agent''s key outright (403 session_required).'
tags:
- owner
security:
- Session: []
parameters:
- name: owner_id
in: query
schema:
type: string
format: uuid
requestBody:
required: true
content:
application/json:
schema:
type: object
required:
- mode
properties:
mode:
type: string
enum:
- enforce
- shadow
responses:
'200':
description: '{mode, since, changed}, as read back after the switch (the requested mode with since null when that read fails); changed is false when the account was already in that mode, and nothing is written'
'400':
description: mode must be 'enforce' or 'shadow'
'401':
description: 'forbidden: no signed-in session, or the owner_id is not the signed-in owner'
'403':
description: 'session_required: the request carried an API key. reauth_required: switching to shadow needs a sign-in within the last 10 minutes'
'503':
description: 'mode_read_failed or audit_write_failed: the mode was not changed'
operationId: putApiOwnersEnforcement
x-operation-id-source: derived
/api/owners/notification-prefs:
get:
summary: Read operator notification preferences
description: 'Signed-in owner: each channel''s email and webhook_url, defaults_from_owner_email, account_email_proved (whether the account address was confirmed with an emailed code: alert, breach and grievance copies and the test email go only to such an address, never to a channel''s email), last_test_at and email_off. API key: view "api_key" with only webhook_configured and email_configured per channel, last_test_at and email_off; no webhook URL and no email address, the account''s included.'
tags:
- owner
security:
- Session: []
- ApiKey: []
- Bearer: []
responses:
'200':
description: OK
operationId: getApiOwnersNotificationPrefs
x-operation-id-source: derived
post:
summary: Update operator notification preferences (signed-in owner only)
description: 'Only the signed-in owner sets the alert channel, the breach and grievance channels and email_off; the dashboard''s Alert settings, Breach alerts and Grievance alerts forms use this. A request carrying an API key (any header form, a restricted trial key included, even beside a session cookie) is refused 403 session_required and writes nothing. An agent that wants its own copy of its alerts opens its session with webhook_url on /api/engagement/open: alerts then go to the owner''s channel and that URL. Merges field by field: a channel left out is kept; in a channel that is sent, a field that is sent replaces that field, a field left out is kept, and null or "" clears it; a channel sent as null is cleared; email_off left out is kept. webhook_url must be a public https URL (the same SSRF rules as /api/engagement/open).'
tags:
- owner
security:
- Session: []
requestBody:
content:
application/json:
schema:
type: object
properties:
alert:
type:
- object
- 'null'
properties:
email:
type:
- string
- 'null'
webhook_url:
type:
- string
- 'null'
breach:
type:
- object
- 'null'
properties:
email:
type:
- string
- 'null'
webhook_url:
type:
- string
- 'null'
grievance:
type:
- object
- 'null'
properties:
email:
type:
- string
- 'null'
webhook_url:
type:
- string
- 'null'
email_off:
type: boolean
description: true stops every email notice to the owner. Webhooks and the dashboard are unaffected, and so is the sign-in code emailed after the password (it is a step of signing in, not a notice).
responses:
'200':
description: '{ok, owner_id, prefs} (the stored prefs after the merge)'
'400':
description: A webhook_url that is not a public https URL, a malformed email, a non-boolean email_off or a channel that is not an object or null. Nothing is written.
'401':
description: No session
'403':
description: 'session_required: an API key cannot change notification settings'
operationId: postApiOwnersNotificationPrefs
x-operation-id-source: derived
components:
securitySchemes:
ApiKey:
type: apiKey
in: header
name: x-vigil-key
description: 'Per-agent API key. Format: vitna_<64-char-hex>; legacy vigil_ keys remain valid. Send on /api/ingest.'
Bearer:
type: http
scheme: bearer
bearerFormat: vitna_<key> (legacy vigil_<key> accepted)
description: 'Same key as x-vigil-key, sent as `Authorization: Bearer <key>`.'
Session:
type: apiKey
in: cookie
name: vigil_session
description: 'Operator dashboard session cookie. Set by a sign-in: the second step of a password sign-in (/api/auth/verify-pin), or, for an address whose mail Google handles (Gmail or a Google Workspace domain) while VITNA''s mail cannot reach Gmail, the password alone (/api/owners); GitHub; a passkey; or a claim.'
CronSecret:
type: http
scheme: bearer
description: Bearer ${CRON_SECRET}. Only the Vercel cron infrastructure should hold this.