{"openapi":"3.1.0","info":{"title":"ChatDB Bridge API","version":"1.0.0","description":"A controlled read-only API bridge for querying a PostgreSQL ChatDB from ChatGPT Actions."},"servers":[{"url":"https://chatdb-bridge.hivelabcrow.xyz"}],"components":{"schemas":{},"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"x-api-key"}}},"paths":{"/health":{"get":{"operationId":"healthCheck","summary":"Check whether the ChatDB bridge is online.","responses":{"200":{"description":"Bridge health status"}}}},"/api/schema/tables":{"post":{"operationId":"listTables","summary":"List database tables and views that ChatGPT is allowed to inspect.","description":"Returns schema, table name, and type only. It does not return table data.","security":[{"ApiKeyAuth":[]}],"responses":{"200":{"description":"Allowed tables and views"}}}},"/api/schema/describe":{"post":{"operationId":"describeTable","summary":"Describe columns and indexes for one allowed table.","description":"Use this before asking for rows so the correct table and column names are known.","security":[{"ApiKeyAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["schema","table"],"properties":{"schema":{"type":"string","example":"public"},"table":{"type":"string","example":"messages"}},"additionalProperties":false}}}},"responses":{"200":{"description":"Table description"}}}},"/api/query/count":{"post":{"operationId":"countRows","summary":"Count rows in an allowed table.","security":[{"ApiKeyAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["schema","table"],"properties":{"schema":{"type":"string","example":"public"},"table":{"type":"string","example":"messages"}},"additionalProperties":false}}}},"responses":{"200":{"description":"Row count"}}}},"/api/query/recent":{"post":{"operationId":"getRecentRows","summary":"Get recent rows from an allowed table using a chosen order column.","description":"Call describeTable first. If order_by is omitted or wrong, the server tries created_at, updated_at, then id.","security":[{"ApiKeyAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["schema","table"],"properties":{"schema":{"type":"string","example":"public"},"table":{"type":"string","example":"messages"},"order_by":{"type":"string","example":"created_at"},"limit":{"type":"integer","minimum":1,"maximum":100,"example":25}},"additionalProperties":false}}}},"responses":{"200":{"description":"Recent rows"}}}},"/api/query/by-value":{"post":{"operationId":"getRowsByValue","summary":"Find rows where a column equals a value.","security":[{"ApiKeyAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["schema","table","column","value"],"properties":{"schema":{"type":"string","example":"public"},"table":{"type":"string","example":"messages"},"column":{"type":"string","example":"conversation_id"},"value":{"type":"string","example":"123"},"limit":{"type":"integer","minimum":1,"maximum":100,"example":25}},"additionalProperties":false}}}},"responses":{"200":{"description":"Matching rows"}}}},"/api/query/search-text":{"post":{"operationId":"searchTableText","summary":"Search one text-like column in an allowed table.","description":"Uses a case-insensitive contains search against column::text. Call describeTable first.","security":[{"ApiKeyAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["schema","table","column","search"],"properties":{"schema":{"type":"string","example":"public"},"table":{"type":"string","example":"messages"},"column":{"type":"string","example":"content"},"search":{"type":"string","example":"fiber project"},"limit":{"type":"integer","minimum":1,"maximum":100,"example":25}},"additionalProperties":false}}}},"responses":{"200":{"description":"Search results"}}}},"/api/custom/list":{"post":{"operationId":"listCustomQueries","summary":"List enabled custom named queries.","description":"Named queries are safer than raw SQL and are configured by the server owner.","security":[{"ApiKeyAuth":[]}],"responses":{"200":{"description":"Enabled custom named queries"}}}},"/api/custom/run":{"post":{"operationId":"runCustomQuery","summary":"Run one enabled custom named query.","security":[{"ApiKeyAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["id"],"properties":{"id":{"type":"string","example":"search_messages"},"params":{"type":"object","description":"Named parameters for the selected custom query.","additionalProperties":true},"limit":{"type":"integer","minimum":1,"maximum":100,"example":25}},"additionalProperties":false}}}},"responses":{"200":{"description":"Custom query rows"}}}},"/api/custom/global_search":{"post":{"operationId":"globalSearch","summary":"Global ChatDB search","description":"Search title, content, source, category, and type from public.search_view.","security":[{"ApiKeyAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["search"],"properties":{"search":{"type":"string","description":"Text to search for across ChatDB."},"limit":{"type":"integer","minimum":1,"maximum":100,"example":10}},"additionalProperties":false}}}},"responses":{"200":{"description":"Global ChatDB search results"}}}},"/api/custom/get_container":{"post":{"operationId":"getContainer","summary":"Get container or VM by CT/VM number or name","description":"Find a Proxmox container or VM by number, name, IP, role, or notes.","security":[{"ApiKeyAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["search"],"properties":{"search":{"type":"string","description":"CT/VM ID, name, IP, role, or note keyword."},"limit":{"type":"integer","minimum":1,"maximum":100,"example":10}},"additionalProperties":false}}}},"responses":{"200":{"description":"Get container or VM by CT/VM number or name results"}}}},"/api/custom/find_service":{"post":{"operationId":"findService","summary":"Find service","description":"Find a service by name, type, URL, notes, container, or IP.","security":[{"ApiKeyAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["search"],"properties":{"search":{"type":"string","description":"Service name or keyword."},"limit":{"type":"integer","minimum":1,"maximum":100,"example":10}},"additionalProperties":false}}}},"responses":{"200":{"description":"Find service results"}}}},"/api/custom/find_domain":{"post":{"operationId":"findDomain","summary":"Find domain","description":"Find a domain, DNS record, or reverse proxy target by domain name, provider, target, or notes.","security":[{"ApiKeyAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["search"],"properties":{"search":{"type":"string","description":"Domain, DNS provider/value, reverse proxy target, service name, or keyword."},"limit":{"type":"integer","minimum":1,"maximum":100,"example":10}},"additionalProperties":false}}}},"responses":{"200":{"description":"Find domain results"}}}},"/api/custom/find_playbook":{"post":{"operationId":"findPlaybook","summary":"Find playbook","description":"Find a troubleshooting playbook and its steps by name, description, category, step title, command, expected result, or notes.","security":[{"ApiKeyAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["search"],"properties":{"search":{"type":"string","description":"Playbook name, category, command, symptom, or keyword."},"limit":{"type":"integer","minimum":1,"maximum":100,"example":25}},"additionalProperties":false}}}},"responses":{"200":{"description":"Find playbook results"}}}},"/api/custom/find_application":{"post":{"operationId":"findApplication","summary":"Find application","description":"Find an application/service with related container, host, domain, DNS, reverse proxy, ports, and paths.","security":[{"ApiKeyAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["search"],"properties":{"search":{"type":"string","description":"Application, service, domain, container, host, IP, URL, or keyword."},"limit":{"type":"integer","minimum":1,"maximum":100,"example":25}},"additionalProperties":false}}}},"responses":{"200":{"description":"Find application results"}}}},"/api/custom/find_host":{"post":{"operationId":"findHost","summary":"Find host","description":"Find a host/server by name, environment, type, IP, or notes.","security":[{"ApiKeyAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["search"],"properties":{"search":{"type":"string","description":"Host name, environment, type, IP, or keyword."},"limit":{"type":"integer","minimum":1,"maximum":100,"example":10}},"additionalProperties":false}}}},"responses":{"200":{"description":"Find host results"}}}},"/api/custom/search_notes":{"post":{"operationId":"searchNotes","summary":"Search notes","description":"Search saved notes by title, body, source, or category.","security":[{"ApiKeyAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["search"],"properties":{"search":{"type":"string","description":"Note search text."},"limit":{"type":"integer","minimum":1,"maximum":100,"example":10}},"additionalProperties":false}}}},"responses":{"200":{"description":"Search notes results"}}}},"/api/custom/recent_search_items":{"post":{"operationId":"recentSearchItems","summary":"Recent ChatDB search items","description":"Returns the most recent searchable records from public.search_view.","security":[{"ApiKeyAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":[],"properties":{"limit":{"type":"integer","minimum":1,"maximum":100,"example":10}},"additionalProperties":false}}}},"responses":{"200":{"description":"Recent ChatDB search items results"}}}}}}