OfficialProductivity

Notion

Give your agents access to Notion so they can find shared pages, work with your knowledge and keep projects up to date.

With read access, agents can search pages, read content and comments, query databases and views, and download files. With write access, they can also create and edit pages, organize data, add comments and upload files.

The connector supports Notion agents and sessions, meeting notes, custom emojis, and skills where your Notion account has access to those features. Running an agent session requires write access in Houston because the agent can use its own tools to take actions.

Enterprise organization bots can use a separate connection for administration: legal holds, exports, analytics, permission groups, access tokens, MCP connections and agent policies, permissions and credit limits.

Connect with Notion, an internal connection token, or a personal access token. You choose Houston's access level; Notion's own capabilities, shared pages and plan permissions still apply. See Connect your Notion account.

Setup instructions

Connect Notion

  1. Choose Read or Write for Access in Houston.
  2. Select Continue with Notion, choose your workspace and pages, and allow access.

Agents can access the selected pages and their subpages. Reauthorize to share more. Notion's permissions and plan limits still apply.

Advanced

Connect with a token

Under Other ways to connect, choose Internal connection or personal access token. Create an internal connection, grant needed content/comment/user capabilities and share pages through their Connections menu. Alternatively, use a personal access token, which uses your own access. Paste the token in Houston.

Some agent, meeting-note and skills features need a personal token or extra plan permissions. If content is missing, check the workspace, shared pages and capabilities.

Enterprise organization bot

Add a separate Enterprise organization bot (Admin API) connection with an organization bot token and the required Admin API scopes. It requires an eligible Enterprise organization; ordinary tokens cannot replace it. Read access excludes administrative changes and export-job creation.

To revoke provider access, remove Houston in Notion or revoke the token; deleting the Houston connection alone does not revoke it in Notion.

Files

  • connector.luau
    -- Native Notion fields and responses are deliberately preserved, including nulls.
    type Options = {[string]: any}
    type Endpoint = {method: string, path: string, access: string?, body: boolean, query: {string}, required: {string}, help: string}
    local API = "https://api.notion.com"
    local NULL = json.decode("null")
    local ADMIN = auth.method == "admin"
    local VERSION = if ADMIN then "2026-06-01" else "2026-03-11"
    local endpoints: {[string]: Endpoint} = if ADMIN then require("lib/admin.luau") else require("lib/endpoints.luau")
    
    local function text(value: any, field: string): string
    	assert(type(value) == "string" and value ~= "", field .. " must be a nonempty string")
    	return value
    end
    
    local function options(value: Options?): Options
    	if value == nil then return {} end
    	assert(type(value) == "table", "opts must be an object")
    	for key in value do assert(type(key) == "string", "opts must have named fields") end
    	return table.clone(value)
    end
    
    local function identifier(value: any, field: string): string
    	local id = text(value, field)
    	if field ~= "property_id" then return url.segment(id, field) end
    	-- Notion returns URL-encoded property IDs, which may contain separators and percent signs:
    	-- decode them once, then encode them whole. The manifest declares them opaque.
    	id = string.gsub(id, "%%(%x%x)", function(hex: string) return string.char(tonumber(hex, 16) :: number) end)
    	assert(id ~= "." and id ~= "..", field .. " must not be a dot path segment")
    	return url.encode(id)
    end
    
    local function pageSize(value: any)
    	if value ~= nil and value ~= NULL then
    		assert(type(value) == "number" and value >= 1 and value <= 100 and value % 1 == 0, "page_size must be an integer from 1 to 100")
    	end
    end
    
    local function scalar(value: any): string | number | boolean
    	assert(type(value) == "string" or type(value) == "boolean" or (type(value) == "number" and value == value and math.abs(value) < math.huge), "query values must be strings, booleans or finite numbers")
    	return value
    end
    
    local function queryValue(parts: {string}, key: string, value: any)
    	if value == nil or value == NULL then return end
    	if type(value) == "table" then
    		local count = 0
    		for index in value do
    			assert(type(index) == "number" and index >= 1 and index % 1 == 0, key .. " must be a dense array")
    			count += 1
    		end
    		assert(count == #value, key .. " must be a dense array")
    		for _, item in value do table.insert(parts, url.encode(key .. "[]") .. "=" .. url.encode(scalar(item))) end
    	else
    		table.insert(parts, url.encode(key) .. "=" .. url.encode(scalar(value)))
    	end
    end
    
    local function fail(operation: string, response: HttpResponse): never
    	local ok, decoded = pcall(json.decode, await(response.body:readPrefix(4096)))
    	local message = "Notion HTTP " .. tostring(response.statusCode)
    	if ok and type(decoded) == "table" then
    		if type(decoded.code) == "string" then message ..= " (" .. decoded.code .. ")" end
    		if type(decoded.message) == "string" then message ..= ": " .. string.sub(decoded.message, 1, 600) end
    		if type(decoded.request_id) == "string" then message ..= " [request " .. decoded.request_id .. "]" end
    	end
    	local retry = response.headers["retry-after"]
    	if retry and retry[1] then message ..= "; Retry-After: " .. retry[1] end
    	return houston.fail({operation = operation, layer = "upstream", upstream_status = response.statusCode,
    		retryable = response.statusCode == 429 or response.statusCode >= 500, message = message})
    end
    
    local function responseJSON(operation: string, response: HttpResponse): any
    	if response.statusCode < 200 or response.statusCode >= 300 then fail(operation, response) end
    	if response.statusCode == 204 then response.body:close(); return {success = true} end
    	local raw = await(response.body:readAll())
    	local ok, value = pcall(json.decode, raw)
    	if not ok or type(value) ~= "table" or not string.match(raw, "^%s*{") then
    		houston.fail({operation = operation, layer = "upstream", upstream_status = response.statusCode,
    			retryable = false, message = "Notion returned an invalid JSON object"})
    	end
    	if value.object == "error" or value.type == "error" then
    		houston.fail({operation = operation, layer = "upstream", upstream_status = response.statusCode,
    			retryable = false, message = "Notion error: " .. tostring(value.code) .. ": " .. tostring(value.message)})
    	end
    	return value
    end
    
    local function headers(): HttpHeaders
    	return {["Accept"] = {"application/json"}, ["Content-Type"] = {"application/json"}, ["Notion-Version"] = {VERSION}}
    end
    
    local function request(name: string, endpoint: Endpoint, input: Options?): any
    	local args = options(input)
    	pageSize(args.page_size)
    	local path = string.gsub(endpoint.path, "{([%w_]+)}", function(field: string)
    		local value = identifier(args[field], field)
    		args[field] = nil
    		return value
    	end)
    	for _, field in endpoint.required do text(args[field], field) end
    	local query: {string} = {}
    	for _, field in endpoint.query do queryValue(query, field, args[field]); args[field] = nil end
    	if #query > 0 then path ..= "?" .. table.concat(query, "&") end
    	if not endpoint.body then assert(next(args) == nil, name .. " received an unknown option") end
    	if name == "updateSession" then assert(args.continue_from == nil, "continue_from requires streamSession") end
    	return responseJSON(name, await(http.request({method = endpoint.method, url = API .. path,
    		headers = headers(), body = if endpoint.body then json.encode(args) else nil})))
    end
    
    local function saveResponse(name: string, response: HttpResponse, path: string): Options
    	if response.statusCode < 200 or response.statusCode >= 300 then fail(name, response) end
    	local output = fs.open(path, "w")
    	output:write(response.body)
    	await(output:close())
    	return {path = path, url = await(fs.signedGetUrl(path)), size = await(fs.stat(path)).size}
    end
    
    local exports: {[string]: any} = {}
    local help: {[string]: string} = {}
    for name, endpoint in endpoints do
    	if name ~= "sendFileUpload" and (not endpoint.access or houston.allows(endpoint.access)) then
    		exports[name] = function(args: Options?): any return request(name, endpoint, args) end
    		help[name] = endpoint.help
    	end
    end
    
    exports.downloadFile = function(input: Options): Options
    	local args = options(input)
    	local link, path = text(args.url, "url"), text(args.path, "path")
    	assert(string.sub(link, 1, 8) == "https://", "url must be HTTPS")
    	-- The manifest restricts this to Notion's download hosts and strips credentials.
    	return saveResponse("downloadFile", await(http.request({method = "GET", url = link})), path)
    end
    help.downloadFile = "downloadFile({url, path}) -> {path, url, size}. Stream a fresh Notion signed file/plugin/export URL into a session file. The returned URL is Houston's signed download URL. Only documented Notion storage origins are allowed; external file URLs use caller HTTP instead. Redirects are not followed. A failed transfer leaves the destination as it was."
    
    if not ADMIN and houston.allows("data:write") then
    	exports.sendFileUpload = function(input: Options): any
    		local args = options(input)
    		local id = identifier(args.file_upload_id, "file_upload_id")
    		local path = text(args.path, "path")
    		local filename = text(args.filename or string.match(path, "[^/]+$"), "filename")
    		local contentType = text(args.content_type or "application/octet-stream", "content_type")
    		local part = args.part_number
    		assert(part == nil or (type(part) == "number" and part >= 1 and part <= 10000 and part % 1 == 0), "part_number must be an integer from 1 to 10000")
    		local parts: {MultipartPart} = {}
    		if part ~= nil then table.insert(parts, {name = "part_number", body = tostring(part)}) end
    		table.insert(parts, {name = "file", filename = filename, contentType = contentType, body = fs.open(path, "r")})
    		local form = multipart.create(parts)
    		local h = headers()
    		h["Content-Type"] = {form.contentType}
    		return responseJSON("sendFileUpload", await(http.request({method = "POST", url = API .. "/v1/file_uploads/" .. id .. "/send", headers = h, body = form.body})))
    	end
    	help.sendFileUpload = "sendFileUpload({file_upload_id, path, filename?, content_type?, part_number?}) -> Notion file_upload. Streams a session file via native multipart. filename defaults to the path basename; content_type defaults to application/octet-stream. For multi_part uploads send each prepared part file with its 1-based part_number, then completeFileUpload. Creation/import modes and number_of_parts are supplied to createFileUpload. Attach the completed file_upload ID to a page/block/comment before Notion's expiry. No automatic retry."
    	exports.streamSession = function(input: Options): Options
    		local args = options(input)
    		local path = text(args.path, "path")
    		args.path = nil
    		local h = headers()
    		h.Accept = {"text/event-stream"}
    		local response = await(http.request({method = "POST", url = API .. "/v1/sessions", headers = h, body = json.encode(args)}))
    		if response.statusCode >= 200 and response.statusCode < 300 then
    			local contentType = response.headers["content-type"]
    			local mediaType = if contentType then string.lower(string.match(contentType[1] or "", "^%s*([^;]+)") or "") else ""
    			mediaType = string.gsub(mediaType, "%s+$", "")
    			if mediaType ~= "text/event-stream" then
    				response.body:close()
    				error("streamSession expected text/event-stream")
    			end
    		end
    		return saveResponse("streamSession", response, path)
    	end
    	help.streamSession = "streamSession({path, ...Notion session body}) -> {path, url, size}. Sends POST /v1/sessions with Accept:text/event-stream, saves raw SSE to a session file and returns after the stream ends. Supports session_id + continue_from (committed event ID), message/agent_id, or actions. A timeout leaves path as it was but may leave a running remote session: inspect getSession/querySessionEvents before retrying; replay with continue_from."
    end
    
    local EMPTY_SEARCH = if auth.method == "oauth" then " An empty search usually means no pages are shared: ask the user to edit the connection and authorize it again to pick pages."
    	elseif auth.method == "token" then " An empty search usually means no pages are shared: for an internal connection, ask the user to add it to pages from their Connections menu in Notion; a personal access token sees what its owner can access."
    	else ""
    
    exports.help = function(): string
    	local names: {string} = {}
    	for name in exports do if name ~= "help" then table.insert(names, name) end end
    	table.sort(names)
    	local lines = {
    		"Notion " .. VERSION .. (if ADMIN then " Admin API (Enterprise organization bot)." else " Data, Agents and Skills API."),
    		"Every operation takes one named options object using Notion's snake_case fields. Path/query fields are separated automatically; all remaining fields are the unmodified JSON body. Returns the complete Notion JSON object, preserving nulls, arrays, pagination and future fields; HTTP 204 returns {success=true}.",
    		"Lists return one page only. Pass next_cursor as start_cursor while has_more is true; admin endpoints may use cursor. page_size is 1..100. Query arrays use bracket encoding. Use json.decode('[]') for empty arrays and json.decode('null') to clear nullable fields. Property IDs may be passed URL-encoded as returned by Notion.",
    		"Capabilities and shared-page permissions are enforced by Notion; 403/404 may require granting the connection access." .. EMPTY_SEARCH .. " Some Agent/Skills/meeting features require a PAT or additional Notion entitlements. Search searches shared titles, not full content. Use data sources for schema/query operations, databases for containers. To trash/restore a page use updatePage({page_id=..., in_trash=true/false}).",
    		"No hidden paging, polling or retries. Inspect getAsyncTask/getSession after asynchronous writes. Errors report status, provider code/message, request ID and Retry-After when available. A failed/timeout write may already have succeeded; verify before repeating. Read-only connections omit mutations; createViewQuery is a read query that creates a temporary results cache.",
    		"OAuth exchange/refresh are managed by Houston; credentials never enter Lua. OAuth token creation/introspection/revocation are credential administration, not callable data operations. Webhook subscriptions are configured in Notion's developer portal, not through a REST endpoint. Legacy pre-2025 database endpoints are superseded by data sources.",
    		"Example: search({query='Roadmap',page_size=10}); getPage({page_id='...'}); queryDataSource({data_source_id='...',filter={property='Status',status={equals='Done'}},filter_properties={'title'}}). Read the endpoint documentation linked below for complete nested body types and provider limits.",
    	}
    	for _, name in names do table.insert(lines, name .. "(opts): " .. help[name]) end
    	return table.concat(lines, "\n")
    end
    return exports
    
  • houston.json
    {
      "access": [
        {
          "default": "read",
          "label": "Access",
          "levels": [
            {
              "label": "Read",
              "value": "read"
            },
            {
              "label": "Write",
              "value": "write"
            }
          ],
          "name": "data"
        }
      ],
      "auth": {
        "admin": {
          "config": {
            "token": {
              "label": "Token",
              "required": true,
              "type": "secret"
            }
          },
          "label": "Enterprise organization bot (Admin API)",
          "order": 3,
          "type": "manual"
        },
        "oauth": {
          "account": {
            "headers": {
              "Authorization": {
                "value": "Bearer {{auth.oauth.access_token}}"
              },
              "Notion-Version": {
                "value": "2026-03-11"
              }
            },
            "label": "/id",
            "method": "GET",
            "url": "https://api.notion.com/v1/users/me"
          },
          "authorize_params": {
            "owner": "user"
          },
          "authorize_url": "https://api.notion.com/v1/oauth/authorize",
          "client_auth": "basic",
          "client_id": "{{publisher.client_id}}",
          "client_secret": "{{publisher.client_secret}}",
          "label": "Connect with Notion",
          "brand": "notion",
          "order": 1,
          "pkce": "none",
          "shared": {
            "body": {
              "page_size": 1
            },
            "headers": {
              "Authorization": {
                "value": "Bearer {{auth.oauth.access_token}}"
              },
              "Notion-Version": {
                "value": "2026-03-11"
              }
            },
            "items": "/results",
            "method": "POST",
            "url": "https://api.notion.com/v1/search"
          },
          "token_encoding": "json",
          "token_headers": {
            "Notion-Version": "2026-03-11"
          },
          "token_url": "https://api.notion.com/v1/oauth/token",
          "type": "oauth2"
        },
        "token": {
          "config": {
            "token": {
              "label": "Token",
              "required": true,
              "type": "secret"
            }
          },
          "label": "Internal connection or personal access token",
          "order": 2,
          "type": "manual"
        }
      },
      "files": [
        "connector.luau"
      ],
      "icon": "icon.svg",
      "name": "Notion",
      "proxy": [
        {
          "action": {
            "headers": {
              "set": {
                "Authorization": "Bearer {{auth.token.token}}",
                "Notion-Version": "2026-03-11"
              }
            }
          },
          "if": "{{ isDefined auth.token }}",
          "match": {
            "host": [
              "api.notion.com"
            ],
            "method": [
              "GET"
            ],
            "opaque_path_parameters": [
              "property_id"
            ],
            "path": [
              "/v1/pages/{page_id}/properties/{property_id}"
            ],
            "protocol": "http"
          }
        },
        {
          "action": {
            "headers": {
              "set": {
                "Authorization": "Bearer {{auth.oauth.access_token}}",
                "Notion-Version": "2026-03-11"
              }
            }
          },
          "if": "{{ isDefined auth.oauth }}",
          "match": {
            "host": [
              "api.notion.com"
            ],
            "method": [
              "GET"
            ],
            "opaque_path_parameters": [
              "property_id"
            ],
            "path": [
              "/v1/pages/{page_id}/properties/{property_id}"
            ],
            "protocol": "http"
          }
        },
        {
          "action": {
            "headers": {
              "set": {
                "Authorization": "Bearer {{auth.token.token || auth.oauth.access_token}}",
                "Notion-Version": "2026-03-11"
              }
            }
          },
          "if": "{{ isDefined auth.token }}",
          "match": {
            "host": [
              "api.notion.com"
            ],
            "method": [
              "GET"
            ],
            "path": [
              "/v1/agents/{agent_id}",
              "/v1/agents/{agent_id}/insights",
              "/v1/ai/plugins",
              "/v1/ai/plugins/{id}",
              "/v1/ai/skills/{id}",
              "/v1/async_tasks/{task_id}",
              "/v1/blocks/{block_id}",
              "/v1/blocks/{block_id}/children",
              "/v1/comments",
              "/v1/comments/{comment_id}",
              "/v1/custom_emojis",
              "/v1/data_sources/{data_source_id}",
              "/v1/data_sources/{data_source_id}/templates",
              "/v1/databases/{database_id}",
              "/v1/file_uploads",
              "/v1/file_uploads/{file_upload_id}",
              "/v1/pages/{page_id}",
              "/v1/pages/{page_id}/markdown",
              "/v1/sessions/{session_id}",
              "/v1/users",
              "/v1/users/me",
              "/v1/users/{user_id}",
              "/v1/views",
              "/v1/views/{view_id}",
              "/v1/views/{view_id}/queries/{query_id}"
            ],
            "protocol": "http"
          }
        },
        {
          "action": {
            "headers": {
              "set": {
                "Authorization": "Bearer {{auth.token.token || auth.oauth.access_token}}",
                "Notion-Version": "2026-03-11"
              }
            }
          },
          "if": "{{ isDefined auth.oauth }}",
          "match": {
            "host": [
              "api.notion.com"
            ],
            "method": [
              "GET"
            ],
            "path": [
              "/v1/agents/{agent_id}",
              "/v1/agents/{agent_id}/insights",
              "/v1/ai/plugins",
              "/v1/ai/plugins/{id}",
              "/v1/ai/skills/{id}",
              "/v1/async_tasks/{task_id}",
              "/v1/blocks/{block_id}",
              "/v1/blocks/{block_id}/children",
              "/v1/comments",
              "/v1/comments/{comment_id}",
              "/v1/custom_emojis",
              "/v1/data_sources/{data_source_id}",
              "/v1/data_sources/{data_source_id}/templates",
              "/v1/databases/{database_id}",
              "/v1/file_uploads",
              "/v1/file_uploads/{file_upload_id}",
              "/v1/pages/{page_id}",
              "/v1/pages/{page_id}/markdown",
              "/v1/sessions/{session_id}",
              "/v1/users",
              "/v1/users/me",
              "/v1/users/{user_id}",
              "/v1/views",
              "/v1/views/{view_id}",
              "/v1/views/{view_id}/queries/{query_id}"
            ],
            "protocol": "http"
          }
        },
        {
          "action": {
            "headers": {
              "set": {
                "Authorization": "Bearer {{auth.token.token || auth.oauth.access_token}}",
                "Notion-Version": "2026-03-11"
              }
            }
          },
          "if": "{{ isDefined auth.token }}",
          "match": {
            "host": [
              "api.notion.com"
            ],
            "method": [
              "POST"
            ],
            "path": [
              "/v1/agents/query",
              "/v1/blocks/meeting_notes/query",
              "/v1/data_sources/{data_source_id}/query",
              "/v1/search",
              "/v1/sessions/query",
              "/v1/sessions/{session_id}/events/query",
              "/v1/views/{view_id}/queries"
            ],
            "protocol": "http"
          }
        },
        {
          "action": {
            "headers": {
              "set": {
                "Authorization": "Bearer {{auth.token.token || auth.oauth.access_token}}",
                "Notion-Version": "2026-03-11"
              }
            }
          },
          "if": "{{ isDefined auth.oauth }}",
          "match": {
            "host": [
              "api.notion.com"
            ],
            "method": [
              "POST"
            ],
            "path": [
              "/v1/agents/query",
              "/v1/blocks/meeting_notes/query",
              "/v1/data_sources/{data_source_id}/query",
              "/v1/search",
              "/v1/sessions/query",
              "/v1/sessions/{session_id}/events/query",
              "/v1/views/{view_id}/queries"
            ],
            "protocol": "http"
          }
        },
        {
          "action": {
            "headers": {
              "set": {
                "Authorization": "Bearer {{auth.token.token || auth.oauth.access_token}}",
                "Notion-Version": "2026-03-11"
              }
            }
          },
          "if": "{{ and (isDefined auth.token) (allows access.data \"write\") }}",
          "match": {
            "host": [
              "api.notion.com"
            ],
            "method": [
              "POST"
            ],
            "path": [
              "/v1/agents/batch",
              "/v1/blocks/meeting_notes",
              "/v1/comments",
              "/v1/data_sources",
              "/v1/databases",
              "/v1/file_uploads",
              "/v1/file_uploads/{file_upload_id}/complete",
              "/v1/file_uploads/{file_upload_id}/send",
              "/v1/pages",
              "/v1/pages/{page_id}/move",
              "/v1/sessions",
              "/v1/sessions/{session_id}/cancel",
              "/v1/views"
            ],
            "protocol": "http"
          }
        },
        {
          "action": {
            "headers": {
              "set": {
                "Authorization": "Bearer {{auth.token.token || auth.oauth.access_token}}",
                "Notion-Version": "2026-03-11"
              }
            }
          },
          "if": "{{ and (isDefined auth.oauth) (allows access.data \"write\") }}",
          "match": {
            "host": [
              "api.notion.com"
            ],
            "method": [
              "POST"
            ],
            "path": [
              "/v1/agents/batch",
              "/v1/blocks/meeting_notes",
              "/v1/comments",
              "/v1/data_sources",
              "/v1/databases",
              "/v1/file_uploads",
              "/v1/file_uploads/{file_upload_id}/complete",
              "/v1/file_uploads/{file_upload_id}/send",
              "/v1/pages",
              "/v1/pages/{page_id}/move",
              "/v1/sessions",
              "/v1/sessions/{session_id}/cancel",
              "/v1/views"
            ],
            "protocol": "http"
          }
        },
        {
          "action": {
            "headers": {
              "set": {
                "Authorization": "Bearer {{auth.token.token || auth.oauth.access_token}}",
                "Notion-Version": "2026-03-11"
              }
            }
          },
          "if": "{{ and (isDefined auth.token) (allows access.data \"write\") }}",
          "match": {
            "host": [
              "api.notion.com"
            ],
            "method": [
              "PATCH"
            ],
            "path": [
              "/v1/agents/{agent_id}/credit_limit",
              "/v1/agents/{agent_id}/status",
              "/v1/blocks/{block_id}",
              "/v1/blocks/{block_id}/children",
              "/v1/comments/{comment_id}",
              "/v1/data_sources/{data_source_id}",
              "/v1/databases/{database_id}",
              "/v1/pages/{page_id}",
              "/v1/pages/{page_id}/markdown",
              "/v1/views/{view_id}"
            ],
            "protocol": "http"
          }
        },
        {
          "action": {
            "headers": {
              "set": {
                "Authorization": "Bearer {{auth.token.token || auth.oauth.access_token}}",
                "Notion-Version": "2026-03-11"
              }
            }
          },
          "if": "{{ and (isDefined auth.oauth) (allows access.data \"write\") }}",
          "match": {
            "host": [
              "api.notion.com"
            ],
            "method": [
              "PATCH"
            ],
            "path": [
              "/v1/agents/{agent_id}/credit_limit",
              "/v1/agents/{agent_id}/status",
              "/v1/blocks/{block_id}",
              "/v1/blocks/{block_id}/children",
              "/v1/comments/{comment_id}",
              "/v1/data_sources/{data_source_id}",
              "/v1/databases/{database_id}",
              "/v1/pages/{page_id}",
              "/v1/pages/{page_id}/markdown",
              "/v1/views/{view_id}"
            ],
            "protocol": "http"
          }
        },
        {
          "action": {
            "headers": {
              "set": {
                "Authorization": "Bearer {{auth.token.token || auth.oauth.access_token}}",
                "Notion-Version": "2026-03-11"
              }
            }
          },
          "if": "{{ and (isDefined auth.token) (allows access.data \"write\") }}",
          "match": {
            "host": [
              "api.notion.com"
            ],
            "method": [
              "DELETE"
            ],
            "path": [
              "/v1/agents/{agent_id}",
              "/v1/blocks/{block_id}",
              "/v1/comments/{comment_id}",
              "/v1/views/{view_id}",
              "/v1/views/{view_id}/queries/{query_id}"
            ],
            "protocol": "http"
          }
        },
        {
          "action": {
            "headers": {
              "set": {
                "Authorization": "Bearer {{auth.token.token || auth.oauth.access_token}}",
                "Notion-Version": "2026-03-11"
              }
            }
          },
          "if": "{{ and (isDefined auth.oauth) (allows access.data \"write\") }}",
          "match": {
            "host": [
              "api.notion.com"
            ],
            "method": [
              "DELETE"
            ],
            "path": [
              "/v1/agents/{agent_id}",
              "/v1/blocks/{block_id}",
              "/v1/comments/{comment_id}",
              "/v1/views/{view_id}",
              "/v1/views/{view_id}/queries/{query_id}"
            ],
            "protocol": "http"
          }
        },
        {
          "action": {
            "headers": {
              "set": {
                "Authorization": "Bearer {{auth.admin.token}}",
                "Notion-Version": "2026-06-01"
              }
            }
          },
          "if": "{{ isDefined auth.admin }}",
          "match": {
            "host": [
              "api.notion.com"
            ],
            "method": [
              "GET"
            ],
            "path": [
              "/admin/v1/analytics/reports",
              "/admin/v1/legal_holds",
              "/admin/v1/legal_holds/{legal_hold_id}",
              "/admin/v1/legal_holds/{legal_hold_id}/spaces/{space_id}/pages",
              "/admin/v1/legal_holds/{legal_hold_id}/users",
              "/admin/v1/legal_holds/{legal_hold_id}/workspaces",
              "/admin/v1/mcp_client_connections",
              "/admin/v1/spaces/{space_id}/agents",
              "/admin/v1/spaces/{space_id}/agents/credit_usage",
              "/admin/v1/spaces/{space_id}/agents/{agent_id}/credit_usage",
              "/admin/v1/spaces/{space_id}/agents/{agent_id}/permissions",
              "/admin/v1/spaces/{space_id}/exports/{export_job_id}",
              "/admin/v1/spaces/{space_id}/groups",
              "/admin/v1/spaces/{space_id}/groups/{group_id}",
              "/admin/v1/spaces/{space_id}/groups/{group_id}/members",
              "/admin/v1/spaces/{space_id}/personal_access_tokens",
              "/admin/v1/spaces/{space_id}/users"
            ],
            "protocol": "http"
          }
        },
        {
          "action": {
            "headers": {
              "set": {
                "Authorization": "Bearer {{auth.admin.token}}",
                "Notion-Version": "2026-06-01"
              }
            }
          },
          "if": "{{ and (isDefined auth.admin) (allows access.data \"write\") }}",
          "match": {
            "host": [
              "api.notion.com"
            ],
            "method": [
              "POST"
            ],
            "path": [
              "/admin/v1/legal_holds",
              "/admin/v1/legal_holds/{legal_hold_id}/export",
              "/admin/v1/legal_holds/{legal_hold_id}/release",
              "/admin/v1/legal_holds/{legal_hold_id}/users",
              "/admin/v1/managed_users/revoke_session",
              "/admin/v1/mcp_client_connections/revoke",
              "/admin/v1/spaces/{space_id}/exports",
              "/admin/v1/spaces/{space_id}/groups",
              "/admin/v1/spaces/{space_id}/groups/{group_id}/members"
            ],
            "protocol": "http"
          }
        },
        {
          "action": {
            "headers": {
              "set": {
                "Authorization": "Bearer {{auth.admin.token}}",
                "Notion-Version": "2026-06-01"
              }
            }
          },
          "if": "{{ and (isDefined auth.admin) (allows access.data \"write\") }}",
          "match": {
            "host": [
              "api.notion.com"
            ],
            "method": [
              "PATCH"
            ],
            "path": [
              "/admin/v1/legal_holds/{legal_hold_id}",
              "/admin/v1/spaces/{space_id}/agents/creation_policy",
              "/admin/v1/spaces/{space_id}/agents/{agent_id}/permissions",
              "/admin/v1/spaces/{space_id}/agents/{agent_id}/status",
              "/admin/v1/spaces/{space_id}/credit_limit",
              "/admin/v1/spaces/{space_id}/groups/{group_id}",
              "/admin/v1/spaces/{space_id}/groups/{group_id}/members/users/{user_id}"
            ],
            "protocol": "http"
          }
        },
        {
          "action": {
            "headers": {
              "set": {
                "Authorization": "Bearer {{auth.admin.token}}",
                "Notion-Version": "2026-06-01"
              }
            }
          },
          "if": "{{ and (isDefined auth.admin) (allows access.data \"write\") }}",
          "match": {
            "host": [
              "api.notion.com"
            ],
            "method": [
              "PUT"
            ],
            "path": [
              "/admin/v1/mcp_client_connections/enterprise_managed_access",
              "/admin/v1/spaces/{space_id}/agents/{agent_id}/credit_limit"
            ],
            "protocol": "http"
          }
        },
        {
          "action": {
            "headers": {
              "set": {
                "Authorization": "Bearer {{auth.admin.token}}",
                "Notion-Version": "2026-06-01"
              }
            }
          },
          "if": "{{ and (isDefined auth.admin) (allows access.data \"write\") }}",
          "match": {
            "host": [
              "api.notion.com"
            ],
            "method": [
              "DELETE"
            ],
            "path": [
              "/admin/v1/legal_holds/{legal_hold_id}/users/{user_id}",
              "/admin/v1/spaces/{space_id}/agents/{agent_id}",
              "/admin/v1/spaces/{space_id}/groups/{group_id}",
              "/admin/v1/spaces/{space_id}/groups/{group_id}/members/users/{user_id}",
              "/admin/v1/spaces/{space_id}/personal_access_tokens/{bot_id}"
            ],
            "protocol": "http"
          }
        },
        {
          "action": {
            "headers": {
              "remove": [
                "Authorization",
                "Notion-Version"
              ]
            }
          },
          "match": {
            "host": [
              "s3.us-west-2.amazonaws.com",
              "s3-us-west-2.amazonaws.com"
            ],
            "method": [
              "GET"
            ],
            "opaque_path_parameters": [
              "*"
            ],
            "path": [
              "/secure.notion-static.com/*",
              "/public.notion-static.com/*",
              "/notion-temporary-files/*"
            ],
            "protocol": "http"
          }
        },
        {
          "action": {
            "headers": {
              "remove": [
                "Authorization",
                "Notion-Version"
              ]
            }
          },
          "match": {
            "host": [
              "prod-files-secure.s3.us-west-2.amazonaws.com",
              "prod-files-secure-euc1.s3.eu-central-1.amazonaws.com",
              "prod-files-secure-apne1.s3.ap-northeast-1.amazonaws.com",
              "prod-files-secure-apne2.s3.ap-northeast-2.amazonaws.com",
              "prod-notion-temporary-files-euc1.s3.eu-central-1.amazonaws.com",
              "prod-notion-temporary-files-apne1.s3.ap-northeast-1.amazonaws.com",
              "prod-notion-temporary-files-apne2.s3.ap-northeast-2.amazonaws.com",
              "notion-production-snapshots-2.s3.us-west-2.amazonaws.com",
              "file.notion.so",
              "file.notion.com"
            ],
            "method": [
              "GET"
            ],
            "opaque_path_parameters": [
              "*"
            ],
            "path": [
              "/*"
            ],
            "protocol": "http"
          }
        }
      ],
      "publisher": {
        "client_id": {
          "label": "Notion OAuth client ID",
          "order": 1,
          "type": "string"
        },
        "client_secret": {
          "label": "Notion OAuth client secret",
          "order": 2,
          "type": "secret"
        }
      },
      "schema_version": 2
    }
    
  • icon.svgicon.svg
  • lib
    • admin.luau
      -- Explicit public operations, checked against Notion's official OpenAPI on 2026-10-10.
      -- Fields not used in the URL are passed unchanged in the JSON body.
      return {
      	adminListAnalyticsReports = {method = "GET", path = "/admin/v1/analytics/reports", body = false, query = {"workspace_id", "page_size", "start_cursor"}, required = {"workspace_id"}, help = "List analytics reports. opts: {workspace_id, page_size?, start_cursor?}. https://developers.notion.com/reference/admin/list-analytics-reports"},
      	adminListLegalHolds = {method = "GET", path = "/admin/v1/legal_holds", body = false, query = {"start_cursor", "user_id"}, required = {}, help = "List legal holds. opts: {start_cursor?, user_id?}. https://developers.notion.com/reference/admin/list-legal-holds"},
      	adminCreateLegalHold = {method = "POST", path = "/admin/v1/legal_holds", access = "data:write", body = true, query = {}, required = {}, help = "Create a legal hold. opts: {description, end_date, icon, name, start_date, user_ids, user_interaction_type}. https://developers.notion.com/reference/admin/create-legal-hold"},
      	adminGetLegalHold = {method = "GET", path = "/admin/v1/legal_holds/{legal_hold_id}", body = false, query = {}, required = {}, help = "Retrieve a legal hold. opts: {legal_hold_id}. https://developers.notion.com/reference/admin/get-legal-hold"},
      	adminUpdateLegalHold = {method = "PATCH", path = "/admin/v1/legal_holds/{legal_hold_id}", access = "data:write", body = true, query = {}, required = {}, help = "Update a legal hold. opts: {legal_hold_id, description, icon, name}. https://developers.notion.com/reference/admin/update-legal-hold"},
      	adminExportLegalHold = {method = "POST", path = "/admin/v1/legal_holds/{legal_hold_id}/export", access = "data:write", body = true, query = {}, required = {}, help = "Export a legal hold. opts: {legal_hold_id, legal_hold_export_id, requesting_user_id, space_id}. https://developers.notion.com/reference/admin/export-legal-hold"},
      	adminReleaseLegalHold = {method = "POST", path = "/admin/v1/legal_holds/{legal_hold_id}/release", access = "data:write", body = false, query = {}, required = {}, help = "Release a legal hold. opts: {legal_hold_id}. https://developers.notion.com/reference/admin/release-legal-hold"},
      	adminListLegalHoldPages = {method = "GET", path = "/admin/v1/legal_holds/{legal_hold_id}/spaces/{space_id}/pages", body = false, query = {"start_cursor"}, required = {}, help = "List pages on a legal hold. opts: {legal_hold_id, space_id, start_cursor?}. https://developers.notion.com/reference/admin/list-legal-hold-pages"},
      	adminListLegalHoldUsers = {method = "GET", path = "/admin/v1/legal_holds/{legal_hold_id}/users", body = false, query = {"start_cursor"}, required = {}, help = "List users on a legal hold. opts: {legal_hold_id, start_cursor?}. https://developers.notion.com/reference/admin/list-legal-hold-users"},
      	adminAddLegalHoldUsers = {method = "POST", path = "/admin/v1/legal_holds/{legal_hold_id}/users", access = "data:write", body = true, query = {}, required = {}, help = "Add users to a legal hold. opts: {legal_hold_id, user_ids}. https://developers.notion.com/reference/admin/add-legal-hold-users"},
      	adminRemoveLegalHoldUser = {method = "DELETE", path = "/admin/v1/legal_holds/{legal_hold_id}/users/{user_id}", access = "data:write", body = false, query = {}, required = {}, help = "Remove a user from a legal hold. opts: {legal_hold_id, user_id}. https://developers.notion.com/reference/admin/remove-legal-hold-user"},
      	adminListLegalHoldWorkspaces = {method = "GET", path = "/admin/v1/legal_holds/{legal_hold_id}/workspaces", body = false, query = {"start_cursor"}, required = {}, help = "List workspaces on a legal hold. opts: {legal_hold_id, start_cursor?}. https://developers.notion.com/reference/admin/list-legal-hold-workspaces"},
      	adminRevokeUserSession = {method = "POST", path = "/admin/v1/managed_users/revoke_session", access = "data:write", body = true, query = {}, required = {}, help = "Revoke a managed user's sessions. opts: {user}. https://developers.notion.com/reference/admin/revoke-user-session"},
      	adminListMcpClientConnections = {method = "GET", path = "/admin/v1/mcp_client_connections", body = false, query = {"start_cursor", "cursor", "page_size", "user_ids", "workspace_ids"}, required = {}, help = "List MCP client connections in an organization. opts: {start_cursor?, cursor?, page_size?, user_ids?, workspace_ids?}. https://developers.notion.com/reference/admin/list-mcp-client-connections"},
      	adminUpdateMcpClientConnectionEnterpriseManagedAccess = {method = "PUT", path = "/admin/v1/mcp_client_connections/enterprise_managed_access", access = "data:write", body = true, query = {}, required = {}, help = "Deny or restore enterprise-managed MCP client access. opts: {access, user_id, workspace_id}. https://developers.notion.com/reference/admin/update-mcp-client-connection-enterprise-managed-access"},
      	adminRevokeMcpClientConnection = {method = "POST", path = "/admin/v1/mcp_client_connections/revoke", access = "data:write", body = true, query = {}, required = {}, help = "Revoke an MCP client connection. opts: {client_key, user_id, workspace_id}. https://developers.notion.com/reference/admin/revoke-mcp-client-connection"},
      	adminGetWorkflowsMetadataForSpace = {method = "GET", path = "/admin/v1/spaces/{space_id}/agents", body = false, query = {"name", "created_by_ids", "created_time_from", "created_time_to", "last_edited_time_from", "last_edited_time_to", "credit_usage_time_from", "credit_usage_time_to", "status", "integration_types", "mcp_server_names", "models", "shared_with_user_ids", "shared_with_group_ids", "cursor", "page_size"}, required = {}, help = "Get agents in a space. opts: {space_id, name?, created_by_ids?, created_time_from?, created_time_to?, last_edited_time_from?, last_edited_time_to?, credit_usage_time_from?, credit_usage_time_to?, status?, integration_types?, mcp_server_names?, models?, shared_with_user_ids?, shared_with_group_ids?, cursor?, page_size?}. https://developers.notion.com/reference/admin/get-workflows-metadata-for-space"},
      	adminUpdateAgentCreationPolicy = {method = "PATCH", path = "/admin/v1/spaces/{space_id}/agents/creation_policy", access = "data:write", body = true, query = {}, required = {}, help = "Update who can create agents in a space. opts: {space_id, disable_existing_agents, policy}. https://developers.notion.com/reference/admin/update-agent-creation-policy"},
      	adminGetAgentsCreditUsage = {method = "GET", path = "/admin/v1/spaces/{space_id}/agents/credit_usage", body = false, query = {"cursor", "page_size", "include_deleted", "credit_usage_time_from", "credit_usage_time_to"}, required = {}, help = "Get credit usage for agents in a space. opts: {space_id, cursor?, page_size?, include_deleted?, credit_usage_time_from?, credit_usage_time_to?}. https://developers.notion.com/reference/admin/get-agents-credit-usage"},
      	adminDeleteAgent = {method = "DELETE", path = "/admin/v1/spaces/{space_id}/agents/{agent_id}", access = "data:write", body = false, query = {}, required = {}, help = "Delete an agent in a space. opts: {agent_id, space_id}. https://developers.notion.com/reference/admin/delete-agent"},
      	adminUpdateAgentCreditLimit = {method = "PUT", path = "/admin/v1/spaces/{space_id}/agents/{agent_id}/credit_limit", access = "data:write", body = true, query = {}, required = {}, help = "Update credit limit for an agent in a space. opts: {agent_id, space_id, credit_limit}. https://developers.notion.com/reference/admin/update-agent-credit-limit"},
      	adminGetAgentCreditUsage = {method = "GET", path = "/admin/v1/spaces/{space_id}/agents/{agent_id}/credit_usage", body = false, query = {"start_cursor"}, required = {}, help = "Get credit usage for an agent in a space. opts: {agent_id, space_id, start_cursor?}. https://developers.notion.com/reference/admin/get-agent-credit-usage"},
      	adminGetAgentPermissions = {method = "GET", path = "/admin/v1/spaces/{space_id}/agents/{agent_id}/permissions", body = false, query = {"cursor"}, required = {}, help = "Get a custom agent's sharing permissions. opts: {agent_id, space_id, cursor?}. https://developers.notion.com/reference/admin/get-agent-permissions"},
      	adminUpdateAgentPermissions = {method = "PATCH", path = "/admin/v1/spaces/{space_id}/agents/{agent_id}/permissions", access = "data:write", body = true, query = {}, required = {}, help = "Update a custom agent's sharing permissions. opts: {agent_id, space_id, remove, set}. https://developers.notion.com/reference/admin/update-agent-permissions"},
      	adminUpdateAgentStatus = {method = "PATCH", path = "/admin/v1/spaces/{space_id}/agents/{agent_id}/status", access = "data:write", body = true, query = {}, required = {}, help = "Disable or re-enable an agent in a space. opts: {agent_id, space_id, admin_status}. https://developers.notion.com/reference/admin/update-agent-status"},
      	adminUpdateWorkspaceCreditLimit = {method = "PATCH", path = "/admin/v1/spaces/{space_id}/credit_limit", access = "data:write", body = true, query = {}, required = {}, help = "Update the default agent credit limit for a workspace. opts: {space_id, default_agent_credit_limit}. https://developers.notion.com/reference/admin/update-workspace-credit-limit"},
      	adminEnqueueSpaceExport = {method = "POST", path = "/admin/v1/spaces/{space_id}/exports", access = "data:write", body = true, query = {}, required = {}, help = "Enqueue a workspace export. opts: {space_id, collection_view_export_type, export_type, flatten_export_filetree, include_comments, include_contents, locale, on_behalf_of_user_email, teamspace_ids, time_zone}. https://developers.notion.com/reference/admin/enqueue-space-export"},
      	adminGetSpaceExportStatus = {method = "GET", path = "/admin/v1/spaces/{space_id}/exports/{export_job_id}", body = false, query = {}, required = {}, help = "Get workspace export status. opts: {export_job_id, space_id}. https://developers.notion.com/reference/admin/get-space-export-status"},
      	adminListPermissionGroups = {method = "GET", path = "/admin/v1/spaces/{space_id}/groups", body = false, query = {"page_size", "start_cursor"}, required = {}, help = "List groups. opts: {space_id, page_size?, start_cursor?}. https://developers.notion.com/reference/admin/list-permission-groups"},
      	adminCreatePermissionGroup = {method = "POST", path = "/admin/v1/spaces/{space_id}/groups", access = "data:write", body = true, query = {}, required = {}, help = "Create a group. opts: {space_id, name}. https://developers.notion.com/reference/admin/create-permission-group"},
      	adminRetrievePermissionGroup = {method = "GET", path = "/admin/v1/spaces/{space_id}/groups/{group_id}", body = false, query = {}, required = {}, help = "Retrieve a group. opts: {group_id, space_id}. https://developers.notion.com/reference/admin/retrieve-permission-group"},
      	adminUpdatePermissionGroup = {method = "PATCH", path = "/admin/v1/spaces/{space_id}/groups/{group_id}", access = "data:write", body = true, query = {}, required = {}, help = "Update a group. opts: {group_id, space_id, name}. https://developers.notion.com/reference/admin/update-permission-group"},
      	adminDeletePermissionGroup = {method = "DELETE", path = "/admin/v1/spaces/{space_id}/groups/{group_id}", access = "data:write", body = false, query = {"transfer_to_owner_id"}, required = {}, help = "Delete a group. opts: {group_id, space_id, transfer_to_owner_id?}. https://developers.notion.com/reference/admin/delete-permission-group"},
      	adminListPermissionGroupMembers = {method = "GET", path = "/admin/v1/spaces/{space_id}/groups/{group_id}/members", body = false, query = {"page_size", "start_cursor"}, required = {}, help = "List group members. opts: {group_id, space_id, page_size?, start_cursor?}. https://developers.notion.com/reference/admin/list-permission-group-members"},
      	adminAddPermissionGroupMember = {method = "POST", path = "/admin/v1/spaces/{space_id}/groups/{group_id}/members", access = "data:write", body = true, query = {}, required = {}, help = "Add a group member. opts: {group_id, space_id, member, role}. https://developers.notion.com/reference/admin/add-permission-group-member"},
      	adminUpdatePermissionGroupMember = {method = "PATCH", path = "/admin/v1/spaces/{space_id}/groups/{group_id}/members/users/{user_id}", access = "data:write", body = true, query = {}, required = {}, help = "Update a group member. opts: {group_id, user_id, space_id, role}. https://developers.notion.com/reference/admin/update-permission-group-member"},
      	adminRemovePermissionGroupMember = {method = "DELETE", path = "/admin/v1/spaces/{space_id}/groups/{group_id}/members/users/{user_id}", access = "data:write", body = false, query = {}, required = {}, help = "Remove a group member. opts: {group_id, user_id, space_id}. https://developers.notion.com/reference/admin/remove-permission-group-member"},
      	adminListPersonalAccessTokens = {method = "GET", path = "/admin/v1/spaces/{space_id}/personal_access_tokens", body = false, query = {"start_cursor", "cursor", "page_size", "status", "creator_ids", "search"}, required = {}, help = "List personal access tokens in a workspace. opts: {space_id, start_cursor?, cursor?, page_size?, status?, creator_ids?, search?}. https://developers.notion.com/reference/admin/list-personal-access-tokens"},
      	adminRevokePersonalAccessToken = {method = "DELETE", path = "/admin/v1/spaces/{space_id}/personal_access_tokens/{bot_id}", access = "data:write", body = false, query = {}, required = {}, help = "Revoke a personal access token in a workspace. opts: {bot_id, space_id}. https://developers.notion.com/reference/admin/revoke-personal-access-token"},
      	adminListUsers = {method = "GET", path = "/admin/v1/spaces/{space_id}/users", body = false, query = {"start_cursor", "page_size"}, required = {}, help = "List users. opts: {space_id, start_cursor?, page_size?}. https://developers.notion.com/reference/admin/list-users"},
      }
      
    • endpoints.luau
      -- Explicit public operations, checked against Notion's official OpenAPI on 2026-10-10.
      -- Fields not used in the URL are passed unchanged in the JSON body.
      return {
      	batchManageAgents = {method = "POST", path = "/v1/agents/batch", access = "data:write", body = true, query = {}, required = {}, help = "Apply many agent operations. opts: {operations}. https://developers.notion.com/reference/notion-agent-apis/batch-manage-agent"},
      	queryAgents = {method = "POST", path = "/v1/agents/query", body = true, query = {}, required = {}, help = "Query agents. opts: {filter, include_deleted, page_size, query, sorts, start_cursor, verbose}. https://developers.notion.com/reference/notion-agent-apis/query-agents"},
      	getAgent = {method = "GET", path = "/v1/agents/{agent_id}", body = false, query = {"verbose"}, required = {}, help = "Get agent. opts: {agent_id, verbose?}. https://developers.notion.com/reference/notion-agent-apis/retrieve-agent"},
      	deleteAgent = {method = "DELETE", path = "/v1/agents/{agent_id}", access = "data:write", body = false, query = {}, required = {}, help = "Delete agent. opts: {agent_id}. https://developers.notion.com/reference/notion-agent-apis/delete-agent"},
      	updateAgentCreditLimit = {method = "PATCH", path = "/v1/agents/{agent_id}/credit_limit", access = "data:write", body = true, query = {}, required = {}, help = "Update agent credit limit. opts: {agent_id, credit_limit}. https://developers.notion.com/reference/notion-agent-apis/update-agent-credit-limit"},
      	getAgentInsights = {method = "GET", path = "/v1/agents/{agent_id}/insights", body = false, query = {"start_time", "end_time"}, required = {}, help = "Get agent insights. opts: {agent_id, start_time?, end_time?}. https://developers.notion.com/reference/notion-agent-apis/retrieve-agent-insights"},
      	updateAgentStatus = {method = "PATCH", path = "/v1/agents/{agent_id}/status", access = "data:write", body = true, query = {}, required = {}, help = "Update agent status. opts: {agent_id, status}. https://developers.notion.com/reference/notion-agent-apis/update-agent-status"},
      	listPlugins = {method = "GET", path = "/v1/ai/plugins", body = false, query = {"page_size", "start_cursor"}, required = {}, help = "List skills plugins. opts: {page_size?, start_cursor?}. https://developers.notion.com/reference/agent-skills/list-skills-plugins"},
      	getPlugin = {method = "GET", path = "/v1/ai/plugins/{id}", body = false, query = {}, required = {}, help = "Get a plugin directory. opts: {id}. https://developers.notion.com/reference/agent-skills/get-plugin-directory"},
      	getSkill = {method = "GET", path = "/v1/ai/skills/{id}", body = false, query = {}, required = {}, help = "Get a skill directory. opts: {id}. https://developers.notion.com/reference/agent-skills/get-skill-directory"},
      	getAsyncTask = {method = "GET", path = "/v1/async_tasks/{task_id}", body = false, query = {}, required = {}, help = "Retrieve an async task. opts: {task_id}. https://developers.notion.com/reference/retrieve-async-task"},
      	createMeetingNote = {method = "POST", path = "/v1/blocks/meeting_notes", access = "data:write", body = true, query = {}, required = {}, help = "Create a meeting note. opts: {language, options, parent, source, title}. https://developers.notion.com/reference/create-meeting-note"},
      	queryMeetingNotes = {method = "POST", path = "/v1/blocks/meeting_notes/query", body = true, query = {}, required = {}, help = "Query meeting notes. opts: {filter, limit, sort}. https://developers.notion.com/reference/query-meeting-notes"},
      	getBlock = {method = "GET", path = "/v1/blocks/{block_id}", body = false, query = {}, required = {}, help = "Retrieve a block. opts: {block_id}. https://developers.notion.com/reference/retrieve-a-block"},
      	updateBlock = {method = "PATCH", path = "/v1/blocks/{block_id}", access = "data:write", body = true, query = {}, required = {}, help = "Update a block. opts: {block_id, audio, bookmark, breadcrumb, bulleted_list_item, callout, code, column, divider, embed, equation, file, heading_1, heading_2, heading_3, heading_4, image, in_trash, link_to_page, numbered_list_item, paragraph, pdf, quote, synced_block, tab, table, table_of_contents, table_row, template, to_do, toggle, type, video}. https://developers.notion.com/reference/update-a-block"},
      	deleteBlock = {method = "DELETE", path = "/v1/blocks/{block_id}", access = "data:write", body = false, query = {}, required = {}, help = "Delete a block. opts: {block_id}. https://developers.notion.com/reference/delete-a-block"},
      	listBlockChildren = {method = "GET", path = "/v1/blocks/{block_id}/children", body = false, query = {"start_cursor", "page_size"}, required = {}, help = "Retrieve block children. opts: {block_id, start_cursor?, page_size?}. https://developers.notion.com/reference/get-block-children"},
      	appendBlockChildren = {method = "PATCH", path = "/v1/blocks/{block_id}/children", access = "data:write", body = true, query = {}, required = {}, help = "Append block children. opts: {block_id, children, notifications, position}. https://developers.notion.com/reference/patch-block-children"},
      	listComments = {method = "GET", path = "/v1/comments", body = false, query = {"block_id", "start_cursor", "page_size"}, required = {"block_id"}, help = "List comments. opts: {block_id, start_cursor?, page_size?}. https://developers.notion.com/reference/list-comments"},
      	createComment = {method = "POST", path = "/v1/comments", access = "data:write", body = true, query = {}, required = {}, help = "Create a comment. opts: {attachments, discussion_id, display_name, markdown, markdown_version, parent, rich_text}. https://developers.notion.com/reference/create-a-comment"},
      	getComment = {method = "GET", path = "/v1/comments/{comment_id}", body = false, query = {}, required = {}, help = "Retrieve a comment. opts: {comment_id}. https://developers.notion.com/reference/retrieve-comment"},
      	updateComment = {method = "PATCH", path = "/v1/comments/{comment_id}", access = "data:write", body = true, query = {}, required = {}, help = "Update a comment. opts: {comment_id, markdown, markdown_version, rich_text}. https://developers.notion.com/reference/update-a-comment"},
      	deleteComment = {method = "DELETE", path = "/v1/comments/{comment_id}", access = "data:write", body = false, query = {}, required = {}, help = "Delete a comment. opts: {comment_id}. https://developers.notion.com/reference/delete-a-comment"},
      	listCustomEmojis = {method = "GET", path = "/v1/custom_emojis", body = false, query = {"start_cursor", "page_size", "name"}, required = {}, help = "List custom emojis. opts: {start_cursor?, page_size?, name?}. https://developers.notion.com/reference/list-custom-emojis"},
      	createDataSource = {method = "POST", path = "/v1/data_sources", access = "data:write", body = true, query = {}, required = {}, help = "Create a data source. opts: {icon, parent, properties, title}. https://developers.notion.com/reference/create-a-data-source"},
      	getDataSource = {method = "GET", path = "/v1/data_sources/{data_source_id}", body = false, query = {}, required = {}, help = "Retrieve a data source. opts: {data_source_id}. https://developers.notion.com/reference/retrieve-a-data-source"},
      	updateDataSource = {method = "PATCH", path = "/v1/data_sources/{data_source_id}", access = "data:write", body = true, query = {}, required = {}, help = "Update a data source. opts: {data_source_id, icon, in_trash, parent, properties, title}. https://developers.notion.com/reference/update-a-data-source"},
      	queryDataSource = {method = "POST", path = "/v1/data_sources/{data_source_id}/query", body = true, query = {"filter_properties"}, required = {}, help = "Query a data source. opts: {data_source_id, filter_properties?, filter, is_archived, page_size, result_type, sorts, start_cursor}. https://developers.notion.com/reference/query-a-data-source"},
      	listDataSourceTemplates = {method = "GET", path = "/v1/data_sources/{data_source_id}/templates", body = false, query = {"name", "start_cursor", "page_size"}, required = {}, help = "List templates in a data source. opts: {data_source_id, name?, start_cursor?, page_size?}. https://developers.notion.com/reference/list-data-source-templates"},
      	createDatabase = {method = "POST", path = "/v1/databases", access = "data:write", body = true, query = {}, required = {}, help = "Create a database. opts: {cover, database_type, description, icon, initial_data_source, is_inline, parent, title}. https://developers.notion.com/reference/create-database"},
      	getDatabase = {method = "GET", path = "/v1/databases/{database_id}", body = false, query = {}, required = {}, help = "Retrieve a database. opts: {database_id}. https://developers.notion.com/reference/retrieve-database"},
      	updateDatabase = {method = "PATCH", path = "/v1/databases/{database_id}", access = "data:write", body = true, query = {}, required = {}, help = "Update a database. opts: {database_id, cover, description, icon, in_trash, is_inline, is_locked, parent, title}. https://developers.notion.com/reference/update-database"},
      	listFileUploads = {method = "GET", path = "/v1/file_uploads", body = false, query = {"status", "start_cursor", "page_size"}, required = {}, help = "List file uploads. opts: {status?, start_cursor?, page_size?}. https://developers.notion.com/reference/list-file-uploads"},
      	createFileUpload = {method = "POST", path = "/v1/file_uploads", access = "data:write", body = true, query = {}, required = {}, help = "Create a file upload. opts: {content_type, external_url, filename, mode, number_of_parts}. https://developers.notion.com/reference/create-file"},
      	getFileUpload = {method = "GET", path = "/v1/file_uploads/{file_upload_id}", body = false, query = {}, required = {}, help = "Retrieve a file upload. opts: {file_upload_id}. https://developers.notion.com/reference/retrieve-file-upload"},
      	completeFileUpload = {method = "POST", path = "/v1/file_uploads/{file_upload_id}/complete", access = "data:write", body = false, query = {}, required = {}, help = "Complete a multi-part file upload. opts: {file_upload_id}. https://developers.notion.com/reference/complete-file-upload"},
      	sendFileUpload = {method = "POST", path = "/v1/file_uploads/{file_upload_id}/send", access = "data:write", body = false, query = {}, required = {}, help = "Upload a file. opts: {file_upload_id}. https://developers.notion.com/reference/upload-file"},
      	createPage = {method = "POST", path = "/v1/pages", access = "data:write", body = true, query = {"filter_properties"}, required = {}, help = "Create a page. opts: {filter_properties?, allow_async, children, content, cover, icon, markdown, markdown_version, notifications, parent, position, properties, template}. https://developers.notion.com/reference/post-page"},
      	getPage = {method = "GET", path = "/v1/pages/{page_id}", body = false, query = {"filter_properties"}, required = {}, help = "Retrieve a page. opts: {page_id, filter_properties?}. https://developers.notion.com/reference/retrieve-a-page"},
      	updatePage = {method = "PATCH", path = "/v1/pages/{page_id}", access = "data:write", body = true, query = {"filter_properties"}, required = {}, help = "Update page. opts: {page_id, filter_properties?, cover, erase_content, icon, in_trash, is_archived, is_locked, notifications, properties, template}. https://developers.notion.com/reference/patch-page"},
      	getPageMarkdown = {method = "GET", path = "/v1/pages/{page_id}/markdown", body = false, query = {"include_transcript", "markdown_version"}, required = {}, help = "Retrieve a page as markdown. opts: {page_id, include_transcript?, markdown_version?}. https://developers.notion.com/reference/retrieve-page-markdown"},
      	updatePageMarkdown = {method = "PATCH", path = "/v1/pages/{page_id}/markdown", access = "data:write", body = true, query = {}, required = {}, help = "Update a page's content as markdown. opts: {page_id, allow_async, insert_content, markdown_version, replace_content, replace_content_range, type, update_content}. https://developers.notion.com/reference/update-page-markdown"},
      	movePage = {method = "POST", path = "/v1/pages/{page_id}/move", access = "data:write", body = true, query = {}, required = {}, help = "Move a page. opts: {page_id, parent}. https://developers.notion.com/reference/move-page"},
      	getPageProperty = {method = "GET", path = "/v1/pages/{page_id}/properties/{property_id}", body = false, query = {"start_cursor", "page_size"}, required = {}, help = "Retrieve a page property item. opts: {page_id, property_id, start_cursor?, page_size?}. https://developers.notion.com/reference/retrieve-a-page-property"},
      	search = {method = "POST", path = "/v1/search", body = true, query = {}, required = {}, help = "Search by title. opts: {filter, page_size, query, sort, start_cursor}. https://developers.notion.com/reference/post-search"},
      	updateSession = {method = "POST", path = "/v1/sessions", access = "data:write", body = true, query = {}, required = {}, help = "Update a session. opts: {actions, agent_id, attachments, message, metadata, prompt_context, session_id}. Use streamSession for continue_from replay. https://developers.notion.com/reference/notion-agent-apis/update-session"},
      	querySessions = {method = "POST", path = "/v1/sessions/query", body = true, query = {}, required = {}, help = "Query sessions. opts: {filter, page_size, query, sorts, start_cursor}. https://developers.notion.com/reference/notion-agent-apis/query-sessions"},
      	getSession = {method = "GET", path = "/v1/sessions/{session_id}", body = false, query = {}, required = {}, help = "Retrieve a session. opts: {session_id}. https://developers.notion.com/reference/notion-agent-apis/retrieve-session"},
      	cancelSession = {method = "POST", path = "/v1/sessions/{session_id}/cancel", access = "data:write", body = true, query = {}, required = {}, help = "Cancel a session. opts: {session_id, event_id}. https://developers.notion.com/reference/notion-agent-apis/cancel-session"},
      	querySessionEvents = {method = "POST", path = "/v1/sessions/{session_id}/events/query", body = true, query = {}, required = {}, help = "Query session events. opts: {session_id, filter, page_size, sorts, start_cursor}. https://developers.notion.com/reference/notion-agent-apis/query-session-events"},
      	listUsers = {method = "GET", path = "/v1/users", body = false, query = {"start_cursor", "page_size"}, required = {}, help = "List all users. opts: {start_cursor?, page_size?}. https://developers.notion.com/reference/get-users"},
      	getSelf = {method = "GET", path = "/v1/users/me", body = false, query = {}, required = {}, help = "Retrieve your token's bot user. opts: {}. https://developers.notion.com/reference/get-self"},
      	getUser = {method = "GET", path = "/v1/users/{user_id}", body = false, query = {}, required = {}, help = "Retrieve a user. opts: {user_id}. https://developers.notion.com/reference/get-user"},
      	listViews = {method = "GET", path = "/v1/views", body = false, query = {"database_id", "data_source_id", "start_cursor", "page_size"}, required = {}, help = "List views. opts: {database_id?, data_source_id?, start_cursor?, page_size?}. https://developers.notion.com/reference/list-views"},
      	createView = {method = "POST", path = "/v1/views", access = "data:write", body = true, query = {}, required = {}, help = "Create a view. opts: {configuration, create_database, data_source_id, database_id, filter, name, placement, position, quick_filters, sorts, type, view_id}. https://developers.notion.com/reference/create-view"},
      	getView = {method = "GET", path = "/v1/views/{view_id}", body = false, query = {}, required = {}, help = "Retrieve a view. opts: {view_id}. https://developers.notion.com/reference/retrieve-a-view"},
      	updateView = {method = "PATCH", path = "/v1/views/{view_id}", access = "data:write", body = true, query = {}, required = {}, help = "Update a view. opts: {view_id, configuration, filter, name, quick_filters, sorts}. https://developers.notion.com/reference/update-a-view"},
      	deleteView = {method = "DELETE", path = "/v1/views/{view_id}", access = "data:write", body = false, query = {}, required = {}, help = "Delete a view. opts: {view_id}. https://developers.notion.com/reference/delete-view"},
      	createViewQuery = {method = "POST", path = "/v1/views/{view_id}/queries", body = true, query = {}, required = {}, help = "Create a view query. opts: {view_id, page_size}. https://developers.notion.com/reference/create-view-query"},
      	getViewQueryResults = {method = "GET", path = "/v1/views/{view_id}/queries/{query_id}", body = false, query = {"start_cursor", "page_size"}, required = {}, help = "Get view query results. opts: {view_id, query_id, start_cursor?, page_size?}. https://developers.notion.com/reference/get-view-query-results"},
      	deleteViewQuery = {method = "DELETE", path = "/v1/views/{view_id}/queries/{query_id}", access = "data:write", body = false, query = {}, required = {}, help = "Delete a view query. opts: {view_id, query_id}. https://developers.notion.com/reference/delete-view-query"},
      }
      
  • README.md
    ---
    description: Work with Notion pages, databases, files, agents and workspace administration.
    ---
    
    # Notion
    
    Give your agents access to Notion so they can find shared pages, work with your
    knowledge and keep projects up to date.
    
    With read access, agents can search pages, read content and comments, query
    databases and views, and download files. With write access, they can also
    create and edit pages, organize data, add comments and upload files.
    
    The connector supports Notion agents and sessions, meeting notes, custom emojis,
    and skills where your Notion account has access to those features. Running an
    agent session requires write access in Houston because the agent can
    use its own tools to take actions.
    
    Enterprise organization bots can use a separate connection for administration:
    legal holds, exports, analytics, permission groups, access tokens, MCP connections
    and agent policies, permissions and credit limits.
    
    Connect with Notion, an internal connection token, or a personal access token.
    You choose Houston's access level; Notion's own capabilities, shared pages and
    plan permissions still apply. See [Connect your Notion account](SETUP.md).
    
  • SETUP.md
    # Connect Notion
    
    1. Choose **Read** or **Write** for **Access** in Houston.
    2. Select **Continue with Notion**, choose your workspace and pages, and allow access.
    
    > Agents can access the selected pages and their subpages. Reauthorize to share
    > more. Notion's permissions and plan limits still apply.
    
    ## Advanced
    
    ### Connect with a token
    
    Under **Other ways to connect**, choose **Internal connection or personal access
    token**. Create an [internal connection](https://www.notion.so/profile/integrations),
    grant needed content/comment/user capabilities and share pages through their
    **Connections** menu. Alternatively, use a
    [personal access token](https://developers.notion.com/guides/get-started/personal-access-tokens),
    which uses your own access. Paste the token in Houston.
    
    Some agent, meeting-note and skills features need a personal token or extra plan
    permissions. If content is missing, check the workspace, shared pages and capabilities.
    
    ### Enterprise organization bot
    
    Add a separate **Enterprise organization bot (Admin API)** connection with an
    organization bot token and the required [Admin API scopes](https://developers.notion.com/reference/admin/scopes).
    It requires an eligible Enterprise organization; ordinary tokens cannot replace it.
    **Read** access excludes administrative changes and export-job creation.
    
    To revoke provider access, remove Houston in Notion or revoke the token;
    deleting the Houston connection alone does not revoke it in Notion.
    
  • tests
    • admin_endpoint_matrix.luau
      -- Routing expectations come from official Notion OpenAPI, not connector descriptors.
      return {
       scenario={publisher={},config={},auth_method="admin",auth_config={token="fixture-notion-private-token"}},
       access={data="write"},
       configure=function()
        requests={}
        fs=fixture.files()
        local file=fs.open("upload.bin","w"); file:write("notion"..string.char(0,255)); await(file:close())
        http={request=function(req)
         table.insert(requests,req)
         if type(req.body)=="userdata" then req.uploaded=await(req.body:readAll()) end
         return fixture.operation({statusCode=200,headers={},body=fixture.reader('{"object":"fixture","results":[],"next_cursor":null,"has_more":false,"future":{"retained":true}}')})
        end}
       end,
       run=function(c)
        local cases=json.decode([==[
      [
          {"args":{"workspace_id":"query-workspace_id"},"json_body":false,"method":"GET","name":"adminListAnalyticsReports","url":"https://api.notion.com/admin/v1/analytics/reports?workspace_id=query-workspace_id"},
          {"args":{},"json_body":false,"method":"GET","name":"adminListLegalHolds","url":"https://api.notion.com/admin/v1/legal_holds"},
          {"args":{"future_field":{"nested":"preserve"}},"json_body":true,"method":"POST","name":"adminCreateLegalHold","url":"https://api.notion.com/admin/v1/legal_holds"},
          {"args":{"legal_hold_id":"id-legal_hold_id"},"json_body":false,"method":"GET","name":"adminGetLegalHold","url":"https://api.notion.com/admin/v1/legal_holds/id-legal_hold_id"},
          {"args":{"future_field":{"nested":"preserve"},"legal_hold_id":"id-legal_hold_id"},"json_body":true,"method":"PATCH","name":"adminUpdateLegalHold","url":"https://api.notion.com/admin/v1/legal_holds/id-legal_hold_id"},
          {"args":{"future_field":{"nested":"preserve"},"legal_hold_id":"id-legal_hold_id"},"json_body":true,"method":"POST","name":"adminExportLegalHold","url":"https://api.notion.com/admin/v1/legal_holds/id-legal_hold_id/export"},
          {"args":{"legal_hold_id":"id-legal_hold_id"},"json_body":false,"method":"POST","name":"adminReleaseLegalHold","url":"https://api.notion.com/admin/v1/legal_holds/id-legal_hold_id/release"},
          {"args":{"legal_hold_id":"id-legal_hold_id","space_id":"id-space_id"},"json_body":false,"method":"GET","name":"adminListLegalHoldPages","url":"https://api.notion.com/admin/v1/legal_holds/id-legal_hold_id/spaces/id-space_id/pages"},
          {"args":{"legal_hold_id":"id-legal_hold_id"},"json_body":false,"method":"GET","name":"adminListLegalHoldUsers","url":"https://api.notion.com/admin/v1/legal_holds/id-legal_hold_id/users"},
          {"args":{"future_field":{"nested":"preserve"},"legal_hold_id":"id-legal_hold_id"},"json_body":true,"method":"POST","name":"adminAddLegalHoldUsers","url":"https://api.notion.com/admin/v1/legal_holds/id-legal_hold_id/users"},
          {"args":{"legal_hold_id":"id-legal_hold_id","user_id":"id-user_id"},"json_body":false,"method":"DELETE","name":"adminRemoveLegalHoldUser","url":"https://api.notion.com/admin/v1/legal_holds/id-legal_hold_id/users/id-user_id"},
          {"args":{"legal_hold_id":"id-legal_hold_id"},"json_body":false,"method":"GET","name":"adminListLegalHoldWorkspaces","url":"https://api.notion.com/admin/v1/legal_holds/id-legal_hold_id/workspaces"},
          {"args":{"future_field":{"nested":"preserve"}},"json_body":true,"method":"POST","name":"adminRevokeUserSession","url":"https://api.notion.com/admin/v1/managed_users/revoke_session"},
          {"args":{},"json_body":false,"method":"GET","name":"adminListMcpClientConnections","url":"https://api.notion.com/admin/v1/mcp_client_connections"},
          {"args":{"future_field":{"nested":"preserve"}},"json_body":true,"method":"PUT","name":"adminUpdateMcpClientConnectionEnterpriseManagedAccess","url":"https://api.notion.com/admin/v1/mcp_client_connections/enterprise_managed_access"},
          {"args":{"future_field":{"nested":"preserve"}},"json_body":true,"method":"POST","name":"adminRevokeMcpClientConnection","url":"https://api.notion.com/admin/v1/mcp_client_connections/revoke"},
          {"args":{"space_id":"id-space_id"},"json_body":false,"method":"GET","name":"adminGetWorkflowsMetadataForSpace","url":"https://api.notion.com/admin/v1/spaces/id-space_id/agents"},
          {"args":{"future_field":{"nested":"preserve"},"space_id":"id-space_id"},"json_body":true,"method":"PATCH","name":"adminUpdateAgentCreationPolicy","url":"https://api.notion.com/admin/v1/spaces/id-space_id/agents/creation_policy"},
          {"args":{"space_id":"id-space_id"},"json_body":false,"method":"GET","name":"adminGetAgentsCreditUsage","url":"https://api.notion.com/admin/v1/spaces/id-space_id/agents/credit_usage"},
          {"args":{"agent_id":"id-agent_id","space_id":"id-space_id"},"json_body":false,"method":"DELETE","name":"adminDeleteAgent","url":"https://api.notion.com/admin/v1/spaces/id-space_id/agents/id-agent_id"},
          {"args":{"agent_id":"id-agent_id","future_field":{"nested":"preserve"},"space_id":"id-space_id"},"json_body":true,"method":"PUT","name":"adminUpdateAgentCreditLimit","url":"https://api.notion.com/admin/v1/spaces/id-space_id/agents/id-agent_id/credit_limit"},
          {"args":{"agent_id":"id-agent_id","space_id":"id-space_id"},"json_body":false,"method":"GET","name":"adminGetAgentCreditUsage","url":"https://api.notion.com/admin/v1/spaces/id-space_id/agents/id-agent_id/credit_usage"},
          {"args":{"agent_id":"id-agent_id","space_id":"id-space_id"},"json_body":false,"method":"GET","name":"adminGetAgentPermissions","url":"https://api.notion.com/admin/v1/spaces/id-space_id/agents/id-agent_id/permissions"},
          {"args":{"agent_id":"id-agent_id","future_field":{"nested":"preserve"},"space_id":"id-space_id"},"json_body":true,"method":"PATCH","name":"adminUpdateAgentPermissions","url":"https://api.notion.com/admin/v1/spaces/id-space_id/agents/id-agent_id/permissions"},
          {"args":{"agent_id":"id-agent_id","future_field":{"nested":"preserve"},"space_id":"id-space_id"},"json_body":true,"method":"PATCH","name":"adminUpdateAgentStatus","url":"https://api.notion.com/admin/v1/spaces/id-space_id/agents/id-agent_id/status"},
          {"args":{"future_field":{"nested":"preserve"},"space_id":"id-space_id"},"json_body":true,"method":"PATCH","name":"adminUpdateWorkspaceCreditLimit","url":"https://api.notion.com/admin/v1/spaces/id-space_id/credit_limit"},
          {"args":{"future_field":{"nested":"preserve"},"space_id":"id-space_id"},"json_body":true,"method":"POST","name":"adminEnqueueSpaceExport","url":"https://api.notion.com/admin/v1/spaces/id-space_id/exports"},
          {"args":{"export_job_id":"id-export_job_id","space_id":"id-space_id"},"json_body":false,"method":"GET","name":"adminGetSpaceExportStatus","url":"https://api.notion.com/admin/v1/spaces/id-space_id/exports/id-export_job_id"},
          {"args":{"space_id":"id-space_id"},"json_body":false,"method":"GET","name":"adminListPermissionGroups","url":"https://api.notion.com/admin/v1/spaces/id-space_id/groups"},
          {"args":{"future_field":{"nested":"preserve"},"space_id":"id-space_id"},"json_body":true,"method":"POST","name":"adminCreatePermissionGroup","url":"https://api.notion.com/admin/v1/spaces/id-space_id/groups"},
          {"args":{"group_id":"id-group_id","space_id":"id-space_id"},"json_body":false,"method":"GET","name":"adminRetrievePermissionGroup","url":"https://api.notion.com/admin/v1/spaces/id-space_id/groups/id-group_id"},
          {"args":{"future_field":{"nested":"preserve"},"group_id":"id-group_id","space_id":"id-space_id"},"json_body":true,"method":"PATCH","name":"adminUpdatePermissionGroup","url":"https://api.notion.com/admin/v1/spaces/id-space_id/groups/id-group_id"},
          {"args":{"group_id":"id-group_id","space_id":"id-space_id"},"json_body":false,"method":"DELETE","name":"adminDeletePermissionGroup","url":"https://api.notion.com/admin/v1/spaces/id-space_id/groups/id-group_id"},
          {"args":{"group_id":"id-group_id","space_id":"id-space_id"},"json_body":false,"method":"GET","name":"adminListPermissionGroupMembers","url":"https://api.notion.com/admin/v1/spaces/id-space_id/groups/id-group_id/members"},
          {"args":{"future_field":{"nested":"preserve"},"group_id":"id-group_id","space_id":"id-space_id"},"json_body":true,"method":"POST","name":"adminAddPermissionGroupMember","url":"https://api.notion.com/admin/v1/spaces/id-space_id/groups/id-group_id/members"},
          {"args":{"future_field":{"nested":"preserve"},"group_id":"id-group_id","space_id":"id-space_id","user_id":"id-user_id"},"json_body":true,"method":"PATCH","name":"adminUpdatePermissionGroupMember","url":"https://api.notion.com/admin/v1/spaces/id-space_id/groups/id-group_id/members/users/id-user_id"},
          {"args":{"group_id":"id-group_id","space_id":"id-space_id","user_id":"id-user_id"},"json_body":false,"method":"DELETE","name":"adminRemovePermissionGroupMember","url":"https://api.notion.com/admin/v1/spaces/id-space_id/groups/id-group_id/members/users/id-user_id"},
          {"args":{"space_id":"id-space_id"},"json_body":false,"method":"GET","name":"adminListPersonalAccessTokens","url":"https://api.notion.com/admin/v1/spaces/id-space_id/personal_access_tokens"},
          {"args":{"bot_id":"id-bot_id","space_id":"id-space_id"},"json_body":false,"method":"DELETE","name":"adminRevokePersonalAccessToken","url":"https://api.notion.com/admin/v1/spaces/id-space_id/personal_access_tokens/id-bot_id"},
          {"args":{"space_id":"id-space_id"},"json_body":false,"method":"GET","name":"adminListUsers","url":"https://api.notion.com/admin/v1/spaces/id-space_id/users"}
      ]
      ]==])
        for _,case in cases do
         assert(type(c[case.name])=="function","missing endpoint "..case.name)
         local input=case.args
         if case.name=="sendFileUpload" then input.path="upload.bin"; input.filename="source.bin"; input.content_type="application/octet-stream"; input.part_number=2 end
         local before=json.encode(input)
         local result=c[case.name](input)
         assert(json.encode(input)==before,"mutated caller options: "..case.name)
         local req=requests[#requests]
         assert(req.method==case.method,"wrong method: "..case.name)
         assert(req.url==case.url,"wrong route: "..case.name.." "..req.url)
         assert(req.headers["Notion-Version"][1]=="2026-06-01")
         assert(req.headers.Authorization==nil,"Lua must not possess auth credentials")
         assert(result.future.retained and json.encode(result.results)=="[]" and json.encode(result.next_cursor)=="null","response data lost")
         if case.json_body then
          local body=json.decode(req.body)
          assert(body.future_field.nested=="preserve","nested request fields lost")
          for field in input do if field~="future_field" then assert(body[field]==nil,"URL field leaked into body") end end
         elseif case.name=="sendFileUpload" then
          assert(string.find(req.headers["Content-Type"][1],"multipart/form-data; boundary=",1,true))
          assert(string.find(req.uploaded,'name="part_number"',1,true) and string.find(req.uploaded,'filename="source.bin"',1,true))
          assert(string.find(req.uploaded,"notion"..string.char(0,255),1,true),"binary upload changed")
         else assert(req.body==nil,"unexpected request body: "..case.name) end
        end
        assert(#requests==#cases,"hidden network request or retry")
        assert(#cases==40,"official API coverage unexpectedly changed")
       end,
      }
      
    • admin_queries_and_errors.luau
      return {
       scenario={publisher={},config={},auth_method="admin",auth_config={token="fixture-admin-private-token"}},
       access={data="write"},
       configure=function()
        requests={}
        responseBody='{"object":"list","results":[],"has_more":false,"next_cursor":null}'
        http={request=function(req)
         table.insert(requests,req)
         return fixture.operation({statusCode=200,headers={},body=fixture.reader(responseBody)})
        end}
       end,
       run=function(c)
        c.adminListPersonalAccessTokens({space_id="space",status={"active","expired"},creator_ids={"user-1","user-2"},page_size=5})
        assert(requests[1].url=="https://api.notion.com/admin/v1/spaces/space/personal_access_tokens?page_size=5&status%5B%5D=active&status%5B%5D=expired&creator_ids%5B%5D=user-1&creator_ids%5B%5D=user-2")
        c.adminListMcpClientConnections({user_ids={"u"},workspace_ids={"w"},cursor="a+b"})
        assert(requests[2].url=="https://api.notion.com/admin/v1/mcp_client_connections?cursor=a%2Bb&user_ids%5B%5D=u&workspace_ids%5B%5D=w")
        c.adminUpdateAgentCreditLimit({space_id="space",agent_id="agent",credit_limit=json.decode('null')})
        assert(requests[3].method=="PUT" and json.encode(json.decode(requests[3].body).credit_limit)=="null")
        responseBody='{"type":"error","code":"validation_error","message":"invalid limit"}'
        assert(not pcall(c.adminListUsers,{space_id="space"}))
        assert(not pcall(c.adminListAnalyticsReports,{}))
        assert(#requests==4)
       end,
      }
      
    • admin_read_only.luau
      return {
       scenario={publisher={},config={},auth_method="admin",auth_config={token="fixture-notion-private-token"}},
       access={data="read"},
       configure=function()
        calls=0
        http={request=function(req)
         calls+=1
         return fixture.operation({statusCode=200,headers={},body=fixture.reader('{"object":"list","results":[],"has_more":false,"next_cursor":null}')})
        end}
       end,
       run=function(c)
        for _,name in {"adminCreateLegalHold","adminUpdateLegalHold","adminDeleteAgent","adminRevokePersonalAccessToken","adminEnqueueSpaceExport","getPage","search","streamSession"} do assert(c[name]==nil,"read-only leaked "..name) end
        c.adminListUsers({space_id="s"}); c.adminGetAgentsCreditUsage({space_id="s"})
        assert(calls>0)
        for name,fn in c do assert(type(name)=="string" and type(fn)=="function") end
       end,
      }
      
    • authentication.luau
      return {
      	contract = function(m)
      		m.authentication({
      			{
      				auth = { token = "synthetic-method-secret" },
      				config = {},
      				endpoint = { "GET", "https://api.notion.com/admin/v1/legal_holds" },
      				expected = "Bearer synthetic-method-secret",
      				header = "Authorization",
      				method = "admin",
      				publisher = {},
      			},
      			{
      				auth = {},
      				config = {},
      				endpoint = { "GET", "https://api.notion.com/v1/users/me" },
      				expected = "Bearer synthetic-oauth-token",
      				header = "Authorization",
      				method = "oauth",
      				oauth = true,
      				publisher = {
      					client_id = "synthetic-public-client",
      					client_secret = "synthetic-client-secret",
      				},
      			},
      			{
      				auth = { token = "synthetic-method-secret" },
      				config = {},
      				endpoint = { "GET", "https://api.notion.com/v1/users/me" },
      				expected = "Bearer synthetic-method-secret",
      				header = "Authorization",
      				method = "token",
      				publisher = {},
      			},
      		})
      	end,
      }
      
    • behavior.luau
      return {
       scenario={publisher={},config={},auth_method="token",auth_config={token="fixture-notion-private-token"}},
       access={data="write"},
       configure=function()
        requests,responses={},{}
        fs=fixture.files()
        http={request=function(req)
         table.insert(requests,req)
         assert(#responses>0,"unexpected request")
         local response=table.remove(responses,1)
         return fixture.operation({statusCode=response.status or 200,headers=response.headers or {},body=fixture.reader(response.body or '{}')})
        end}
       end,
       run=function(c)
        local null=json.decode('null')
        responses={{body='{"object":"list","results":[],"has_more":true,"next_cursor":"x +/&?","request_status":{"type":"incomplete"}}'}, {body='{"object":"list","results":[{"id":"p"}],"has_more":false,"next_cursor":null}'}}
        local page=c.queryDataSource({data_source_id="ds",filter_properties={"title","abc:def"},filter={property="Status",status={equals="Done"}},sorts={{timestamp="last_edited_time",direction="descending"}},page_size=2})
        assert(page.has_more and #page.results==0 and page.request_status.type=="incomplete")
        assert(requests[1].url=="https://api.notion.com/v1/data_sources/ds/query?filter_properties%5B%5D=title&filter_properties%5B%5D=abc%3Adef")
        local body=json.decode(requests[1].body)
        assert(body.page_size==2 and body.filter.status.equals=="Done" and body.sorts[1].direction=="descending")
        local last=c.listBlockChildren({block_id="b",start_cursor=page.next_cursor,page_size=2})
        assert(requests[2].url=="https://api.notion.com/v1/blocks/b/children?start_cursor=x%20%2B%2F%26%3F&page_size=2")
        assert(not last.has_more and json.encode(last.next_cursor)=="null")
        responses={{body='{"object":"property_item","type":"number","number":4}'},{body='{"object":"page","id":"p"}'},{body='{"object":"list","results":[],"next_cursor":null,"has_more":false}'}}
        assert(c.getPageProperty({page_id="p",property_id="foo%3Abar"}).number==4)
        assert(requests[3].url=="https://api.notion.com/v1/pages/p/properties/foo%3Abar")
        c.updatePage({page_id="p",cover=null,properties={Relation={relation=json.decode('[]')}},in_trash=false})
        body=json.decode(requests[4].body)
        assert(json.encode(body.cover)=="null" and json.encode(body.properties.Relation.relation)=="[]" and body.in_trash==false)
        c.listUsers({start_cursor=null,page_size=null})
        assert(requests[5].url=="https://api.notion.com/v1/users","null optional queries must be omitted")
        local count=#requests
        for _,args in {{page_id=""},{page_id=".."},{page_id="p",unknown=true},{page_id="p",filter_properties={[2]="hole"}},{page_id="p",filter_properties={named="bad"}}} do assert(not pcall(c.getPage,args)) end
        for _,size in {0,-1,101,1.5,"10"} do assert(not pcall(c.listUsers,{page_size=size})) end
        assert(not pcall(c.getPage,"p"))
        assert(not pcall(c.getPage,{"p"}))
        assert(not pcall(c.listComments,{}))
        assert(not pcall(c.updateSession,{continue_from="event"}))
        assert(#requests==count,"invalid input reached provider")
        for _,bad in {"not JSON","[]","null","true",'{"object":"error","code":"validation_error","message":"bad"}','{"type":"error","code":"validation_error","message":"bad"}'} do
         responses={{body=bad}}
         assert(not pcall(c.getPage,{page_id="p"}),"accepted invalid response "..bad)
        end
        for _,status in {400,401,403,404,409,429,500,529} do
         responses={{status=status,headers={["retry-after"]={"7"}},body='{"object":"error","code":"rate_limited","message":"slow down","request_id":"req-123"}'}}
         local before=#requests
         local ok,err=pcall(c.getPage,{page_id="p"})
         assert(not ok,"accepted HTTP error")
         assert(#requests==before+1,"error triggered hidden retry")
         local message=tostring(err)
         assert(string.find(message,"rate_limited",1,true) and string.find(message,"req-123",1,true) and string.find(message,"Retry-After: 7",1,true),message)
        end
        responses={{status=204}}
        assert(c.deleteComment({comment_id="c"}).success)
        assert(#responses==0)
       end,
      }
      
    • encoded_properties.luau
      return {
       scenario={publisher={},config={},auth_method="token",auth_config={token="fixture-notion-private-token"}},
       configure=function()
        requests={}
        http={request=function(req)
         table.insert(requests,req)
         return fixture.operation({statusCode=200,headers={},body=fixture.reader('{"object":"property_item","type":"number","number":42}')})
        end}
       end,
       run=function(c)
        -- Real encoded short ID used in Notion's property object documentation.
        c.getPageProperty({page_id="page",property_id="f%5C%5C%3Ap"})
        assert(requests[1].url=="https://api.notion.com/v1/pages/page/properties/f%5C%5C%3Ap")
        c.getPageProperty({page_id="page",property_id="f\\\\:p"})
        assert(requests[2].url==requests[1].url,"encoded and raw Notion property IDs must agree")
        for _, id in {"..", "p/q", "p%2Fq", "p\\q", ""} do
         assert(not pcall(c.getPageProperty, {page_id=id,property_id="title"}))
        end
        assert(not pcall(c.getPageProperty, {page_id="page",property_id=".."}))
        assert(#requests==2,"invalid IDs must not reach the network")
       end,
      }
      
    • files.luau
      return {
          scenario = {auth_method = "token", auth_config = {token = "fixture-notion-token"}, config = {}, publisher = {}},
          access = {data = "write"},
          configure = function()
              requests, responses, signedPaths, writes = {}, {}, {}, {}
              nativeFiles = fixture.files()
              binary = string.char(0, 255, 13, 10) .. "binary payload"
              local file = nativeFiles.open("uploads/report.bin", "w")
              file:write(binary)
              await(file:close())
              streamSources = {}
              function streamed(bytes)
                  local native = fixture.reader(bytes)
                  local proxy = {closed = false}
                  function proxy:read(max) return native:read(max) end
                  function proxy:readAll() error("file/SSE responses must stream, never readAll") end
                  function proxy:readPrefix(max) self.closed = true; return native:readPrefix(max) end
                  function proxy:close() self.closed = true; native:close() end
                  streamSources[proxy] = native
                  return proxy
              end
              fs = {
                  open = function(path, mode)
                      local native = nativeFiles.open(path, mode)
                      if mode == "r" then return native end
                      return {
                          write = function(_, source)
                              assert(streamSources[source], "destination must receive the original response Reader")
                              table.insert(writes, {path = path, source = source})
                              return native:write(streamSources[source])
                          end,
                          close = function() return native:close() end,
                      }
                  end,
                  stat = nativeFiles.stat,
                  signedGetUrl = function(path)
                      table.insert(signedPaths, path)
                      return nativeFiles.signedGetUrl(path)
                  end,
              }
              http = {
                  request = function(req)
                      table.insert(requests, req)
                      if req.body ~= nil and type(req.body) ~= "string" then
                          local chunks = {}
                          while true do
                              local chunk = await(req.body:read(7))
                              if chunk.done then break end
                              table.insert(chunks, chunk.data)
                          end
                          req.wire = table.concat(chunks)
                      end
                      assert(#responses > 0, "unexpected request: " .. req.url)
                      return fixture.operation(table.remove(responses, 1))
                  end,
              }
              function queueJSON(value, status, headers)
                  table.insert(responses, {statusCode = status or 200, headers = headers or {}, body = fixture.reader(json.encode(value))})
              end
              function queueStream(bytes, status, headers)
                  local reader = streamed(bytes)
                  table.insert(responses, {statusCode = status or 200, headers = headers or {}, body = reader})
                  return reader
              end
              function readFile(path)
                  local file = nativeFiles.open(path, "r")
                  local bytes = await(file:readAll())
                  await(file:close())
                  return bytes
              end
              function checkSaved(result, path, bytes)
                  assert(result.path == path and result.url == "https://houston.test/" .. path)
                  assert(result.size == #bytes and readFile(path) == bytes)
                  assert(signedPaths[#signedPaths] == path and writes[#writes].path == path)
              end
              function rejected(fn, fragment)
                  local ok, err = pcall(fn)
                  local message = tostring(if type(err) == "table" then err.message or err else err)
                  assert(not ok and string.find(message, fragment, 1, true), message)
              end
          end,
          run = function(notion)
              for _, id in {"up/1", "..", "up%2F1", "up\\1", ""} do
                  rejected(function() notion.sendFileUpload({file_upload_id = id, path = "uploads/report.bin"}) end, "file_upload_id must be")
              end
              assert(#requests == 0, "invalid IDs must not reach the network")
              queueJSON({object = "file_upload", id = "up 1", status = "uploaded"})
              local uploaded = notion.sendFileUpload({file_upload_id = "up 1", path = "uploads/report.bin"})
              assert(uploaded.status == "uploaded")
              local req = requests[#requests]
              assert(req.method == "POST" and req.url == "https://api.notion.com/v1/file_uploads/up%201/send")
              assert(req.headers["Notion-Version"][1] == "2026-03-11")
              local boundary = string.match(req.headers["Content-Type"][1], "^multipart/form%-data; boundary=(.+)$")
              assert(boundary and req.wire == "--" .. boundary .. '\r\nContent-Disposition: form-data; name="file"; filename="report.bin"\r\nContent-Type: application/octet-stream\r\n\r\n' .. binary .. "\r\n--" .. boundary .. "--\r\n")
      
              queueJSON({object = "file_upload", id = "up2", status = "pending"})
              notion.sendFileUpload({file_upload_id = "up2", path = "uploads/report.bin", filename = 'quoted"name.pdf', content_type = "application/pdf", part_number = 2})
              req = requests[#requests]
              boundary = string.match(req.headers["Content-Type"][1], "boundary=(.+)$")
              assert(req.wire == "--" .. boundary .. '\r\nContent-Disposition: form-data; name="part_number"\r\n\r\n2\r\n--' .. boundary .. '\r\nContent-Disposition: form-data; name="file"; filename="quoted\\"name.pdf"\r\nContent-Type: application/pdf\r\n\r\n' .. binary .. "\r\n--" .. boundary .. "--\r\n")
      
              local count = #requests
              for _, part in {0, 1.5, 10001, "1"} do
                  rejected(function() notion.sendFileUpload({file_upload_id = "up", path = "uploads/report.bin", part_number = part}) end, "part_number")
              end
              assert(#requests == count, "invalid multipart part numbers must fail before HTTP")
              queueJSON({object = "error", code = "validation_error", message = "part already uploaded", request_id = "request-upload"}, 400)
              rejected(function() notion.sendFileUpload({file_upload_id = "up", path = "uploads/report.bin", part_number = 1}) end, "part already uploaded")
              assert(#requests == count + 1, "uploads must never retry silently")
      
              local downloadURL = "https://prod-files-secure.s3.us-west-2.amazonaws.com/a/report.bin?signature=opaque%2Bvalue"
              local bytes = string.rep(binary, 1024)
              queueStream(bytes)
              local downloaded = notion.downloadFile({url = downloadURL, path = "downloads/report.bin"})
              checkSaved(downloaded, "downloads/report.bin", bytes)
              req = requests[#requests]
              assert(req.url == downloadURL and req.method == "GET" and req.headers == nil and req.body == nil)
              count = #requests
              rejected(function() notion.downloadFile({url = "http://file.notion.so/file", path = "bad.bin"}) end, "HTTPS")
              assert(#requests == count)
              local failure = queueStream('{"object":"error","message":"expired URL"}', 403)
              local signedCount, writeCount = #signedPaths, #writes
              rejected(function() notion.downloadFile({url = downloadURL, path = "failed.bin"}) end, "expired URL")
              assert(failure.closed and #signedPaths == signedCount and #writes == writeCount)
              assert(not await(nativeFiles.exists("failed.bin")))
      
              local events = 'id: event-1\nevent: message\ndata: {"text":"Hello"}\n\nid: event-2\nevent: done\ndata: {}\n\n'
              queueStream(events, 200, {["content-type"] = {"text/event-stream; charset=utf-8"}})
              local result = notion.streamSession({path = "sessions/first.sse", agent_id = "agent-1", message = {text = "Hello"}})
              checkSaved(result, "sessions/first.sse", events)
              req = requests[#requests]
              assert(req.method == "POST" and req.url == "https://api.notion.com/v1/sessions")
              assert(req.headers.Accept[1] == "text/event-stream" and req.headers["Content-Type"][1] == "application/json")
              local body = json.decode(req.body)
              assert(body.path == nil and body.agent_id == "agent-1" and body.message.text == "Hello")
      
              queueStream(events, 200, {["content-type"] = {"TEXT/EVENT-STREAM; charset=utf-8"}})
              result = notion.streamSession({path = "sessions/replay.sse", session_id = "session-1", continue_from = "event-1"})
              checkSaved(result, "sessions/replay.sse", events)
              body = json.decode(requests[#requests].body)
              assert(body.session_id == "session-1" and body.continue_from == "event-1" and body.path == nil)
      
              signedCount, writeCount = #signedPaths, #writes
              for _, media in {"application/json", "application/x-text/event-stream", "text/event-stream-invalid"} do
                  failure = queueStream("unexpected response", 200, {["content-type"] = {media}})
                  rejected(function() notion.streamSession({path = "sessions/wrong.sse", session_id = "session-1"}) end, "text/event-stream")
                  assert(failure.closed and #signedPaths == signedCount and #writes == writeCount)
              end
              failure = queueStream("missing content type", 200)
              rejected(function() notion.streamSession({path = "sessions/missing.sse", session_id = "session-1"}) end, "text/event-stream")
              assert(failure.closed)
              failure = queueStream('{"object":"error","code":"rate_limited","message":"Slow down","request_id":"request-session"}', 429, {["retry-after"] = {"2"}})
              count = #requests
              rejected(function() notion.streamSession({path = "sessions/error.sse", session_id = "session-1"}) end, "Retry-After: 2")
              assert(failure.closed and #requests == count + 1 and #signedPaths == signedCount and #writes == writeCount)
              assert(#responses == 0)
          end,
      }
      
    • manifest.luau
      return {
      	contract = function(m)
      		local notionConnection = function(method, access)
      			local publisher, input = nil, nil
      			if method == "oauth" then
      				publisher = { client_id = "notion-client", client_secret = "notion-publisher-secret" }
      			else
      				input = { token = method .. "-secret" }
      			end
      			local r, err = m.resolve(publisher, {}, input, method, { data = access })
      			assert(not err, tostring(err))
      			if method == "oauth" then
      				do
      					local err = m.credentials(r.Context)
      					if err == nil then
      						m.fail("OAuth connection became usable before token exchange")
      					end
      				end
      				r.Context.Auth[method].access_token = "oauth-secret"
      			end
      			do
      				local err = m.credentials(r.Context)
      				assert(not err, tostring(err))
      			end
      			if not (m.equal(r.PublicConfig, {}) and m.equal(r.Access, { data = access })) then
      				m.fail("unexpected public settings: %s %s", r.PublicConfig, r.Access)
      			end
      			return r
      		end
      		local assertNotionRoute = function(r, route, allowed, credential, version)
      			local caller = { Authorization = { "forged" }, ["Notion-Version"] = { "old" } }
      			local recipe, err = m.recipe(r, route[1], "https://api.notion.com" .. route[2], caller)
      			if not allowed then
      				if err == nil then
      					m.fail("unexpectedly allowed %s", route)
      				end
      				return
      			end
      			if err ~= nil then
      				m.fail("denied %s: %s", route, err)
      			end
      			local headers, err = m.prepare(recipe, r.Context, caller)
      			if
      				((err ~= nil) or (m.header(headers, "Authorization") ~= "Bearer " .. credential))
      				or (m.header(headers, "Notion-Version") ~= version)
      			then
      				m.fail("wrong injection for %s: %s, %s", route, headers, err)
      			end
      			if
      				(m.header(caller, "Authorization") ~= "forged")
      				or (m.header(caller, "Notion-Version") ~= "old")
      			then
      				m.fail("header preparation mutated caller's headers")
      			end
      		end
      		-- TestNotionRegistrationAndAuthenticationSelection
      		do
      			for _, publisher in
      				{
      					{},
      					{ client_id = "client" },
      					{ client_secret = "secret" },
      					{ client_id = "client", client_secret = "secret" },
      				}
      			do
      				local draft, err = m.draft(publisher, nil, nil, "")
      				assert(not err, tostring(err))
      				for _, method in draft.Methods do
      					local want = ((method.key ~= "oauth") or (m.count(publisher) == 2))
      					if not method.eligible or (method.available ~= want) then
      						m.fail("publisher=%s method=%s; available=%s", publisher, method, want)
      					end
      				end
      				if m.count(publisher) ~= 2 then
      					do
      						local _, err = m.resolve(publisher, nil, nil, "oauth")
      						if err == nil then
      							m.fail("OAuth activated without complete publisher settings")
      						end
      					end
      				end
      				local secretField = false
      				for _, field in draft.PublisherFields do
      					if field.name == "client_secret" then
      						secretField = true
      						if field.field.type ~= "secret" then
      							m.fail("active OAuth secret form field must be secret")
      						end
      					end
      				end
      				if not secretField then
      					m.fail(
      						"OAuth client secret publisher field must be visible before credentials are entered"
      					)
      				end
      				if (m.count(draft.ConfigFields) ~= 0) or not m.equal(draft.Access, { data = "read" }) then
      					m.fail("connection setup should ask only for access: %s %s", draft.ConfigFields, draft.Access)
      				end
      				local manual, err = m.resolve(publisher, nil, { token = "manual-token" }, "token")
      				if (err ~= nil) or (m.credentials(manual.Context) ~= nil) then
      					m.fail("token connection depends on publisher OAuth settings: %s", err)
      				end
      				if manual.Access.data ~= "read" then
      					m.fail("new connection did not default to read")
      				end
      			end
      			for _, method in { "token", "admin" } do
      				do
      					local _, err = m.resolve(nil, nil, nil, method)
      					if err == nil then
      						m.fail("manual authentication accepted missing token")
      					end
      				end
      			end
      			local publisher = { client_id = "client", client_secret = "secret" }
      			do
      				local _, err = m.resolve(publisher, nil, { access_token = "caller-token" }, "oauth")
      				if err == nil then
      					m.fail("caller supplied a managed OAuth credential")
      				end
      			end
      		end
      		-- TestNotionContentRoutesAndWriteBoundary
      		do
      			local reads = {
      				{ "GET", "/v1/pages/page-1/properties/f%5C%5C%3Ap" },
      				{ "GET", "/v1/pages/page-1/properties/a%2Fb" },
      				{ "GET", "/v1/pages/page-1/properties/100%25" },
      				{ "GET", "/v1/users/me" },
      				{ "GET", "/v1/pages/page-1/properties/title%3Aname?page_size=1" },
      				{ "GET", "/v1/pages/page-1/markdown" },
      				{ "GET", "/v1/blocks/block-1/children" },
      				{ "GET", "/v1/file_uploads?status=uploaded" },
      				{ "GET", "/v1/views/view-1/queries/query-1" },
      				{ "POST", "/v1/search" },
      				{ "POST", "/v1/data_sources/source-1/query" },
      				{ "POST", "/v1/agents/query" },
      				{ "POST", "/v1/sessions/session-1/events/query" },
      				{ "POST", "/v1/blocks/meeting_notes/query" },
      			}
      			local writes = {
      				{ "POST", "/v1/pages" },
      				{ "POST", "/v1/pages/page-1/move" },
      				{ "POST", "/v1/file_uploads/file-1/send" },
      				{ "POST", "/v1/file_uploads/file-1/complete" },
      				{ "POST", "/v1/databases" },
      				{ "POST", "/v1/data_sources" },
      				{ "PATCH", "/v1/pages/page-1/markdown" },
      				{ "PATCH", "/v1/blocks/block-1/children" },
      				{ "DELETE", "/v1/blocks/block-1" },
      				{ "DELETE", "/v1/comments/comment-1" },
      				{ "POST", "/v1/sessions/session-1/cancel" },
      				{ "PATCH", "/v1/agents/agent-1/credit_limit" },
      			}
      			for _, method in { "token", "oauth" } do
      				for _, access in { "read", "write" } do
      					do
      						local r = notionConnection(method, access)
      						r.Context.Auth.admin = { token = "inactive-admin" }
      						if method == "oauth" then
      							r.Context.Auth.token = { token = "inactive-token" }
      						end
      						for _, route in m.concat(m.concat({}, reads), writes) do
      							local allowed = (access == "write")
      							for _, read in reads do
      								allowed = (allowed or (route == read))
      							end
      							assertNotionRoute(r, route, allowed, method .. "-secret", "2026-03-11")
      						end
      						for _, route in
      							{
      								{ "GET", "/v1/search" },
      								{ "PUT", "/v1/pages/page-1" },
      								{ "POST", "/v1/users" },
      								{ "DELETE", "/v1/file_uploads/file-1" },
      								{ "GET", "/v1/oauth/token" },
      								{ "POST", "/v1/oauth/revoke" },
      								{ "GET", "/admin/v1/analytics/reports" },
      								{ "POST", "/admin/v1/legal_holds" },
      							}
      						do
      							assertNotionRoute(r, route, false, "", "")
      						end
      					end
      				end
      			end
      		end
      		-- TestNotionAdminRouteSeparation
      		do
      			for _, access in { "read", "write" } do
      				local r = notionConnection("admin", access)
      				r.Context.Auth.token = { token = "inactive-token" }
      				for _, route in
      					{
      						{ "GET", "/admin/v1/analytics/reports" },
      						{ "GET", "/admin/v1/legal_holds/hold-1/spaces/space-1/pages" },
      						{ "GET", "/admin/v1/spaces/space-1/groups/group-1/members" },
      					}
      				do
      					assertNotionRoute(r, route, true, "admin-secret", "2026-06-01")
      				end
      				for _, route in
      					{
      						{ "POST", "/admin/v1/legal_holds/hold-1/export" },
      						{ "PATCH", "/admin/v1/spaces/space-1/groups/group-1" },
      						{ "PUT", "/admin/v1/spaces/space-1/agents/agent-1/credit_limit" },
      						{ "DELETE", "/admin/v1/spaces/space-1/personal_access_tokens/bot-1" },
      					}
      				do
      					assertNotionRoute(r, route, (access == "write"), "admin-secret", "2026-06-01")
      				end
      				for _, route in
      					{
      						{ "GET", "/v1/users/me" },
      						{ "POST", "/v1/search" },
      						{ "POST", "/v1/pages" },
      						{ "PUT", "/admin/v1/legal_holds/hold-1" },
      						{ "DELETE", "/admin/v1/spaces/space-1/users" },
      					}
      				do
      					assertNotionRoute(r, route, false, "", "")
      				end
      			end
      		end
      		-- TestNotionDownloadBoundaries
      		do
      			for _, method in { "token", "oauth", "admin" } do
      				local r = notionConnection(method, "read")
      				local rules = r.Proxy
      				for _, url in
      					{
      						"https://s3.us-west-2.amazonaws.com/secure.notion-static.com/folder/100%25%2Ffile.pdf?X-Amz-Signature=exact%2Fvalue",
      						"https://prod-files-secure.s3.us-west-2.amazonaws.com/workspace/100%25.pdf",
      						"https://s3.us-west-2.amazonaws.com/secure.notion-static.com/file.pdf?X-Amz-Signature=signed",
      						"https://s3-us-west-2.amazonaws.com/public.notion-static.com/file.pdf",
      						"https://prod-files-secure.s3.us-west-2.amazonaws.com/workspace/file.pdf",
      						"https://prod-files-secure-euc1.s3.eu-central-1.amazonaws.com/workspace/file.pdf",
      						"https://prod-files-secure-apne1.s3.ap-northeast-1.amazonaws.com/workspace/file.pdf",
      						"https://notion-production-snapshots-2.s3.us-west-2.amazonaws.com/export.zip",
      						"https://file.notion.so/f/f/file.pdf",
      						"https://file.notion.com/f/f/file.pdf",
      					}
      				do
      					local caller =
      						{ Authorization = { "must-not-leak" }, ["Notion-Version"] = { "must-not-leak" } }
      					local recipe, err = m.recipe(rules, "GET", url, caller)
      					assert(not err, tostring(err))
      					local headers, err = m.prepare(recipe, r.Context, caller)
      					if
      						(
      							((err ~= nil) or (m.header(headers, "Authorization") ~= ""))
      							or (m.header(headers, "Notion-Version") ~= "")
      						) or (recipe.URL ~= url)
      					then
      						m.fail("download credentials or signed URL changed: %s, %s", headers, err)
      					end
      					do
      						local _, err = m.recipe(rules, "POST", url, caller)
      						if err == nil then
      							m.fail("upload allowed to download-only URL %s", url)
      						end
      					end
      				end
      				for _, url in
      					{
      						"https://s3.us-west-2.amazonaws.com/unrelated-bucket/file.pdf",
      						"https://s3.us-west-2.amazonaws.com/secure.notion-static.com.evil/file.pdf",
      						"https://s3.us-west-2.amazonaws.com/secure.notion-static.com/%2e%2e/unrelated/file.pdf",
      						"https://s3.us-west-2.amazonaws.com/secure.notion-static.com/file%2F..%2Fescape",
      						"https://prod-files-secure.s3.us-west-2.amazonaws.com.attacker.test/file.pdf",
      						"https://arbitrary-bucket.s3.us-west-2.amazonaws.com/file.pdf",
      						"http://file.notion.so/file.pdf",
      						"https://file.notion.so:8443/file.pdf",
      						"https://api.notion.com.attacker.test/v1/users/me",
      						"https://api.notion.com/v1/unknown",
      					}
      				do
      					do
      						local _, err = m.recipe(rules, "GET", url, nil)
      						if err == nil then
      							m.fail("untrusted route accepted: %s", url)
      						end
      					end
      				end
      			end
      		end
      	end,
      }
      
    • oauth_read_only.luau
      return {
       scenario={publisher={client_id="fixture-client",client_secret="fixture-private-secret"},auth_method="oauth",auth_config={}},
       access={data="read"},
       configure=function()
        calls=0
        http={request=function(req)
         calls+=1
         return fixture.operation({statusCode=200,headers={},body=fixture.reader('{"object":"list","results":[],"has_more":false,"next_cursor":null}')})
        end}
       end,
       run=function(c)
        for _,name in {"createPage","updatePage","deleteBlock","sendFileUpload","streamSession","updateSession","batchManageAgents","createMeetingNote","adminListUsers"} do assert(c[name]==nil,"read-only leaked "..name) end
        c.getPage({page_id="p"}); c.search({query="Roadmap"}); c.createViewQuery({view_id="v"})
        assert(calls>0)
        for name,fn in c do assert(type(name)=="string" and type(fn)=="function") end
       end,
      }
      
    • oauth_writes_and_stream.luau
      return {
       scenario={publisher={client_id="fixture-client",client_secret="fixture-private-secret"},auth_method="oauth",auth_config={}},
       access={data="write"},
       configure=function()
        requests={}
        fs=fixture.files()
        http={request=function(req)
         table.insert(requests,req)
         if req.headers and req.headers.Accept[1]=="text/event-stream" then
          return fixture.operation({statusCode=200,headers={["content-type"]={"text/event-stream; charset=utf-8"}},body=fixture.reader("event: message\ndata: {\"text\":\"hello\"}\n\n")})
         end
         if req.headers==nil then return fixture.operation({statusCode=200,headers={},body=fixture.reader(string.char(0,255).."attachment")}) end
         return fixture.operation({statusCode=200,headers={},body=fixture.reader('{"object":"page","id":"p"}')})
        end}
       end,
       run=function(c)
        assert(c.adminListUsers==nil)
        c.getPage({page_id="p"})
        c.search({query="Roadmap"})
        c.createPage({parent={page_id="p"},properties={title={title={{text={content="New"}}}}},markdown="# Hello"})
        c.updateBlock({block_id="b",paragraph={rich_text={{text={content="Updated"}}}}})
        c.deleteBlock({block_id="b"})
        local saved=c.streamSession({agent_id="a",message="Hello",path="stream.sse"})
        assert(saved.path=="stream.sse" and saved.size==#"event: message\ndata: {\"text\":\"hello\"}\n\n")
        assert(await(fs.open(saved.path,"r"):readAll())=="event: message\ndata: {\"text\":\"hello\"}\n\n")
        local replay=c.streamSession({session_id="s",continue_from="event-1",path="replay.sse"})
        assert(json.decode(requests[7].body).continue_from=="event-1")
        assert(json.decode(requests[7].body).path==nil)
        local downloaded=c.downloadFile({url="https://s3.us-west-2.amazonaws.com/secure.notion-static.com/file?signature=x",path="attachment.bin"})
        assert(downloaded.size==12 and await(fs.open(downloaded.path,"r"):readAll())==string.char(0,255).."attachment")
        assert(#requests==8 and requests[8].headers==nil)
        assert(not pcall(c.downloadFile,{url="http://example.com/file",path="bad"}))
       end,
      }
      
    • public_endpoint_matrix.luau
      -- Routing expectations come from official Notion OpenAPI, not connector descriptors.
      return {
       scenario={publisher={},config={},auth_method="token",auth_config={token="fixture-notion-private-token"}},
       access={data="write"},
       configure=function()
        requests={}
        fs=fixture.files()
        local file=fs.open("upload.bin","w"); file:write("notion"..string.char(0,255)); await(file:close())
        http={request=function(req)
         table.insert(requests,req)
         if type(req.body)=="userdata" then req.uploaded=await(req.body:readAll()) end
         return fixture.operation({statusCode=200,headers={},body=fixture.reader('{"object":"fixture","results":[],"next_cursor":null,"has_more":false,"future":{"retained":true}}')})
        end}
       end,
       run=function(c)
        local cases=json.decode([==[
      [
          {"args":{"future_field":{"nested":"preserve"}},"json_body":true,"method":"POST","name":"batchManageAgents","url":"https://api.notion.com/v1/agents/batch"},
          {"args":{"future_field":{"nested":"preserve"}},"json_body":true,"method":"POST","name":"queryAgents","url":"https://api.notion.com/v1/agents/query"},
          {"args":{"agent_id":"id-agent_id"},"json_body":false,"method":"GET","name":"getAgent","url":"https://api.notion.com/v1/agents/id-agent_id"},
          {"args":{"agent_id":"id-agent_id"},"json_body":false,"method":"DELETE","name":"deleteAgent","url":"https://api.notion.com/v1/agents/id-agent_id"},
          {"args":{"agent_id":"id-agent_id","future_field":{"nested":"preserve"}},"json_body":true,"method":"PATCH","name":"updateAgentCreditLimit","url":"https://api.notion.com/v1/agents/id-agent_id/credit_limit"},
          {"args":{"agent_id":"id-agent_id"},"json_body":false,"method":"GET","name":"getAgentInsights","url":"https://api.notion.com/v1/agents/id-agent_id/insights"},
          {"args":{"agent_id":"id-agent_id","future_field":{"nested":"preserve"}},"json_body":true,"method":"PATCH","name":"updateAgentStatus","url":"https://api.notion.com/v1/agents/id-agent_id/status"},
          {"args":{},"json_body":false,"method":"GET","name":"listPlugins","url":"https://api.notion.com/v1/ai/plugins"},
          {"args":{"id":"id-id"},"json_body":false,"method":"GET","name":"getPlugin","url":"https://api.notion.com/v1/ai/plugins/id-id"},
          {"args":{"id":"id-id"},"json_body":false,"method":"GET","name":"getSkill","url":"https://api.notion.com/v1/ai/skills/id-id"},
          {"args":{"task_id":"id-task_id"},"json_body":false,"method":"GET","name":"getAsyncTask","url":"https://api.notion.com/v1/async_tasks/id-task_id"},
          {"args":{"future_field":{"nested":"preserve"}},"json_body":true,"method":"POST","name":"createMeetingNote","url":"https://api.notion.com/v1/blocks/meeting_notes"},
          {"args":{"future_field":{"nested":"preserve"}},"json_body":true,"method":"POST","name":"queryMeetingNotes","url":"https://api.notion.com/v1/blocks/meeting_notes/query"},
          {"args":{"block_id":"id-block_id"},"json_body":false,"method":"GET","name":"getBlock","url":"https://api.notion.com/v1/blocks/id-block_id"},
          {"args":{"block_id":"id-block_id","future_field":{"nested":"preserve"}},"json_body":true,"method":"PATCH","name":"updateBlock","url":"https://api.notion.com/v1/blocks/id-block_id"},
          {"args":{"block_id":"id-block_id"},"json_body":false,"method":"DELETE","name":"deleteBlock","url":"https://api.notion.com/v1/blocks/id-block_id"},
          {"args":{"block_id":"id-block_id"},"json_body":false,"method":"GET","name":"listBlockChildren","url":"https://api.notion.com/v1/blocks/id-block_id/children"},
          {"args":{"block_id":"id-block_id","future_field":{"nested":"preserve"}},"json_body":true,"method":"PATCH","name":"appendBlockChildren","url":"https://api.notion.com/v1/blocks/id-block_id/children"},
          {"args":{"block_id":"query-block_id"},"json_body":false,"method":"GET","name":"listComments","url":"https://api.notion.com/v1/comments?block_id=query-block_id"},
          {"args":{"future_field":{"nested":"preserve"}},"json_body":true,"method":"POST","name":"createComment","url":"https://api.notion.com/v1/comments"},
          {"args":{"comment_id":"id-comment_id"},"json_body":false,"method":"GET","name":"getComment","url":"https://api.notion.com/v1/comments/id-comment_id"},
          {"args":{"comment_id":"id-comment_id","future_field":{"nested":"preserve"}},"json_body":true,"method":"PATCH","name":"updateComment","url":"https://api.notion.com/v1/comments/id-comment_id"},
          {"args":{"comment_id":"id-comment_id"},"json_body":false,"method":"DELETE","name":"deleteComment","url":"https://api.notion.com/v1/comments/id-comment_id"},
          {"args":{},"json_body":false,"method":"GET","name":"listCustomEmojis","url":"https://api.notion.com/v1/custom_emojis"},
          {"args":{"future_field":{"nested":"preserve"}},"json_body":true,"method":"POST","name":"createDataSource","url":"https://api.notion.com/v1/data_sources"},
          {"args":{"data_source_id":"id-data_source_id"},"json_body":false,"method":"GET","name":"getDataSource","url":"https://api.notion.com/v1/data_sources/id-data_source_id"},
          {"args":{"data_source_id":"id-data_source_id","future_field":{"nested":"preserve"}},"json_body":true,"method":"PATCH","name":"updateDataSource","url":"https://api.notion.com/v1/data_sources/id-data_source_id"},
          {"args":{"data_source_id":"id-data_source_id","future_field":{"nested":"preserve"}},"json_body":true,"method":"POST","name":"queryDataSource","url":"https://api.notion.com/v1/data_sources/id-data_source_id/query"},
          {"args":{"data_source_id":"id-data_source_id"},"json_body":false,"method":"GET","name":"listDataSourceTemplates","url":"https://api.notion.com/v1/data_sources/id-data_source_id/templates"},
          {"args":{"future_field":{"nested":"preserve"}},"json_body":true,"method":"POST","name":"createDatabase","url":"https://api.notion.com/v1/databases"},
          {"args":{"database_id":"id-database_id"},"json_body":false,"method":"GET","name":"getDatabase","url":"https://api.notion.com/v1/databases/id-database_id"},
          {"args":{"database_id":"id-database_id","future_field":{"nested":"preserve"}},"json_body":true,"method":"PATCH","name":"updateDatabase","url":"https://api.notion.com/v1/databases/id-database_id"},
          {"args":{},"json_body":false,"method":"GET","name":"listFileUploads","url":"https://api.notion.com/v1/file_uploads"},
          {"args":{"future_field":{"nested":"preserve"}},"json_body":true,"method":"POST","name":"createFileUpload","url":"https://api.notion.com/v1/file_uploads"},
          {"args":{"file_upload_id":"id-file_upload_id"},"json_body":false,"method":"GET","name":"getFileUpload","url":"https://api.notion.com/v1/file_uploads/id-file_upload_id"},
          {"args":{"file_upload_id":"id-file_upload_id"},"json_body":false,"method":"POST","name":"completeFileUpload","url":"https://api.notion.com/v1/file_uploads/id-file_upload_id/complete"},
          {"args":{"file_upload_id":"id-file_upload_id"},"json_body":false,"method":"POST","name":"sendFileUpload","url":"https://api.notion.com/v1/file_uploads/id-file_upload_id/send"},
          {"args":{"future_field":{"nested":"preserve"}},"json_body":true,"method":"POST","name":"createPage","url":"https://api.notion.com/v1/pages"},
          {"args":{"page_id":"id-page_id"},"json_body":false,"method":"GET","name":"getPage","url":"https://api.notion.com/v1/pages/id-page_id"},
          {"args":{"future_field":{"nested":"preserve"},"page_id":"id-page_id"},"json_body":true,"method":"PATCH","name":"updatePage","url":"https://api.notion.com/v1/pages/id-page_id"},
          {"args":{"page_id":"id-page_id"},"json_body":false,"method":"GET","name":"getPageMarkdown","url":"https://api.notion.com/v1/pages/id-page_id/markdown"},
          {"args":{"future_field":{"nested":"preserve"},"page_id":"id-page_id"},"json_body":true,"method":"PATCH","name":"updatePageMarkdown","url":"https://api.notion.com/v1/pages/id-page_id/markdown"},
          {"args":{"future_field":{"nested":"preserve"},"page_id":"id-page_id"},"json_body":true,"method":"POST","name":"movePage","url":"https://api.notion.com/v1/pages/id-page_id/move"},
          {"args":{"page_id":"id-page_id","property_id":"id-property_id"},"json_body":false,"method":"GET","name":"getPageProperty","url":"https://api.notion.com/v1/pages/id-page_id/properties/id-property_id"},
          {"args":{"future_field":{"nested":"preserve"}},"json_body":true,"method":"POST","name":"search","url":"https://api.notion.com/v1/search"},
          {"args":{"future_field":{"nested":"preserve"}},"json_body":true,"method":"POST","name":"updateSession","url":"https://api.notion.com/v1/sessions"},
          {"args":{"future_field":{"nested":"preserve"}},"json_body":true,"method":"POST","name":"querySessions","url":"https://api.notion.com/v1/sessions/query"},
          {"args":{"session_id":"id-session_id"},"json_body":false,"method":"GET","name":"getSession","url":"https://api.notion.com/v1/sessions/id-session_id"},
          {"args":{"future_field":{"nested":"preserve"},"session_id":"id-session_id"},"json_body":true,"method":"POST","name":"cancelSession","url":"https://api.notion.com/v1/sessions/id-session_id/cancel"},
          {"args":{"future_field":{"nested":"preserve"},"session_id":"id-session_id"},"json_body":true,"method":"POST","name":"querySessionEvents","url":"https://api.notion.com/v1/sessions/id-session_id/events/query"},
          {"args":{},"json_body":false,"method":"GET","name":"listUsers","url":"https://api.notion.com/v1/users"},
          {"args":{},"json_body":false,"method":"GET","name":"getSelf","url":"https://api.notion.com/v1/users/me"},
          {"args":{"user_id":"id-user_id"},"json_body":false,"method":"GET","name":"getUser","url":"https://api.notion.com/v1/users/id-user_id"},
          {"args":{},"json_body":false,"method":"GET","name":"listViews","url":"https://api.notion.com/v1/views"},
          {"args":{"future_field":{"nested":"preserve"}},"json_body":true,"method":"POST","name":"createView","url":"https://api.notion.com/v1/views"},
          {"args":{"view_id":"id-view_id"},"json_body":false,"method":"GET","name":"getView","url":"https://api.notion.com/v1/views/id-view_id"},
          {"args":{"future_field":{"nested":"preserve"},"view_id":"id-view_id"},"json_body":true,"method":"PATCH","name":"updateView","url":"https://api.notion.com/v1/views/id-view_id"},
          {"args":{"view_id":"id-view_id"},"json_body":false,"method":"DELETE","name":"deleteView","url":"https://api.notion.com/v1/views/id-view_id"},
          {"args":{"future_field":{"nested":"preserve"},"view_id":"id-view_id"},"json_body":true,"method":"POST","name":"createViewQuery","url":"https://api.notion.com/v1/views/id-view_id/queries"},
          {"args":{"query_id":"id-query_id","view_id":"id-view_id"},"json_body":false,"method":"GET","name":"getViewQueryResults","url":"https://api.notion.com/v1/views/id-view_id/queries/id-query_id"},
          {"args":{"query_id":"id-query_id","view_id":"id-view_id"},"json_body":false,"method":"DELETE","name":"deleteViewQuery","url":"https://api.notion.com/v1/views/id-view_id/queries/id-query_id"}
      ]
      ]==])
        for _,case in cases do
         assert(type(c[case.name])=="function","missing endpoint "..case.name)
         local input=case.args
         if case.name=="sendFileUpload" then input.path="upload.bin"; input.filename="source.bin"; input.content_type="application/octet-stream"; input.part_number=2 end
         local before=json.encode(input)
         local result=c[case.name](input)
         assert(json.encode(input)==before,"mutated caller options: "..case.name)
         local req=requests[#requests]
         assert(req.method==case.method,"wrong method: "..case.name)
         assert(req.url==case.url,"wrong route: "..case.name.." "..req.url)
         assert(req.headers["Notion-Version"][1]=="2026-03-11")
         assert(req.headers.Authorization==nil,"Lua must not possess auth credentials")
         assert(result.future.retained and json.encode(result.results)=="[]" and json.encode(result.next_cursor)=="null","response data lost")
         if case.json_body then
          local body=json.decode(req.body)
          assert(body.future_field.nested=="preserve","nested request fields lost")
          for field in input do if field~="future_field" then assert(body[field]==nil,"URL field leaked into body") end end
         elseif case.name=="sendFileUpload" then
          assert(string.find(req.headers["Content-Type"][1],"multipart/form-data; boundary=",1,true))
          assert(string.find(req.uploaded,'name="part_number"',1,true) and string.find(req.uploaded,'filename="source.bin"',1,true))
          assert(string.find(req.uploaded,"notion"..string.char(0,255),1,true),"binary upload changed")
         else assert(req.body==nil,"unexpected request body: "..case.name) end
        end
        assert(#requests==#cases,"hidden network request or retry")
        assert(#cases==61,"official API coverage unexpectedly changed")
       end,
      }
      
    • token_read_only.luau
      return {
       scenario={publisher={},config={},auth_method="token",auth_config={token="fixture-notion-private-token"}},
       access={data="read"},
       configure=function()
        calls=0
        http={request=function(req)
         calls+=1
         return fixture.operation({statusCode=200,headers={},body=fixture.reader('{"object":"list","results":[],"has_more":false,"next_cursor":null}')})
        end}
       end,
       run=function(c)
        for _,name in {"createPage","updatePage","deleteBlock","sendFileUpload","streamSession","updateSession","batchManageAgents","createMeetingNote","adminListUsers"} do assert(c[name]==nil,"read-only leaked "..name) end
        c.getPage({page_id="p"}); c.search({query="Roadmap"}); c.createViewQuery({view_id="v"})
        assert(calls>0)
        for name,fn in c do assert(type(name)=="string" and type(fn)=="function") end
       end,
      }