database/search
Search for Notion databases by a keyword that matches the database title. Returns matching database objects including ID, title, URL, and schema properties. Use this when you know part of a database name but not its UUID.
When to Use
- Name-based lookup without hardcoded UUIDs: Use
database/searchwhen a workflow must locate a database by partial title — for example, finding the "Q2 2024 Sprint" database from user input without knowing its UUID in advance. - Discovery for new team setups: When onboarding a new team workspace, search for known database names to verify they exist and capture their IDs before configuring downstream workflows.
- Multi-team database linking: In a multi-team setup, search for project-specific databases by a project code (e.g., "ALPHA") to dynamically route records to the right team database.
- Integration inventory tools: Build a database discovery UI where users type a partial name and the workflow returns matching databases for selection, avoiding the need for manual UUID lookup.
- Workspace migration assistance: During a workspace restructure, search by old database names to locate and catalog each database before renaming or moving them.
Configuration
Authentication
| Field | Required | Description |
|---|---|---|
AuthenticationMethod | Required | "ApiToken" or "OAuth2". |
ApiToken | Required | Notion Internal Integration Token. Starts with secret_. |
ClientId | OAuth2 | OAuth2 client ID. |
ClientSecret | OAuth2 | OAuth2 client secret. |
AccessToken | OAuth2 | OAuth2 access token. |
Operation Fields
| Field | Required | Description |
|---|---|---|
Query | Required | Keyword to match against database titles. Case-insensitive partial match. Example: "Sprint", "Customer". |
Limit | Optional | Maximum 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 Code | Cause |
|---|---|
NOTION_VALIDATION_FAILED | Query field is empty. A non-empty search string is required. |
NOTION_UNAUTHORIZED | API token is invalid or the integration is disconnected. |
NOTION_INVALID_CONFIG | Authentication fields are missing or Limit is outside 1–100. |
NOTION_RATE_LIMITED | Rate limit exceeded. Reduce search call frequency. |
Output
Success Port
| Field | Type | Description |
|---|---|---|
results | array | Array of matching database objects. Each entry contains id, title, url, created_time, last_edited_time, and properties. |
has_more | boolean | Whether additional results exist beyond the returned Limit. |
next_cursor | string | Pagination 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
| Expression | Type | Example Value | Use |
|---|---|---|---|
{{ $output.searchDatabases.results.length }} | number | 2 | Check if any matches were found |
{{ $output.searchDatabases.results[0].id }} | string | UUID | Use 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 }} | string | Notion URL | Link to the database in a notification |
{{ $output.searchDatabases.has_more }} | boolean | false | Detect truncated results when Limit is small |
Node Policies & GuardRails
| Policy | Detail |
|---|---|
| Validate result count | Always 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 matches | Multiple 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 IDs | When 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 Manager | Store the API token as {{ $credentials.notionApiToken }} — never hard-code it. |
| Search is title-only | The 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