Portal Community

When to Use

Configuration

Authentication

FieldRequiredDescription
AuthenticationMethodRequired"ApiToken" or "OAuth2".
ApiTokenRequiredNotion Internal Integration Token. Starts with secret_.
ClientIdOAuth2OAuth2 client ID.
ClientSecretOAuth2OAuth2 client secret.
AccessTokenOAuth2OAuth2 access token.

Operation Fields

FieldRequiredDescription
QueryRequiredKeyword to match against database titles. Case-insensitive partial match. Example: "Sprint", "Customer".
LimitOptionalMaximum number of results to return. Range: 1–100. Default: 100.
Search scope: database/search only searches databases visible to the integration — databases not shared with the integration are excluded from results regardless of the query. If expected databases are missing, verify the integration is shared with them in Notion.

Sample Configuration

{
  "resource": "database",
  "operation": "search",
  "AuthenticationMethod": "ApiToken",
  "ApiToken": "{{ $credentials.notionApiToken }}",
  "Query": "{{ $json.projectName }}",
  "Limit": 10
}

Validation Errors

Error CodeCause
NOTION_VALIDATION_FAILEDQuery field is empty. A non-empty search string is required.
NOTION_UNAUTHORIZEDAPI token is invalid or the integration is disconnected.
NOTION_INVALID_CONFIGAuthentication fields are missing or Limit is outside 1–100.
NOTION_RATE_LIMITEDRate limit exceeded. Reduce search call frequency.

Output

Success Port

FieldTypeDescription
resultsarrayArray of matching database objects. Each entry contains id, title, url, created_time, last_edited_time, and properties.
has_morebooleanWhether additional results exist beyond the returned Limit.
next_cursorstringPagination cursor for fetching the next page of results.

Error Port

On failure the error port receives errorCode, message, and httpStatus. A zero-result response (empty results array) is a success — it means no databases matched the query.

Sample Output

{
  "results": [
    {
      "id": "c3d4e5f6-a7b8-9012-cdef-123456789012",
      "title": "Q2 2024 Sprint Board",
      "url": "https://www.notion.so/c3d4e5f6a7b89012cdef123456789012",
      "created_time": "2024-04-01T08:00:00.000Z",
      "last_edited_time": "2024-06-11T16:44:00.000Z"
    },
    {
      "id": "d4e5f6a7-b8c9-0123-defa-234567890123",
      "title": "Sprint Retrospectives",
      "url": "https://www.notion.so/d4e5f6a7b8c90123defa234567890123",
      "created_time": "2024-01-10T10:00:00.000Z",
      "last_edited_time": "2024-06-01T09:00:00.000Z"
    }
  ],
  "has_more": false,
  "next_cursor": null
}

Expression Reference

ExpressionTypeExample ValueUse
{{ $output.searchDatabases.results.length }}number2Check if any matches were found
{{ $output.searchDatabases.results[0].id }}stringUUIDUse first match ID in subsequent database operations
{{ $output.searchDatabases.results[0].title }}string"Q2 2024 Sprint Board"Confirm the correct database was found
{{ $output.searchDatabases.results[0].url }}stringNotion URLLink to the database in a notification
{{ $output.searchDatabases.has_more }}booleanfalseDetect truncated results when Limit is small

Node Policies & GuardRails

PolicyDetail
Validate result countAlways check results.length after the search. An empty array means no match — handle this with a dedicated branch before attempting to use results[0].id to avoid null reference errors.
Ambiguous matchesMultiple databases may match a broad query. After searching, confirm the correct database by checking the full title in a Function node with an exact comparison: results.find(d => d.title === targetName).
Prefer database/get for known IDsWhen you already know the database UUID, use database/get directly. database/search is for discovery only and consumes an extra API call.
Credentials in Credentials ManagerStore the API token as {{ $credentials.notionApiToken }} — never hard-code it.
Search is title-onlyThe Notion Search API only matches against database titles, not property names or content. For content-level search, use database/query with a text filter.

Workflow Examples

Example 1 — Resolve Project Database from User Input

A form submission includes a project name. Search for the matching database and store its ID before creating a task row.

// Step 1: FormTrigger — user submits project name
// Step 2: database/search
{
  "Query": "{{ $json.projectName }}"
}
// Step 3: Function node — exact match
const db = $output.searchDatabases.results.find(d => d.title === $json.projectName);
if (!db) throw new Error("No database found for project: " + $json.projectName);
return { dbId: db.id };

// Step 4: database/createPage using {{ $json.dbId }}

Example 2 — Multi-Team Database Router

Route an incoming webhook payload to the correct team database based on a team name field in the payload.

// Step 1: WebhookTrigger
// Payload: { "team": "Alpha", "task": "Deploy API v2" }

// Step 2: database/search
{
  "Query": "{{ $json.team }} Tasks",
  "Limit": 5
}
// Step 3: IfCondition — results.length === 0 → error branch
// Step 4: database/createPage with results[0].id

Example 3 — New Integration Verification

After setting up a new integration, run this workflow to confirm all expected databases are visible.

// For each expected database name in a list:
// Step 1: database/search with the name
// Step 2: Function node — check results.length > 0
// Step 3: Build report: { name, found: true/false, id: results[0]?.id }
// Step 4: Post summary to Slack