Obsidian Vault REST API icon

Obsidian Vault REST API

Interact with Obsidian Vault via REST API

Overview

The "Agent - Grep Vault" operation allows users to search through an Obsidian Vault for specific text patterns. It supports searching with regular expressions, case sensitivity options, and filtering by file name patterns. This node is useful when you want to quickly find occurrences of a string or pattern within your vault files, such as locating all notes containing a keyword, extracting metadata, or auditing content.

Practical examples:

  • Searching for all notes that mention a particular project code.
  • Extracting lines containing TODO comments across multiple markdown files.
  • Finding configuration keys or tags used in the vault.

Properties

Name Meaning
Pattern The text or regex pattern to search for within the vault files.
Is Regex Whether the pattern should be treated as a regular expression (true) or plain text (false).
Case Sensitive Whether the search should distinguish between uppercase and lowercase characters.
Include Frontmatter Whether to include the frontmatter section of markdown files in the search results.
File Pattern A glob-like pattern to filter which files to search (e.g., *.md to search only markdown files).
Max Results Maximum number of matching results to return; 0 means no limit.
Context Lines Number of lines before and after each match to include as context in the results.

Output

The node outputs JSON data representing the search results found in the vault. Each result typically includes matched lines along with optional surrounding context lines, file information, and possibly frontmatter content if included. This structured output enables further processing or filtering downstream in the workflow.

If binary data were involved (not indicated here), it would represent file contents or attachments, but this operation focuses on textual search results.

Dependencies

  • Requires access to an Obsidian Vault REST API endpoint configured via credentials.
  • Needs an API host URL and authentication token set up in n8n credentials to communicate with the vault.
  • The node depends on the external Obsidian Vault REST API service to perform the grep operation.

Troubleshooting

  • No results returned: Check that the pattern is correct and matches the expected text. Verify file pattern filters are not excluding relevant files.
  • Invalid regex error: If "Is Regex" is true, ensure the pattern is a valid regular expression syntax.
  • Authentication errors: Confirm that the API credentials are correctly configured and have permission to access the vault.
  • Timeouts or slow responses: Large vaults or complex regex patterns may cause delays; consider limiting max results or simplifying the pattern.
  • Case sensitivity issues: Remember that setting "Case Sensitive" to false makes the search ignore letter casing.

Links and References

Discussion