# vrsai SQL Preflight Check

> vrsai SQL Preflight Check is a paid API for AI agents from api.vrsai.tech, paid per call via x402, $0.05/call, status unknown (last checked 2026-10-13).

Analyzes PostgreSQL SQL statements before execution to detect and block destructive or unsafe database operations by AI agents

## Facts

- Endpoint: POST https://api.vrsai.tech/v1/capabilities/sql_preflight?utm_source=zero.xyz
- Price: $0.05/call
- Payment: x402
- Status: unknown
- Last checked: 2026-10-13
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/vrsai-sql-preflight-check-b24456d3
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_KcbjuVjVDyBUCfAn_0yT5

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability vrsai-sql-preflight-check-b24456d3 -d '<json body>'
```

Example prompt: Before you run that DELETE query against the customers table, check it through the SQL preflight validator first — I need to make sure it has a WHERE clause and isn't touching any protected relations.

## When to prefer this

Choose this endpoint when you need a real-time, pre-execution safety gate specifically for PostgreSQL SQL generated or submitted by AI agents or automated systems. It is purpose-built for agentic pipelines where LLM-generated SQL must be validated before touching production data. Prefer it over generic SQL linters when you need machine-actionable ALLOW/BLOCK decisions, reason codes for audit trails, and coverage of AI-specific risks like unbounded deletes, protected table mutations, and multi-statement hazards.

## Known failure modes

- Invalid or unparseable SQL returns a BLOCK with parse_validity FAIL check
- Missing required 'input' body fields returns a 400-class error
- Non-PostgreSQL dialect SQL may not be fully assessed, noted in coverage gaps
- Protected relations not specified means that check is skipped
- Network timeout if the service is unreachable, requiring retry logic

## How this service works

Check PostgreSQL SQL immediately before execution to prevent destructive or unsafe database changes by AI agents and automated systems.

## Output

Returns a structured JSON object with a top-level 'decision' (ALLOW or BLOCK), a 'machine_action' directive (e.g. DO_NOT_EXECUTE), per-statement analysis including kind, relations touched, and reason codes (e.g. DELETE_WITHOUT_WHERE, PROTECTED_RELATION_MUTATION), a list of individual check results with PASS/BLOCK status, coverage metadata showing which checks were performed, and a fingerprint of the input SQL for audit purposes.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "$schema": "https://json-schema.org/draft/2020-12/schema",
 "required": [
  "input"
 ],
 "properties": {
  "input": {
   "type": "object",
   "required": [
    "type",
    "method",
    "bodyType",
    "body"
   ],
   "properties": {
    "body": {
     "type": "object"
    },
    "type": {
     "type": "string",
     "const": "http"
    },
    "method": {
     "enum": [
      "POST"
     ],
     "type": "string"
    },
    "bodyType": {
     "enum": [
      "json",
      "form-data",
      "text"
     ],
     "type": "string"
    }
   },
   "additionalProperties": false
  },
  "output": {
   "type": "object",
   "required": [
    "type"
   ],
   "properties": {
    "type": {
     "type": "string"
    },
    "example": {
     "type": "object"
    }
   }
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "checks": [
   {
    "id": "parse_validity",
    "status": "PASS"
   },
   {
    "id": "statement_count",
    "status": "PASS",
    "evidence": {
     "count": 1
    }
   },
   {
    "id": "unbounded_delete",
    "status": "BLOCK",
    "reason_code": "DELETE_WITHOUT_WHERE",
    "statement_index": 0
   },
   {
    "id": "protected_relation_mutation",
    "status": "BLOCK",
    "evidence": {
     "relations": [
      {
       "name": "customers"
      }
     ]
    },
    "reason_code": "PROTECTED_RELATION_MUTATION",
    "statement_index": 0
   },
   {
    "id": "expected_statement_kind",
    "status": "PASS",
    "statement_index": 0
   }
  ],
  "coverage": {
   "dialect": "postgresql",
   "assessment_scope": [
    "unbounded_delete",
    "unbounded_update",
    "truncate",
    "destructive_drop",
    "destructive_cascade",
    "alter_table_hazards",
    "nonconcurrent_index",
    "create_extension",
    "protected_relation_mutation",
    "dynamic_or_procedural_sql",
    "expected_statement_kind",
    "multi_statement_evaluation"
   ],
   "checks_performed": [
    "unbounded_delete",
    "unbounded_update",
    "truncate",
    "destructive_drop",
    "destructive_cascade",
    "alter_table_hazards",
    "nonconcurrent_index",
    "create_extension",
    "protected_relation_mutation",
    "dynamic_or_procedural_sql",
    "expected_statement_kind",
    "multi_statement_evaluation"
   ],
   "checks_not_performed": [
    "privilege_change",
    "explicit_locking",
    "alter_system",
    "availability_maintenance",
    "external_program_execution",
    "drop_schema_or_database",
    "read_cost_and_row_estimation",
    "sensitive_data_access_and_exfiltration",
    "tenant_isolation",
    "semantic_correctness"
   ],
   "complete_for_declared_scope": true
  },
  "decision": "BLOCK",
  "statements": [
   {
    "kind": "DELETE",
    "index": 0,
    "decision": "BLOCK",
    "relations": [
     {
      "name": "customers"
     }
    ],
    "mutates_data": true,
    "reason_codes": [
     "DELETE_WITHOUT_WHERE",
     "PROTECTED_RELATION_MUTATION"
    ],
    "administrative": false,
    "changes_schema": false,
    "changes_privileges": false
   }
  ],
  "reason_codes": [
   "DELETE_WITHOUT_WHERE",
   "PROTECTED_RELATION_MUTATION"
  ],
  "machine_action": "DO_NOT_EXECUTE",
  "ruleset_version": "1.0.0",
  "statement_count": 1,
  "input_fingerprint": "v1:4634deedb0970b042098df09e6f8bf365f2ddb635a18742c5ffa676844e4fa62"
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/vrsai-sql-preflight-check-b24456d3/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from api.vrsai.tech](https://www.zero.xyz/host/api.vrsai.tech/llms.txt)
