Obsidian SDK

Vault

Auto-generated API documentation.

Vault Service

Manage Obsidian vaults - list, open, and get vault information.

Service Overview

The Vault service provides endpoints for interacting with Obsidian vaults. It wraps Obsidian CLI vault commands to give you programmatic access to vault management.

Base URL

/api/files/vault

Endpoints


GET /api/files/vault

Get information about a specific vault or the default vault.

CLI Command: obsidian vault

Query Parameters:

ParameterTypeRequiredDescription
vaultstringNoName of the vault to query
infostringNoSpecific info type to retrieve

Example Request:

curl "http://localhost:3000/api/files/vault?vault=youtube"

Example Response:

{
  "success": true,
  "data": {
    "type": "kv",
    "data": {
      "name": "youtube",
      "path": "C:\\Users\\sayan\\Documents\\youtube",
      "files": "23",
      "folders": "4",
      "size": "2760"
    }
  }
}

Example Response (with info):

curl "http://localhost:3000/api/files/vault?vault=youtube&info=config"

GET /api/files/vault/info

Get vault information using the info subcommand.

CLI Command: obsidian vault

Example Request:

curl "http://localhost:3000/api/files/vault/info?vault=youtube"

Example Response:

{
  "success": true,
  "data": {
    "type": "kv",
    "data": {
      "name": "youtube",
      "path": "C:\\Users\\sayan\\Documents\\youtube"
    }
  }
}

GET /api/files/vault/list

List all available vaults on the system.

CLI Command: obsidian vaults

Query Parameters:

ParameterTypeRequiredDescription
vaultstringNoFilter by vault name

Example Request:

curl "http://localhost:3000/api/files/vault/list"

Example Response:

{
  "success": true,
  "data": {
    "type": "list",
    "data": ["youtube", "personal", "work"]
  }
}

POST /api/files/vault/open

Open a specific vault in Obsidian.

CLI Command: obsidian vault:open

Request Body:

ParameterTypeRequiredDescription
namestringYesName of the vault to open
vaultstringNoVault context

Example Request:

curl -X POST "http://localhost:3000/api/files/vault/open" \
  -H "Content-Type: application/json" \
  -d '{"name": "youtube"}'

Example Response:

{
  "success": true,
  "data": "Opening vault: youtube"
}

Error Handling

Missing Vault:

{
  "success": false,
  "error": "Vault 'nonexistent' not found"
}

Obsidian Not Running:

{
  "success": false,
  "error": "Obsidian is not running"
}

Notes

  • If no vault is specified, the API uses the last active vault
  • Vault names are case-sensitive
  • Some operations require Obsidian to be running

On this page