# 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-09-15).

Validates PostgreSQL SQL statements immediately before execution to detect and block destructive or unsafe database operations by AI agents and automated systems.

## Facts

- Endpoint: POST https://api.vrsai.tech/v1/capabilities/sql_preflight/versions/1.0.0/execute
- Price: $0.05/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-15
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/vrsai-sql-preflight-check-f1b3876a
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_5wNWZ3MJezAlKeExlLBWH

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-f1b3876a -d '<json body>'
```

Example prompt: Before you run that DELETE statement on the users table, send it through the vrsai SQL preflight check to make sure it won't cause any destructive or unintended changes to our PostgreSQL database.

## When to prefer this

Choose this endpoint when you need a real-time, pre-execution safety gate specifically for PostgreSQL SQL in agentic or automated pipelines. It is ideal when AI agents are generating or executing SQL autonomously and human review is not feasible before every query. Prefer it over generic SQL linters when you need a decision-ready approve/block signal rather than style feedback, and especially when the risk of data loss or destructive operations from AI-generated queries is a primary concern.

## Known failure modes

- Malformed SQL input may return a parse error or rejection
- Non-PostgreSQL SQL dialects may not be accurately assessed
- Payment failure (402) if USDC balance is insufficient
- Schema validation error if required body fields are missing or incorrectly typed
- Network timeout if the API is temporarily unreachable
- False negatives on highly obfuscated or dynamically constructed SQL strings

## How this service works

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

## Output

The endpoint returns a safety assessment of the submitted SQL statement, indicating whether it is safe to execute or should be blocked, along with identified risk flags such as destructive operations (DROP, TRUNCATE, DELETE without WHERE), unscoped bulk modifications, or other unsafe patterns that could cause data loss or unintended state changes.

## 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-f1b3876a/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)
