[{"data":1,"prerenderedAt":813},["ShallowReactive",2],{"navigation_docs":3,"-api-reference-scopes-permissions":134,"-api-reference-scopes-permissions-surround":808},[4,26,52,88,114],{"title":5,"icon":6,"path":7,"stem":8,"children":9,"page":25},"Getting Started","i-lucide-rocket","\u002Fgetting-started","1.getting-started",[10,15,20],{"title":11,"path":12,"stem":13,"icon":14},"Introduction","\u002Fgetting-started\u002Fintroduction","1.getting-started\u002F1.introduction","i-lucide-sparkles",{"title":16,"path":17,"stem":18,"icon":19},"Quickstart","\u002Fgetting-started\u002Fquickstart","1.getting-started\u002F2.quickstart","i-lucide-play",{"title":21,"path":22,"stem":23,"icon":24},"Architecture & State","\u002Fgetting-started\u002Farchitecture","1.getting-started\u002F3.architecture","i-lucide-cpu",false,{"title":27,"icon":28,"path":29,"stem":30,"children":31,"page":25},"Serverless & Edge","i-lucide-zap","\u002Fserverless","2.serverless",[32,37,42,47],{"title":33,"path":34,"stem":35,"icon":36},"Serverless Architecture","\u002Fserverless\u002Foverview","2.serverless\u002F1.overview","i-lucide-globe",{"title":38,"path":39,"stem":40,"icon":41},"Minimal Client","\u002Fserverless\u002Fminimal-client","2.serverless\u002F2.minimal-client","i-lucide-code",{"title":43,"path":44,"stem":45,"icon":46},"Execution Modes","\u002Fserverless\u002Fexecution-modes","2.serverless\u002F3.execution-modes","i-lucide-list-tree",{"title":48,"path":49,"stem":50,"icon":51},"Timeouts & Retries","\u002Fserverless\u002Ftimeouts-and-retries","2.serverless\u002F4.timeouts-and-retries","i-lucide-alert-triangle",{"title":53,"icon":54,"path":55,"stem":56,"children":57,"page":25},"API Reference","i-lucide-terminal","\u002Fapi-reference","3.api-reference",[58,63,68,73,78,83],{"title":59,"path":60,"stem":61,"icon":62},"Protocol & Authentication","\u002Fapi-reference\u002Foverview","3.api-reference\u002F1.overview","i-lucide-key",{"title":64,"path":65,"stem":66,"icon":67},"Queries","\u002Fapi-reference\u002Fqueries","3.api-reference\u002F2.queries","i-lucide-database",{"title":69,"path":70,"stem":71,"icon":72},"Transactions","\u002Fapi-reference\u002Ftransactions","3.api-reference\u002F3.transactions","i-lucide-layers",{"title":74,"path":75,"stem":76,"icon":77},"Administration","\u002Fapi-reference\u002Fadministration","3.api-reference\u002F4.administration","i-lucide-settings",{"title":79,"path":80,"stem":81,"icon":82},"Scopes & Permissions","\u002Fapi-reference\u002Fscopes-permissions","3.api-reference\u002F5.scopes-permissions","i-lucide-shield",{"title":84,"path":85,"stem":86,"icon":87},"Errors & Diagnostics","\u002Fapi-reference\u002Ferrors","3.api-reference\u002F6.errors","i-lucide-alert-circle",{"title":89,"icon":90,"path":91,"stem":92,"children":93,"page":25},"Configuration","i-lucide-sliders","\u002Fconfiguration","4.configuration",[94,99,104,109],{"title":95,"path":96,"stem":97,"icon":98},"Gateway YAML","\u002Fconfiguration\u002Fgateway-yaml","4.configuration\u002F1.gateway-yaml","i-lucide-file-code",{"title":100,"path":101,"stem":102,"icon":103},"Connection Pools","\u002Fconfiguration\u002Fconnection-pools","4.configuration\u002F2.connection-pools","i-lucide-activity",{"title":105,"path":106,"stem":107,"icon":108},"Analytics & Observability","\u002Fconfiguration\u002Fanalytics","4.configuration\u002F3.analytics","i-lucide-bar-chart",{"title":110,"path":111,"stem":112,"icon":113},"Runtime Files & State","\u002Fconfiguration\u002Fruntime-files","4.configuration\u002F4.runtime-files","i-lucide-folder",{"title":115,"icon":116,"path":117,"stem":118,"children":119,"page":25},"Operations & Security","i-lucide-shield-check","\u002Foperations","5.operations",[120,125,129],{"title":121,"path":122,"stem":123,"icon":124},"Production Deployment","\u002Foperations\u002Fdeployment","5.operations\u002F1.deployment","i-lucide-server",{"title":126,"path":127,"stem":128,"icon":116},"Security Hardening","\u002Foperations\u002Fsecurity","5.operations\u002F2.security",{"title":130,"path":131,"stem":132,"icon":133},"Development & Contributing","\u002Foperations\u002Fdevelopment","5.operations\u002F3.development","i-lucide-code-2",{"id":135,"title":79,"body":136,"description":799,"extension":800,"links":801,"meta":802,"navigation":803,"path":80,"seo":804,"stem":81,"__hash__":807},"docs\u002F3.api-reference\u002F5.scopes-permissions.md",{"type":137,"value":138,"toc":784},"minimark",[139,144,153,156,159,164,167,256,258,262,269,278,281,357,367,378,381,475,488,492,495,590,600,602,606,651,653,657,669,683,697,701,704,747,749,753,759,762,780],[140,141,143],"h1",{"id":142},"scopes-permissions-reference","Scopes & Permissions Reference",[145,146,147,148,152],"p",{},"Unlike traditional database proxies that execute all queries under a single shared superuser connection, HTTP PostgreSQL Gateway enforces ",[149,150,151],"strong",{},"database-level authorization",".",[145,154,155],{},"API keys are mapped to dynamically provisioned, dedicated PostgreSQL roles with the smallest possible set of database privileges. PostgreSQL itself enforces access control on every query.",[157,158],"hr",{},[160,161,163],"h2",{"id":162},"crud-scope-letters","CRUD Scope Letters",[145,165,166],{},"Scopes are specified using four lowercase letters:",[168,169,170,187],"table",{},[171,172,173],"thead",{},[174,175,176,181,184],"tr",{},[177,178,180],"th",{"align":179},"left","Scope Letter",[177,182,183],{"align":179},"SQL Equivalent",[177,185,186],{"align":179},"Description",[188,189,190,207,226,241],"tbody",{},[174,191,192,199,204],{},[193,194,195],"td",{"align":179},[196,197,198],"code",{},"c",[193,200,201],{"align":179},[196,202,203],{},"INSERT",[193,205,206],{"align":179},"Create new records.",[174,208,209,214,219],{},[193,210,211],{"align":179},[196,212,213],{},"r",[193,215,216],{"align":179},[196,217,218],{},"SELECT",[193,220,221,222,225],{"align":179},"Read existing records. Also required for ",[196,223,224],{},"RETURNING"," clauses.",[174,227,228,233,238],{},[193,229,230],{"align":179},[196,231,232],{},"u",[193,234,235],{"align":179},[196,236,237],{},"UPDATE",[193,239,240],{"align":179},"Modify existing records.",[174,242,243,248,253],{},[193,244,245],{"align":179},[196,246,247],{},"d",[193,249,250],{"align":179},[196,251,252],{},"DELETE",[193,254,255],{"align":179},"Remove existing records.",[157,257],{},[160,259,261],{"id":260},"scope-definitions","Scope Definitions",[145,263,264,265,268],{},"When creating or updating an API key via ",[196,266,267],{},"POST \u002Fadmin\u002Fkeys",", you can configure two levels of permissions:",[270,271,273,274,277],"h3",{"id":272},"_1-database-wide-scopes-scope-database","1. Database-Wide Scopes (",[196,275,276],{},"scope-database",")",[145,279,280],{},"Applies permissions across all current user tables in the assigned database:",[282,283,288],"pre",{"className":284,"code":285,"language":286,"meta":287,"style":287},"language-json shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","{\n  \"database\": [\"sales\"],\n  \"scope-database\": [\"r\"]\n}\n","json","",[196,289,290,299,329,351],{"__ignoreMap":287},[291,292,295],"span",{"class":293,"line":294},"line",1,[291,296,298],{"class":297},"sMK4o","{\n",[291,300,302,305,309,312,315,318,320,324,326],{"class":293,"line":301},2,[291,303,304],{"class":297},"  \"",[291,306,308],{"class":307},"spNyl","database",[291,310,311],{"class":297},"\"",[291,313,314],{"class":297},":",[291,316,317],{"class":297}," [",[291,319,311],{"class":297},[291,321,323],{"class":322},"sfazB","sales",[291,325,311],{"class":297},[291,327,328],{"class":297},"],\n",[291,330,332,334,336,338,340,342,344,346,348],{"class":293,"line":331},3,[291,333,304],{"class":297},[291,335,276],{"class":307},[291,337,311],{"class":297},[291,339,314],{"class":297},[291,341,317],{"class":297},[291,343,311],{"class":297},[291,345,213],{"class":322},[291,347,311],{"class":297},[291,349,350],{"class":297},"]\n",[291,352,354],{"class":293,"line":353},4,[291,355,356],{"class":297},"}\n",[145,358,359,363,364,366],{},[360,361,362],"em",{},"Effect:"," Read-only access to all current user tables in the ",[196,365,323],{}," database.",[270,368,370,371,374,375,277],{"id":369},"_2-table-specific-scopes-tables-scope-table","2. Table-Specific Scopes (",[196,372,373],{},"tables",", ",[196,376,377],{},"scope-table",[145,379,380],{},"Restricts permissions to specific named tables:",[282,382,384],{"className":284,"code":383,"language":286,"meta":287,"style":287},"{\n  \"database\": [\"sales\"],\n  \"tables\": [\"public.orders\", \"public.order_items\"],\n  \"scope-table\": [\"c\", \"r\"]\n}\n",[196,385,386,390,410,442,470],{"__ignoreMap":287},[291,387,388],{"class":293,"line":294},[291,389,298],{"class":297},[291,391,392,394,396,398,400,402,404,406,408],{"class":293,"line":301},[291,393,304],{"class":297},[291,395,308],{"class":307},[291,397,311],{"class":297},[291,399,314],{"class":297},[291,401,317],{"class":297},[291,403,311],{"class":297},[291,405,323],{"class":322},[291,407,311],{"class":297},[291,409,328],{"class":297},[291,411,412,414,416,418,420,422,424,427,429,432,435,438,440],{"class":293,"line":331},[291,413,304],{"class":297},[291,415,373],{"class":307},[291,417,311],{"class":297},[291,419,314],{"class":297},[291,421,317],{"class":297},[291,423,311],{"class":297},[291,425,426],{"class":322},"public.orders",[291,428,311],{"class":297},[291,430,431],{"class":297},",",[291,433,434],{"class":297}," \"",[291,436,437],{"class":322},"public.order_items",[291,439,311],{"class":297},[291,441,328],{"class":297},[291,443,444,446,448,450,452,454,456,458,460,462,464,466,468],{"class":293,"line":353},[291,445,304],{"class":297},[291,447,377],{"class":307},[291,449,311],{"class":297},[291,451,314],{"class":297},[291,453,317],{"class":297},[291,455,311],{"class":297},[291,457,198],{"class":322},[291,459,311],{"class":297},[291,461,431],{"class":297},[291,463,434],{"class":297},[291,465,213],{"class":322},[291,467,311],{"class":297},[291,469,350],{"class":297},[291,471,473],{"class":293,"line":472},5,[291,474,356],{"class":297},[145,476,477,479,480,482,483,485,486,152],{},[360,478,362],{}," Can insert and select from ",[196,481,426],{}," and ",[196,484,437],{},", but cannot query any other table in ",[196,487,323],{},[270,489,491],{"id":490},"_3-mixed-scopes","3. Mixed Scopes",[145,493,494],{},"Combine database-wide and table-specific permissions:",[282,496,498],{"className":284,"code":497,"language":286,"meta":287,"style":287},"{\n  \"database\": [\"sales\"],\n  \"scope-database\": [\"r\"],\n  \"tables\": [\"public.audit_logs\"],\n  \"scope-table\": [\"c\"]\n}\n",[196,499,500,504,524,544,565,585],{"__ignoreMap":287},[291,501,502],{"class":293,"line":294},[291,503,298],{"class":297},[291,505,506,508,510,512,514,516,518,520,522],{"class":293,"line":301},[291,507,304],{"class":297},[291,509,308],{"class":307},[291,511,311],{"class":297},[291,513,314],{"class":297},[291,515,317],{"class":297},[291,517,311],{"class":297},[291,519,323],{"class":322},[291,521,311],{"class":297},[291,523,328],{"class":297},[291,525,526,528,530,532,534,536,538,540,542],{"class":293,"line":331},[291,527,304],{"class":297},[291,529,276],{"class":307},[291,531,311],{"class":297},[291,533,314],{"class":297},[291,535,317],{"class":297},[291,537,311],{"class":297},[291,539,213],{"class":322},[291,541,311],{"class":297},[291,543,328],{"class":297},[291,545,546,548,550,552,554,556,558,561,563],{"class":293,"line":353},[291,547,304],{"class":297},[291,549,373],{"class":307},[291,551,311],{"class":297},[291,553,314],{"class":297},[291,555,317],{"class":297},[291,557,311],{"class":297},[291,559,560],{"class":322},"public.audit_logs",[291,562,311],{"class":297},[291,564,328],{"class":297},[291,566,567,569,571,573,575,577,579,581,583],{"class":293,"line":472},[291,568,304],{"class":297},[291,570,377],{"class":307},[291,572,311],{"class":297},[291,574,314],{"class":297},[291,576,317],{"class":297},[291,578,311],{"class":297},[291,580,198],{"class":322},[291,582,311],{"class":297},[291,584,350],{"class":297},[291,586,588],{"class":293,"line":587},6,[291,589,356],{"class":297},[145,591,592,594,595,597,598,152],{},[360,593,362],{}," Read all tables in ",[196,596,323],{},", and insert into ",[196,599,560],{},[157,601],{},[160,603,605],{"id":604},"how-roles-are-provisioned","How Roles Are Provisioned",[607,608,609,616,645],"ol",{},[610,611,612,615],"li",{},[149,613,614],{},"Deterministic Role Naming:"," The gateway calculates a unique cryptographic hash from the normalized database name and granted scopes.",[610,617,618,621,622],{},[149,619,620],{},"Dedicated PostgreSQL Role:"," The gateway uses its administrative pool connection to execute:\n",[623,624,625,630,635,640],"ul",{},[610,626,627],{},[196,628,629],{},"CREATE ROLE \u003Crole_name> WITH LOGIN PASSWORD '\u003Cderived_password>'",[610,631,632],{},[196,633,634],{},"GRANT CONNECT ON DATABASE \u003Cdb> TO \u003Crole_name>",[610,636,637],{},[196,638,639],{},"GRANT USAGE ON SCHEMA \u003Cschema> TO \u003Crole_name>",[610,641,642],{},[196,643,644],{},"GRANT SELECT, INSERT... ON TABLE \u003Ctable> TO \u003Crole_name>",[610,646,647,650],{},[149,648,649],{},"Dedicated Query Pool:"," When queries authenticate with this API key, the gateway routes them to a dedicated connection pool authenticated as that specific PostgreSQL role.",[157,652],{},[160,654,656],{"id":655},"why-postgresql-privileges-are-additive","Why PostgreSQL Privileges Are Additive",[658,659,660,661,664,665,668],"caution",{},"In PostgreSQL, ",[149,662,663],{},"privileges are additive",". A role inherits any privileges granted to ",[196,666,667],{},"PUBLIC",", any parent group roles, and default schema permissions.",[145,670,671,672,674,675,678,679,682],{},"If ",[196,673,667],{}," has ",[196,676,677],{},"CONNECT"," or ",[196,680,681],{},"CREATE"," on a database or schema:",[623,684,685,688],{},[610,686,687],{},"A key requested as \"table-only\" would inadvertently have access to public tables.",[610,689,690,691,152],{},"The gateway actively audits effective privileges during key creation. If inherited grants conflict with the requested narrow scope, the gateway ",[149,692,693,694],{},"rejects creation with ",[196,695,696],{},"409 UNSAFE_DATABASE_SCOPE",[270,698,700],{"id":699},"hardening-postgresql-for-scoped-keys","Hardening PostgreSQL for Scoped Keys",[145,702,703],{},"Run these statements as an administrator to ensure narrow scopes can be safely provisioned:",[282,705,709],{"className":706,"code":707,"language":708,"meta":287,"style":287},"language-sql shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","-- Revoke PUBLIC connection to the database\nREVOKE CONNECT ON DATABASE target_db FROM PUBLIC;\n\n\\connect target_db\n\n-- Revoke default PUBLIC table creation in public schema\nREVOKE CREATE ON SCHEMA public FROM PUBLIC;\n","sql",[196,710,711,716,721,727,732,736,741],{"__ignoreMap":287},[291,712,713],{"class":293,"line":294},[291,714,715],{},"-- Revoke PUBLIC connection to the database\n",[291,717,718],{"class":293,"line":301},[291,719,720],{},"REVOKE CONNECT ON DATABASE target_db FROM PUBLIC;\n",[291,722,723],{"class":293,"line":331},[291,724,726],{"emptyLinePlaceholder":725},true,"\n",[291,728,729],{"class":293,"line":353},[291,730,731],{},"\\connect target_db\n",[291,733,734],{"class":293,"line":472},[291,735,726],{"emptyLinePlaceholder":725},[291,737,738],{"class":293,"line":587},[291,739,740],{},"-- Revoke default PUBLIC table creation in public schema\n",[291,742,744],{"class":293,"line":743},7,[291,745,746],{},"REVOKE CREATE ON SCHEMA public FROM PUBLIC;\n",[157,748],{},[160,750,752],{"id":751},"re-binding-keys-after-schema-changes","Re-binding Keys After Schema Changes",[145,754,755,756,152],{},"Database-wide grants apply to the tables present ",[149,757,758],{},"at the moment the key was saved",[145,760,761],{},"If you add a new table to your database:",[607,763,764,767,773],{},[610,765,766],{},"The existing scoped role does not automatically receive privileges on the new table.",[610,768,769,770,152],{},"To grant access to newly created tables or updated sequences, re-save the key using ",[196,771,772],{},"PATCH \u002Fadmin\u002Fkeys\u002F:id",[610,774,775,776,779],{},"If an older key requires re-binding, queries will return ",[196,777,778],{},"401 API_KEY_SCOPE_REBIND_REQUIRED"," until an administrator updates its scope.",[781,782,783],"style",{},"html pre.shiki code .sMK4o, html code.shiki .sMK4o{--shiki-light:#39ADB5;--shiki-default:#89DDFF;--shiki-dark:#89DDFF}html pre.shiki code .spNyl, html code.shiki .spNyl{--shiki-light:#9C3EDA;--shiki-default:#C792EA;--shiki-dark:#C792EA}html pre.shiki code .sfazB, html code.shiki .sfazB{--shiki-light:#91B859;--shiki-default:#C3E88D;--shiki-dark:#C3E88D}html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"title":287,"searchDepth":301,"depth":301,"links":785},[786,787,794,795,798],{"id":162,"depth":301,"text":163},{"id":260,"depth":301,"text":261,"children":788},[789,791,793],{"id":272,"depth":331,"text":790},"1. Database-Wide Scopes (scope-database)",{"id":369,"depth":331,"text":792},"2. Table-Specific Scopes (tables, scope-table)",{"id":490,"depth":331,"text":491},{"id":604,"depth":301,"text":605},{"id":655,"depth":301,"text":656,"children":796},[797],{"id":699,"depth":331,"text":700},{"id":751,"depth":301,"text":752},"How HTTP PostgreSQL Gateway translates API keys into least-privilege PostgreSQL database roles.","md",null,{},{"icon":82},{"title":805,"description":806},"Scopes & Permissions · HTTP PostgreSQL Gateway","Deep dive into CRUD scopes (c, r, u, d), table-level vs database-level grants, role derivation, and additive permissions.","g586SgDxXhYdwhubHy3Z98yFW08XXZ5M6cW93lk9x8E",[809,811],{"title":74,"path":75,"stem":76,"description":810,"icon":77,"children":-1},"Manage health monitoring, database schemas, tables, API keys, logs, and analytics.",{"title":84,"path":85,"stem":86,"description":812,"icon":87,"children":-1},"Comprehensive dictionary of HTTP status codes, gateway error codes, and PostgreSQL SQLSTATE diagnostics.",1795399272866]