Obsidian SDK

Workspace

Auto-generated API documentation.

Workspace Service

Manage workspaces, tabs, and recent files.

Service Overview

The Workspace service provides endpoints for managing Obsidian workspaces (saved layouts), open tabs, and recently opened files.

Base URL

/api/files/workspace
/api/files/tabs
/api/files/recents

Endpoints


GET /api/files/workspace

Get workspace information and settings.

CLI Command: obsidian workspace

Query Parameters:

ParameterTypeRequiredDescription
formatstringNoOutput format
idsbooleanNoInclude pane IDs
vaultstringNoTarget vault name

Example Request:

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

Example Response:

{
  "success": true,
  "data": {
    "type": "kv",
    "data": {
      "active": "default",
      "panes": "3"
    }
  }
}

GET /api/files/workspace/list

List all saved workspaces.

CLI Command: obsidian workspaces

Example Request:

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

Example Response:

{
  "success": true,
  "data": {
    "type": "list",
    "data": [
      "default",
      "writing-mode",
      "research"
    ]
  }
}

POST /api/files/workspace/save

Save current workspace layout.

CLI Command: obsidian workspace:save

Request Body:

ParameterTypeRequiredDescription
namestringYesWorkspace name
vaultstringNoTarget vault name

Example Request:

curl -X POST "http://localhost:3000/api/files/workspace/save?vault=youtube" \
  -H "Content-Type: application/json" \
  -d '{"name": "writing-mode"}'

Example Response:

{
  "success": true,
  "data": "Workspace saved: writing-mode"
}

POST /api/files/workspace/load

Load a saved workspace layout.

CLI Command: obsidian workspace:load

Request Body:

ParameterTypeRequiredDescription
namestringYesWorkspace name
vaultstringNoTarget vault name

Example Request:

curl -X POST "http://localhost:3000/api/files/workspace/load?vault=youtube" \
  -H "Content-Type: application/json" \
  -d '{"name": "writing-mode"}'

Example Request:

curl -X DELETE "http://localhost:3000/api/files/workspace/old-workspace?vault=youtube"

Example Request:

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

Example Response:

{
  "success": true,
  "data": {
    "type": "list",
    "data": [
      "Notes.md",
      "Projects/Overview.md",
      "Daily/2026-05-09.md"
    ]
  }
}

POST /api/files/tabs/open

Open a file in a new tab.

CLI Command: obsidian tab:open

Request Body:

ParameterTypeRequiredDescription
filestringNoFile to open
pathstringNoFull path
viewstringNoView type
groupnumberNoTab group number
vaultstringNoTarget vault name

Example Request:

curl -X POST "http://localhost:3000/api/files/tabs/open?vault=youtube" \
  -H "Content-Type: application/json" \
  -d '{"file": "Projects/Overview.md"}'
curl -X POST "http://localhost:3000/api/files/tabs/open?vault=youtube" \
  -H "Content-Type: application/json" \
  -d '{"file": "Notes.md", "group": 2}'

Example Request:

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

Example Response:

{
  "success": true,
  "data": {
    "type": "list",
    "data": [
      "Notes.md",
      "Projects/Overview.md",
      "Daily/2026-05-09.md",
      "Templates/daily.md"
    ]
  }
}

With limit:

curl "http://localhost:3000/api/files/recents?limit=10&vault=youtube"

Use Cases

Save Workspace Setup

# Save current workspace for a specific mode
curl -X POST "http://localhost:3000/api/files/workspace/save?vault=youtube" \
  -H "Content-Type: application/json" \
  -d '{"name": "research-mode"}'

# Load when starting research
curl -X POST "http://localhost:3000/api/files/workspace/load?vault=youtube" \
  -H "Content-Type: application/json" \
  -d '{"name": "research-mode"}'

Open Multiple Files as Tabs

# Open project files for review
FILES=("Projects/Overview.md" "Projects/Tasks.md" "Projects/Notes.md")
for file in "${FILES[@]}"; do
  curl -X POST "http://localhost:3000/api/files/tabs/open?vault=youtube" \
    -H "Content-Type: application/json" \
    -d "{\"file\": \"$file\"}"
done

Error Handling

Workspace Not Found:

{
  "success": false,
  "error": "Workspace not found: nonexistent"
}

File Not Open:

{
  "success": false,
  "error": "File not currently open"
}

Notes

  • Workspaces save layout, open files, and pane positions
  • Tabs are per-workspace in Obsidian
  • Recent files have configurable history length
  • Workspaces require the Workspaces plugin (community)

On this page