{"openapi":"3.1.0","info":{"title":"SQL Read-Only Guard and Analyzer API","version":"1.0.0","description":"Inspect, normalize, compare, and extract bounded SQL structure, or enforce an explicit read-only policy for agent-generated queries. SQL is parsed with a caller-selected dialect but is never executed, connected to a database, or resolved against a live schema. A CLEAR result is static policy evidence, not a substitute for a read-only database identity, parameter binding, row-level authorization, query timeout, or database-native resource limits."},"paths":{"/marketplace/rapid/sql/v1/inspect":{"post":{"tags":["SQL Inspect"],"summary":"Inspect SQL structure","description":"Parse bounded SQL under an explicit dialect and return statement, table, column, function, limit, lock, and write-candidate evidence without executing it.","operationId":"inspectSql","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SQLTextRequest"},"examples":{"example":{"summary":"Inspect SQL structure","value":{"sql":"SELECT id, email FROM app.users WHERE status = 'active' LIMIT 100","dialect":"postgres"}}}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SQLInspectResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/marketplace/rapid/sql/v1/normalize":{"post":{"tags":["SQL Normalize"],"summary":"Normalize SQL","description":"Format SQL and return deterministic hashes and a structure fingerprint. Comments are preserved on a best-effort basis; SQL is never executed.","operationId":"normalizeSql","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SQLNormalizeRequest"},"examples":{"example":{"summary":"Normalize SQL","value":{"sql":"select ID, email from app.users where status='active' limit 100","dialect":"postgres","pretty":true,"normalize_identifiers":true}}}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SQLNormalizeResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/marketplace/rapid/sql/v1/policy-check":{"post":{"tags":["SQL Read-Only Policy"],"summary":"Check read-only SQL policy","description":"Block writes, commands, locks, SELECT INTO, unbounded reads, wildcard projections, denied tables, system catalogs, and denied functions under an explicit policy.","operationId":"checkSqlReadOnlyPolicy","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SQLPolicyRequest"},"examples":{"example":{"summary":"Check read-only SQL policy","value":{"sql":"SELECT id, email FROM app.users WHERE status = 'active' LIMIT 100","dialect":"postgres","require_limit":true,"max_limit":500,"allow_select_star":false,"require_table_allowlist":true,"allowed_tables":["app.users"]}}}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SQLPolicyResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/marketplace/rapid/sql/v1/dependencies":{"post":{"tags":["SQL Dependency Extract"],"summary":"Extract SQL dependencies","description":"Return syntactic relations, CTEs, columns, functions, and projections without connecting to a schema or claiming column lineage.","operationId":"extractSqlDependencies","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SQLTextRequest"},"examples":{"example":{"summary":"Extract SQL dependencies","value":{"sql":"WITH recent AS (SELECT customer_id, total FROM sales.orders WHERE created_at >= DATE '2026-08-01') SELECT customer_id, SUM(total) AS revenue FROM recent GROUP BY customer_id LIMIT 100","dialect":"postgres"}}}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SQLDependenciesResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/marketplace/rapid/sql/v1/compare":{"post":{"tags":["SQL Structure Compare"],"summary":"Compare SQL structure","description":"Compare one statement on each side after deterministic dialect-aware normalization. This does not claim semantic equivalence.","operationId":"compareSqlStructure","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SQLCompareRequest"},"examples":{"example":{"summary":"Compare SQL structure","value":{"left_sql":"select ID from app.users where active=true limit 10","right_sql":"SELECT id FROM app.users WHERE active = TRUE LIMIT 10","dialect":"postgres"}}}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SQLCompareResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}},"components":{"schemas":{"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"SQLCompareRequest":{"properties":{"left_sql":{"type":"string","maxLength":131072,"minLength":1,"title":"Left Sql"},"right_sql":{"type":"string","maxLength":131072,"minLength":1,"title":"Right Sql"},"dialect":{"type":"string","enum":["generic","postgres","mysql","sqlite","bigquery","snowflake","redshift","duckdb","spark","databricks","trino","tsql","oracle"],"title":"Dialect"}},"additionalProperties":false,"type":"object","required":["left_sql","right_sql","dialect"],"title":"SQLCompareRequest"},"SQLCompareResponse":{"properties":{"status":{"type":"string","const":"COMPLETED","title":"Status","default":"COMPLETED"},"decision":{"type":"string","enum":["CLEAR","REVIEW_REQUIRED","BLOCKED"],"title":"Decision"},"dialect":{"type":"string","enum":["generic","postgres","mysql","sqlite","bigquery","snowflake","redshift","duckdb","spark","databricks","trino","tsql","oracle"],"title":"Dialect"},"exact_text_match":{"type":"boolean","title":"Exact Text Match"},"normalized_text_match":{"type":"boolean","title":"Normalized Text Match"},"structural_fingerprint_match":{"type":"boolean","title":"Structural Fingerprint Match"},"left_normalized_sql":{"type":"string","title":"Left Normalized Sql"},"right_normalized_sql":{"type":"string","title":"Right Normalized Sql"},"left_structural_fingerprint":{"type":"string","title":"Left Structural Fingerprint"},"right_structural_fingerprint":{"type":"string","title":"Right Structural Fingerprint"},"added_tables":{"items":{"type":"string"},"type":"array","title":"Added Tables"},"removed_tables":{"items":{"type":"string"},"type":"array","title":"Removed Tables"},"added_functions":{"items":{"type":"string"},"type":"array","title":"Added Functions"},"removed_functions":{"items":{"type":"string"},"type":"array","title":"Removed Functions"},"statement_type_changed":{"type":"boolean","title":"Statement Type Changed"},"semantic_equivalence_claimed":{"type":"boolean","const":false,"title":"Semantic Equivalence Claimed","default":false},"query_executed":{"type":"boolean","const":false,"title":"Query Executed","default":false},"payload_stored":{"type":"boolean","const":false,"title":"Payload Stored","default":false},"next_action":{"type":"string","title":"Next Action"}},"additionalProperties":false,"type":"object","required":["decision","dialect","exact_text_match","normalized_text_match","structural_fingerprint_match","left_normalized_sql","right_normalized_sql","left_structural_fingerprint","right_structural_fingerprint","added_tables","removed_tables","added_functions","removed_functions","statement_type_changed","next_action"],"title":"SQLCompareResponse"},"SQLDependenciesResponse":{"properties":{"status":{"type":"string","const":"COMPLETED","title":"Status","default":"COMPLETED"},"decision":{"type":"string","enum":["CLEAR","REVIEW_REQUIRED","BLOCKED"],"title":"Decision"},"dialect":{"type":"string","enum":["generic","postgres","mysql","sqlite","bigquery","snowflake","redshift","duckdb","spark","databricks","trino","tsql","oracle"],"title":"Dialect"},"statements":{"items":{"$ref":"#/components/schemas/SQLDependencyStatement"},"type":"array","title":"Statements"},"physical_tables":{"items":{"type":"string"},"type":"array","title":"Physical Tables"},"common_table_expressions":{"items":{"type":"string"},"type":"array","title":"Common Table Expressions"},"referenced_columns":{"items":{"type":"string"},"type":"array","title":"Referenced Columns"},"functions":{"items":{"type":"string"},"type":"array","title":"Functions"},"unresolved_column_count":{"type":"integer","minimum":0.0,"title":"Unresolved Column Count"},"source_sha256":{"type":"string","title":"Source Sha256"},"live_schema_resolved":{"type":"boolean","const":false,"title":"Live Schema Resolved","default":false},"column_lineage_claimed":{"type":"boolean","const":false,"title":"Column Lineage Claimed","default":false},"query_executed":{"type":"boolean","const":false,"title":"Query Executed","default":false},"payload_stored":{"type":"boolean","const":false,"title":"Payload Stored","default":false},"next_action":{"type":"string","title":"Next Action"}},"additionalProperties":false,"type":"object","required":["decision","dialect","statements","physical_tables","common_table_expressions","referenced_columns","functions","unresolved_column_count","source_sha256","next_action"],"title":"SQLDependenciesResponse"},"SQLDependencyStatement":{"properties":{"index":{"type":"integer","minimum":1.0,"title":"Index"},"statement_type":{"type":"string","title":"Statement Type"},"physical_tables":{"items":{"type":"string"},"type":"array","title":"Physical Tables"},"common_table_expressions":{"items":{"type":"string"},"type":"array","title":"Common Table Expressions"},"referenced_columns":{"items":{"type":"string"},"type":"array","title":"Referenced Columns"},"unqualified_columns":{"items":{"type":"string"},"type":"array","title":"Unqualified Columns"},"functions":{"items":{"type":"string"},"type":"array","title":"Functions"},"projections":{"items":{"type":"string"},"type":"array","title":"Projections"}},"additionalProperties":false,"type":"object","required":["index","statement_type","physical_tables","common_table_expressions","referenced_columns","unqualified_columns","functions","projections"],"title":"SQLDependencyStatement"},"SQLFinding":{"properties":{"code":{"type":"string","title":"Code"},"severity":{"type":"string","enum":["LOW","MEDIUM","HIGH"],"title":"Severity"},"message":{"type":"string","title":"Message"},"evidence":{"additionalProperties":true,"type":"object","title":"Evidence"},"next_action":{"type":"string","title":"Next Action"}},"additionalProperties":false,"type":"object","required":["code","severity","message","next_action"],"title":"SQLFinding"},"SQLInspectResponse":{"properties":{"status":{"type":"string","const":"COMPLETED","title":"Status","default":"COMPLETED"},"decision":{"type":"string","enum":["CLEAR","REVIEW_REQUIRED","BLOCKED"],"title":"Decision"},"parsed":{"type":"boolean","const":true,"title":"Parsed","default":true},"dialect":{"type":"string","enum":["generic","postgres","mysql","sqlite","bigquery","snowflake","redshift","duckdb","spark","databricks","trino","tsql","oracle"],"title":"Dialect"},"statement_count":{"type":"integer","minimum":1.0,"title":"Statement Count"},"statements":{"items":{"$ref":"#/components/schemas/SQLStatementInfo"},"type":"array","title":"Statements"},"findings":{"items":{"$ref":"#/components/schemas/SQLFinding"},"type":"array","title":"Findings"},"source_sha256":{"type":"string","title":"Source Sha256"},"parser":{"type":"string","title":"Parser","default":"SQLGlot"},"parser_version":{"type":"string","title":"Parser Version","default":"30.16.0"},"ruleset_version":{"type":"string","title":"Ruleset Version","default":"2026-08-10"},"query_executed":{"type":"boolean","const":false,"title":"Query Executed","default":false},"database_connection_performed":{"type":"boolean","const":false,"title":"Database Connection Performed","default":false},"network_access_performed":{"type":"boolean","const":false,"title":"Network Access Performed","default":false},"payload_stored":{"type":"boolean","const":false,"title":"Payload Stored","default":false},"next_action":{"type":"string","title":"Next Action"}},"additionalProperties":false,"type":"object","required":["decision","dialect","statement_count","statements","findings","source_sha256","next_action"],"title":"SQLInspectResponse"},"SQLNormalizeRequest":{"properties":{"sql":{"type":"string","maxLength":131072,"minLength":1,"title":"Sql"},"dialect":{"type":"string","enum":["generic","postgres","mysql","sqlite","bigquery","snowflake","redshift","duckdb","spark","databricks","trino","tsql","oracle"],"title":"Dialect"},"pretty":{"type":"boolean","title":"Pretty","default":true},"normalize_identifiers":{"type":"boolean","title":"Normalize Identifiers","default":false}},"additionalProperties":false,"type":"object","required":["sql","dialect"],"title":"SQLNormalizeRequest"},"SQLNormalizeResponse":{"properties":{"status":{"type":"string","const":"COMPLETED","title":"Status","default":"COMPLETED"},"decision":{"type":"string","const":"CLEAR","title":"Decision","default":"CLEAR"},"dialect":{"type":"string","enum":["generic","postgres","mysql","sqlite","bigquery","snowflake","redshift","duckdb","spark","databricks","trino","tsql","oracle"],"title":"Dialect"},"statement_count":{"type":"integer","minimum":1.0,"title":"Statement Count"},"normalized_sql":{"type":"string","title":"Normalized Sql"},"source_sha256":{"type":"string","title":"Source Sha256"},"normalized_sha256":{"type":"string","title":"Normalized Sha256"},"structural_fingerprint":{"type":"string","title":"Structural Fingerprint"},"comment_preservation":{"type":"string","const":"BEST_EFFORT","title":"Comment Preservation","default":"BEST_EFFORT"},"parser_version":{"type":"string","title":"Parser Version","default":"30.16.0"},"query_executed":{"type":"boolean","const":false,"title":"Query Executed","default":false},"database_connection_performed":{"type":"boolean","const":false,"title":"Database Connection Performed","default":false},"payload_stored":{"type":"boolean","const":false,"title":"Payload Stored","default":false},"next_action":{"type":"string","title":"Next Action"}},"additionalProperties":false,"type":"object","required":["dialect","statement_count","normalized_sql","source_sha256","normalized_sha256","structural_fingerprint","next_action"],"title":"SQLNormalizeResponse"},"SQLPolicyRequest":{"properties":{"sql":{"type":"string","maxLength":131072,"minLength":1,"title":"Sql"},"dialect":{"type":"string","enum":["generic","postgres","mysql","sqlite","bigquery","snowflake","redshift","duckdb","spark","databricks","trino","tsql","oracle"],"title":"Dialect"},"allow_multiple_statements":{"type":"boolean","title":"Allow Multiple Statements","default":false},"require_limit":{"type":"boolean","title":"Require Limit","default":true},"max_limit":{"type":"integer","maximum":1000000.0,"minimum":1.0,"title":"Max Limit","default":1000},"allow_select_star":{"type":"boolean","title":"Allow Select Star","default":false},"require_table_allowlist":{"type":"boolean","title":"Require Table Allowlist","default":false},"allowed_tables":{"items":{"type":"string"},"type":"array","maxItems":1000,"title":"Allowed Tables"},"denied_tables":{"items":{"type":"string"},"type":"array","maxItems":1000,"title":"Denied Tables"},"allow_system_catalogs":{"type":"boolean","title":"Allow System Catalogs","default":false},"require_function_allowlist":{"type":"boolean","title":"Require Function Allowlist","default":false},"allowed_functions":{"items":{"type":"string"},"type":"array","maxItems":500,"title":"Allowed Functions"},"denied_functions":{"items":{"type":"string"},"type":"array","maxItems":500,"title":"Denied Functions"}},"additionalProperties":false,"type":"object","required":["sql","dialect"],"title":"SQLPolicyRequest"},"SQLPolicyResponse":{"properties":{"status":{"type":"string","const":"COMPLETED","title":"Status","default":"COMPLETED"},"decision":{"type":"string","enum":["CLEAR","REVIEW_REQUIRED","BLOCKED"],"title":"Decision"},"permitted":{"type":"boolean","title":"Permitted"},"dialect":{"type":"string","enum":["generic","postgres","mysql","sqlite","bigquery","snowflake","redshift","duckdb","spark","databricks","trino","tsql","oracle"],"title":"Dialect"},"statement_count":{"type":"integer","minimum":1.0,"title":"Statement Count"},"statements":{"items":{"$ref":"#/components/schemas/SQLStatementInfo"},"type":"array","title":"Statements"},"findings":{"items":{"$ref":"#/components/schemas/SQLFinding"},"type":"array","title":"Findings"},"checked_default_denied_functions":{"items":{"type":"string"},"type":"array","title":"Checked Default Denied Functions"},"source_sha256":{"type":"string","title":"Source Sha256"},"ruleset_version":{"type":"string","title":"Ruleset Version","default":"2026-08-10"},"static_analysis_only":{"type":"boolean","const":true,"title":"Static Analysis Only","default":true},"query_executed":{"type":"boolean","const":false,"title":"Query Executed","default":false},"database_connection_performed":{"type":"boolean","const":false,"title":"Database Connection Performed","default":false},"network_access_performed":{"type":"boolean","const":false,"title":"Network Access Performed","default":false},"payload_stored":{"type":"boolean","const":false,"title":"Payload Stored","default":false},"next_action":{"type":"string","title":"Next Action"}},"additionalProperties":false,"type":"object","required":["decision","permitted","dialect","statement_count","statements","findings","checked_default_denied_functions","source_sha256","next_action"],"title":"SQLPolicyResponse"},"SQLStatementInfo":{"properties":{"index":{"type":"integer","minimum":1.0,"title":"Index"},"statement_type":{"type":"string","title":"Statement Type"},"query_expression":{"type":"boolean","title":"Query Expression"},"read_only_candidate":{"type":"boolean","title":"Read Only Candidate"},"tables":{"items":{"type":"string"},"type":"array","title":"Tables"},"columns":{"items":{"type":"string"},"type":"array","title":"Columns"},"functions":{"items":{"type":"string"},"type":"array","title":"Functions"},"common_table_expressions":{"items":{"type":"string"},"type":"array","title":"Common Table Expressions"},"projection_count":{"type":"integer","minimum":0.0,"title":"Projection Count"},"contains_select_star":{"type":"boolean","title":"Contains Select Star"},"has_limit":{"type":"boolean","title":"Has Limit"},"literal_limit":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Literal Limit"},"has_locking_clause":{"type":"boolean","title":"Has Locking Clause"},"has_select_into":{"type":"boolean","title":"Has Select Into"},"ast_node_count":{"type":"integer","minimum":1.0,"title":"Ast Node Count"}},"additionalProperties":false,"type":"object","required":["index","statement_type","query_expression","read_only_candidate","tables","columns","functions","common_table_expressions","projection_count","contains_select_star","has_limit","literal_limit","has_locking_clause","has_select_into","ast_node_count"],"title":"SQLStatementInfo"},"SQLTextRequest":{"properties":{"sql":{"type":"string","maxLength":131072,"minLength":1,"title":"Sql"},"dialect":{"type":"string","enum":["generic","postgres","mysql","sqlite","bigquery","snowflake","redshift","duckdb","spark","databricks","trino","tsql","oracle"],"title":"Dialect"}},"additionalProperties":false,"type":"object","required":["sql","dialect"],"title":"SQLTextRequest"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"},"input":{"title":"Input"},"ctx":{"type":"object","title":"Context"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"}}},"tags":[{"name":"SQL Inspect","description":"A bounded, stateless SQL preflight for agents, analytics builders, database tools, and CI workflows."},{"name":"SQL Normalize","description":"A bounded, stateless SQL preflight for agents, analytics builders, database tools, and CI workflows."},{"name":"SQL Read-Only Policy","description":"A bounded, stateless SQL preflight for agents, analytics builders, database tools, and CI workflows."},{"name":"SQL Dependency Extract","description":"A bounded, stateless SQL preflight for agents, analytics builders, database tools, and CI workflows."},{"name":"SQL Structure Compare","description":"A bounded, stateless SQL preflight for agents, analytics builders, database tools, and CI workflows."}],"servers":[{"url":"https://api-production-9502.up.railway.app"}]}