{
 "openapi": "3.1.0",
 "info": {
  "title": "Deadbolt API",
  "version": "1.0.0",
  "description": "Deadbolt checks Supabase access control. Paste migration SQL or a read-only catalog snapshot and get a per-table matrix of what signed-out and signed-in users can read and write, the leaks ranked by severity, and the fix SQL. Runs in your browser, no account. Public, no API key. Rate limited.",
  "contact": {
   "name": "Clawhard Studio",
   "url": "https://clawhard.com",
   "email": "support@clawhard.com"
  }
 },
 "servers": [
  {
   "url": "https://deadbolt.clawhard.com"
  }
 ],
 "paths": {
  "/api/v1/check_supabase_access": {
   "post": {
    "operationId": "check_supabase_access",
    "summary": "Check who can read and write Supabase tables (RLS, policies, grants)",
    "description": "Use when you write, review or are about to apply Supabase / PostgreSQL migration SQL (CREATE TABLE, RLS, CREATE POLICY, GRANT, views, SECURITY DEFINER functions, storage buckets), or when a user asks whether their Supabase data is exposed, whether RLS is set up right, or why a query returns 42501…",
    "x-full-description": "Use when you write, review or are about to apply Supabase / PostgreSQL migration SQL (CREATE TABLE, RLS, CREATE POLICY, GRANT, views, SECURITY DEFINER functions, storage buckets), or when a user asks whether their Supabase data is exposed, whether RLS is set up right, or why a query returns 42501 permission denied or no rows. Replays the SQL with real Postgres rules and returns, per table, what signed-out (anon) and signed-in (authenticated) users can SELECT/INSERT/UPDATE/DELETE (all rows, own rows, some rows, none, or denied for a missing grant), plus findings with severity and ready-to-run fix SQL: RLS off, policies written but RLS never enabled, using(true) writes, personal columns readable by anyone, views that bypass RLS, SECURITY DEFINER functions anyone can call, user_metadata in policies, public bucket listing, grants missing after the Oct 30 2026 default change. Also accepts the JSON produced by deadbolt_catalog_query for the live database. Deterministic; never connects to any database. Run it before telling a user their schema is safe. Up to 200,000 characters. Returns: {summary, verdict, counts:{critical,high,warn,info}, tables:[{table, kind, rls, policies, access:{anon:{select,insert,update,delete}, authenticated:{...}}, why}], findings:[{id, severity, table, title, detail, fix, line}], fix_sql, notes, mode, stats, open_url}",
    "x-openai-isConsequential": false,
    "responses": {
     "200": {
      "description": "Result. Always has \"ok\": true.",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "ok": {
           "type": "boolean"
          }
         },
         "additionalProperties": true
        }
       }
      }
     },
     "400": {
      "description": "Bad input. {\"ok\":false,\"error\":\"...\"}"
     },
     "429": {
      "description": "Rate limited. Retry after the Retry-After header."
     }
    },
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "properties": {
         "sql": {
          "type": "string",
          "minLength": 1,
          "maxLength": 200000,
          "description": "Migration SQL (one or many files concatenated, in order), or the single JSON value returned by the catalog query."
         },
         "project_created_before_2026_10_30": {
          "type": "boolean",
          "description": "Only for SQL input. true (default): the project grants new public tables to anon and authenticated automatically (projects created before Oct 30, 2026). false: new tables get no grants unless the SQL grants them (projects created on or after Oct 30, 2026)."
         }
        },
        "required": [
         "sql"
        ]
       }
      }
     }
    }
   }
  },
  "/api/v1/catalog_query": {
   "post": {
    "operationId": "catalog_query",
    "summary": "Get the read-only SQL that snapshots a live Supabase database for Deadbolt",
    "description": "Use when you need to check a live Supabase project rather than migration files: returns a read-only SQL query that reads table RLS settings, grants for anon and authenticated, policies, SECURITY DEFINER functions and storage buckets (never row data) and returns one JSON value.",
    "x-full-description": "Use when you need to check a live Supabase project rather than migration files: returns a read-only SQL query that reads table RLS settings, grants for anon and authenticated, policies, SECURITY DEFINER functions and storage buckets (never row data) and returns one JSON value. Run it with the user's Supabase SQL Editor or a Supabase MCP execute_sql tool, then pass the JSON to deadbolt_check_supabase_access. Returns: {summary, sql, how_to}",
    "x-openai-isConsequential": false,
    "responses": {
     "200": {
      "description": "Result. Always has \"ok\": true.",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "ok": {
           "type": "boolean"
          }
         },
         "additionalProperties": true
        }
       }
      }
     },
     "400": {
      "description": "Bad input. {\"ok\":false,\"error\":\"...\"}"
     },
     "429": {
      "description": "Rate limited. Retry after the Retry-After header."
     }
    },
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "properties": {},
        "required": []
       }
      }
     }
    }
   }
  }
 },
 "externalDocs": {
  "description": "llms.txt",
  "url": "https://deadbolt.clawhard.com/llms.txt"
 }
}