Each operation below carries the questions people ask an LLM about it and the instructions they give an agent to run it. Generated by API Evangelistoverlay
DELETE/vault/{filename}Delete a file from the vault · Delete a particular file in your vault#
Ask an LLM
“How do I delete a note from my Obsidian vault?”
“Can I remove a file from the vault by its filename?”
Tell an agentdestructive · confirm first
Delete {filename} from my vault.
Remove the file {filename} from the vault.
GET/vault/{filename}Read a file from the vault · Return the content of a single file in your vault#
Ask an LLM
“How do I read the content of a file in my Obsidian vault?”
“Can I read just one heading or block of a note instead of the whole file?”
Tell an agent
Get the file {filename} from my vault.
Read only the {type} {target} of {filename}.
PATCH/vault/{filename}Insert content into a note · Partially update content in an existing note#
Ask an LLM
“How do I insert text into a note relative to a heading or block?”
“Can I insert content into a note's frontmatter?”
Tell an agent
Insert {operation} into {type} {target} of {filename}.
Patch {filename} by inserting {operation} at {type} {target}.
POST/vault/{filename}Append content to a file · Append content to a new or existing file#
Ask an LLM
“How do I append text to the end of a note that already exists?”
“Will a new file be created if I append to one that doesn't exist yet?”
Tell an agent
Append content to {filename}.
Add text to the end of {filename} in my vault.
PUT/vault/{filename}Create or overwrite a file in the vault · Create a new file in your vault or update the content of an existing one#
Ask an LLM
“How do I create a new note in my vault or overwrite an existing one?”
“Can I replace the whole content of a file in the vault?”
Tell an agent
Create or overwrite {filename} in my vault with this content.
Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.
Get an API key
Free tier, no form to fill in. Signing in shares your email address with us — we
store it to create your key and to recognise you if you sign in with another
provider. By signing up you are subscribing to the APIs.io and API Evangelist
newsletters — you can unsubscribe from any issue. See our
Privacy Policy and Terms.
openapi: 3.2.0
info:
description: You can use this interface for trying out your Local REST API in Obsidian.
title: Local REST API for Obsidian Vault Files API
version: '1.0'
servers:
- description: HTTPS (Secure Mode)
url: https://{host}:{port}
variables:
host:
default: 127.0.0.1
description: Binding host
port:
default: '27124'
description: HTTPS port
- description: HTTP (Insecure Mode)
url: http://{host}:{port}
variables:
host:
default: 127.0.0.1
description: Binding host
port:
default: '27123'
description: HTTP port
security:
- apiKeyAuth: []
tags:
- name: Vault Files
paths:
/vault/{filename}:
delete:
parameters:
- description: "Path to the relevant file (relative to your vault root).\n Optionally, you may include a reference to a sub-part of the document to return; see \"Targeting a Sub-part of your Document\" for details."
in: path
name: filename
required: true
schema:
format: path
type: string
responses:
'204':
description: Success
'404':
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
description: File does not exist.
'405':
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
description: 'Your path references a directory instead of a file; this request method is valid only for updating files.
'
summary: Delete a particular file in your vault
tags:
- Vault Files
operationId: deleteVaultByFilename
x-operation-id-source: derived
get:
description: 'Returns the content of the file at the specified path in your vault should the file exist.
# Targeting a Sub-part of your Document
You can operate on a specific section of a note instead of the whole file by providing `Target-Type` and `Target` headers:
- Set `Target-Type` to `heading`, `block`, or `frontmatter`.
- Set `Target` to the name of the heading, block reference, or frontmatter field. If the target contains non-ASCII characters (e.g. accented letters), percent-encode the value (e.g. `H%C3%A9llo` for `Héllo`).
- For nested headings, use the `Target-Delimiter` header (default `::`) to separate levels.
You can also embed the target type and target directly in the URL path after the note identifier instead of using headers. The segment immediately following the note identifier is the target type, and the remaining segments form the target:
- `.../heading/My%20Section` is equivalent to supplying `Target-Type: heading` and `Target: My%20Section`.
- For nested headings, add additional path segments: `.../heading/My%20Section/Subsection` is equivalent to `Target: My%20Section::Subsection`.
- `.../frontmatter/fieldName` targets the `fieldName` frontmatter field.
- `.../block/abc123` targets the block with reference ID `abc123`.
When URL-embedded values are present they take priority over the corresponding headers.
# Retrieving Document Metadata
## Metadata
If you specify the header `Accept: application/vnd.olrapi.note+json`, will return a JSON representation of your note including parsed tag and frontmatter data as well as filesystem metadata.
## Document Map
If you specify the header `Accept: application/vnd.olrapi.document-map+json`, will return a JSON object outlining what PATCH targets exist. See "responses" below for details.'
parameters:
- description: "Path to the relevant file (relative to your vault root).\n Optionally, you may include a reference to a sub-part of the document to return; see \"Targeting a Sub-part of your Document\" for details."
in: path
name: filename
required: true
schema:
format: path
type: string
- description: 'Type of sub-document section to target. When specified, the operation
applies only to the matching section rather than the whole file. Must
be used together with the `Target` header.
- `heading`: a markdown heading section.
- `block`: a block reference.
- `frontmatter`: a frontmatter field.
'
in: header
name: Target-Type
required: false
schema:
enum:
- heading
- block
- frontmatter
type: string
- description: 'The section to target; required when `Target-Type` is specified.
This value can be URL-Encoded and *must* be URL-Encoded if it
includes non-ASCII characters.
'
in: header
name: Target
required: false
schema:
type: string
- description: Delimiter used when specifying nested heading targets (e.g. "Heading 1::Subheading"). Defaults to "::".
in: header
name: Target-Delimiter
required: false
schema:
default: '::'
type: string
responses:
'200':
content:
application/json:
description: Returned when `Target-Type` is `frontmatter`; the JSON value of the specified frontmatter field.
schema: {}
application/vnd.olrapi.document-map+json:
schema:
properties:
blocks:
example:
- ^blockref1
- ^anotherBlockRef
items:
type: string
type: array
frontmatterFields:
example:
- title
- tags
- dateCreated
items:
type: string
type: array
headings:
example:
- Heading 1
- Heading 1::Subhead of Heading 1
- Heading 2
items:
type: string
type: array
type: object
application/vnd.olrapi.note+json:
schema:
$ref: '#/components/schemas/NoteJson'
text/markdown:
schema:
example: '# This is my document
something else here
'
type: string
description: Success
'404':
description: File or target section does not exist
summary: Return the content of a single file in your vault
tags:
- Vault Files
operationId: getVaultByFilename
x-operation-id-source: derived
patch:
description: Inserts content into an existing note relative to a heading, block reference, or frontmatter field within that document.
parameters:
- description: "Path to the relevant file (relative to your vault root).\n Optionally, you may include a reference to a sub-part of the document to return; see \"Targeting a Sub-part of your Document\" for details."
in: path
name: filename
required: true
schema:
format: path
type: string
- description: Patch operation to perform
in: header
name: Operation
required: true
schema:
enum:
- append
- prepend
- replace
type: string
- description: If the specified Target does not exist, create it?
in: header
name: Create-Target-If-Missing
required: false
schema:
default: 'false'
enum:
- 'true'
- 'false'
type: string
- description: If patch data already exists in Target, apply patch anyway?
in: header
name: Apply-If-Content-Preexists
required: false
schema:
default: 'false'
enum:
- 'true'
- 'false'
type: string
- description: Trim whitespace from Target content before applying the operation?
in: header
name: Trim-Target-Whitespace
required: false
schema:
default: 'false'
enum:
- 'true'
- 'false'
type: string
- description: 'Type of sub-document section to target. When specified, the operation
applies only to the matching section rather than the whole file. Must
be used together with the `Target` header.
- `heading`: a markdown heading section.
- `block`: a block reference.
- `frontmatter`: a frontmatter field.
'
in: header
name: Target-Type
required: true
schema:
enum:
- heading
- block
- frontmatter
type: string
- description: 'The section to target; required when `Target-Type` is specified.
This value can be URL-Encoded and *must* be URL-Encoded if it
includes non-ASCII characters.
'
in: header
name: Target
required: true
schema:
type: string
- description: Delimiter used when specifying nested heading targets (e.g. "Heading 1::Subheading"). Defaults to "::".
in: header
name: Target-Delimiter
required: false
schema:
default: '::'
type: string
requestBody:
content:
application/json:
schema:
example: '[''one'', ''two'']'
type: string
text/markdown:
schema:
example: '# This is my document
something else here
'
type: string
description: Content you would like to insert.
required: true
responses:
'200':
description: Success
'400':
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
description: Bad Request; see response message for details.
'404':
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
description: Does not exist
'405':
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
description: 'Your path references a directory instead of a file; this request method is valid only for updating files.
'
summary: Partially update content in an existing note
tags:
- Vault Files
operationId: patchVaultByFilename
x-operation-id-source: derived
post:
description: 'Appends content to the end of an existing note. If the specified file does not yet exist, it will be created as an empty file.
# Targeting a Sub-part of your Document
You can operate on a specific section of a note instead of the whole file by providing `Target-Type` and `Target` headers:
- Set `Target-Type` to `heading`, `block`, or `frontmatter`.
- Set `Target` to the name of the heading, block reference, or frontmatter field. If the target contains non-ASCII characters (e.g. accented letters), percent-encode the value (e.g. `H%C3%A9llo` for `Héllo`).
- For nested headings, use the `Target-Delimiter` header (default `::`) to separate levels.
You can also embed the target type and target directly in the URL path after the note identifier instead of using headers. The segment immediately following the note identifier is the target type, and the remaining segments form the target:
- `.../heading/My%20Section` is equivalent to supplying `Target-Type: heading` and `Target: My%20Section`.
- For nested headings, add additional path segments: `.../heading/My%20Section/Subsection` is equivalent to `Target: My%20Section::Subsection`.
- `.../frontmatter/fieldName` targets the `fieldName` frontmatter field.
- `.../block/abc123` targets the block with reference ID `abc123`.
When URL-embedded values are present they take priority over the corresponding headers.
When a target is specified the content is appended within that section and the full updated file content is returned with a `200` status. Without a target, the content is appended to the end of the file and a `204` status is returned.
If you need `prepend` or `replace` operations, use `PATCH` instead.'
parameters:
- description: "Path to the relevant file (relative to your vault root).\n Optionally, you may include a reference to a sub-part of the document to return; see \"Targeting a Sub-part of your Document\" for details."
in: path
name: filename
required: true
schema:
format: path
type: string
- description: If the specified Target does not exist, create it?
in: header
name: Create-Target-If-Missing
required: false
schema:
default: 'false'
enum:
- 'true'
- 'false'
type: string
- description: If patch data already exists in Target, apply patch anyway?
in: header
name: Apply-If-Content-Preexists
required: false
schema:
default: 'false'
enum:
- 'true'
- 'false'
type: string
- description: Trim whitespace from Target content before applying the operation?
in: header
name: Trim-Target-Whitespace
required: false
schema:
default: 'false'
enum:
- 'true'
- 'false'
type: string
- description: 'Type of sub-document section to target. When specified, the operation
applies only to the matching section rather than the whole file. Must
be used together with the `Target` header.
- `heading`: a markdown heading section.
- `block`: a block reference.
- `frontmatter`: a frontmatter field.
'
in: header
name: Target-Type
required: false
schema:
enum:
- heading
- block
- frontmatter
type: string
- description: 'The section to target; required when `Target-Type` is specified.
This value can be URL-Encoded and *must* be URL-Encoded if it
includes non-ASCII characters.
'
in: header
name: Target
required: false
schema:
type: string
- description: Delimiter used when specifying nested heading targets (e.g. "Heading 1::Subheading"). Defaults to "::".
in: header
name: Target-Delimiter
required: false
schema:
default: '::'
type: string
requestBody:
content:
text/markdown:
schema:
example: '# This is my document
something else here
'
type: string
description: Content you would like to append.
required: true
responses:
'200':
content:
text/markdown:
schema:
type: string
description: Success; targeted section updated. The full updated file content is returned.
'204':
description: Success; content appended to end of file.
'400':
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
description: Bad Request
'405':
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
description: 'Your path references a directory instead of a file; this request method is valid only for updating files.
'
summary: Append content to a new or existing file
tags:
- Vault Files
operationId: postVaultByFilename
x-operation-id-source: derived
put:
description: 'Creates a new file in your vault or updates the content of an existing one if the specified file already exists.
# Targeting a Sub-part of your Document
You can operate on a specific section of a note instead of the whole file by providing `Target-Type` and `Target` headers:
- Set `Target-Type` to `heading`, `block`, or `frontmatter`.
- Set `Target` to the name of the heading, block reference, or frontmatter field. If the target contains non-ASCII characters (e.g. accented letters), percent-encode the value (e.g. `H%C3%A9llo` for `Héllo`).
- For nested headings, use the `Target-Delimiter` header (default `::`) to separate levels.
You can also embed the target type and target directly in the URL path after the note identifier instead of using headers. The segment immediately following the note identifier is the target type, and the remaining segments form the target:
- `.../heading/My%20Section` is equivalent to supplying `Target-Type: heading` and `Target: My%20Section`.
- For nested headings, add additional path segments: `.../heading/My%20Section/Subsection` is equivalent to `Target: My%20Section::Subsection`.
- `.../frontmatter/fieldName` targets the `fieldName` frontmatter field.
- `.../block/abc123` targets the block with reference ID `abc123`.
When URL-embedded values are present they take priority over the corresponding headers.
When a target is specified the target section is replaced with the request body and the full updated file content is returned with a `200` status. If the target does not exist it will be created. Without a target, the entire file is replaced and a `204` status is returned.'
parameters:
- description: "Path to the relevant file (relative to your vault root).\n Optionally, you may include a reference to a sub-part of the document to return; see \"Targeting a Sub-part of your Document\" for details."
in: path
name: filename
required: true
schema:
format: path
type: string
- description: If patch data already exists in Target, apply patch anyway?
in: header
name: Apply-If-Content-Preexists
required: false
schema:
default: 'false'
enum:
- 'true'
- 'false'
type: string
- description: Trim whitespace from Target content before applying the operation?
in: header
name: Trim-Target-Whitespace
required: false
schema:
default: 'false'
enum:
- 'true'
- 'false'
type: string
- description: 'Type of sub-document section to target. When specified, the operation
applies only to the matching section rather than the whole file. Must
be used together with the `Target` header.
- `heading`: a markdown heading section.
- `block`: a block reference.
- `frontmatter`: a frontmatter field.
'
in: header
name: Target-Type
required: false
schema:
enum:
- heading
- block
- frontmatter
type: string
- description: 'The section to target; required when `Target-Type` is specified.
This value can be URL-Encoded and *must* be URL-Encoded if it
includes non-ASCII characters.
'
in: header
name: Target
required: false
schema:
type: string
- description: Delimiter used when specifying nested heading targets (e.g. "Heading 1::Subheading"). Defaults to "::".
in: header
name: Target-Delimiter
required: false
schema:
default: '::'
type: string
requestBody:
content:
'*/*':
schema:
type: string
text/markdown:
schema:
example: '# This is my document
something else here
'
type: string
description: Content of the file you would like to upload.
required: true
responses:
'200':
content:
text/markdown:
schema:
type: string
description: Success; targeted section replaced. The full updated file content is returned.
'204':
description: Success; entire file replaced.
'400':
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
description: 'Incoming file could not be processed. Make sure you have specified a reasonable file name, and make sure you have set a reasonable ''Content-Type'' header; if you are uploading a note, ''text/markdown'' is likely the right choice.
'
'405':
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
description: 'Your path references a directory instead of a file; this request method is valid only for updating files.
'
summary: Create a new file in your vault or update the content of an existing one
tags:
- Vault Files
operationId: putVaultByFilename
x-operation-id-source: derived
components:
schemas:
NoteJson:
properties:
content:
type: string
frontmatter:
type: object
path:
type: string
stat:
properties:
ctime:
type: number
mtime:
type: number
size:
type: number
required:
- ctime
- mtime
- size
type: object
tags:
items:
type: string
type: array
required:
- tags
- frontmatter
- stat
- path
- content
type: object
Error:
properties:
errorCode:
description: 'A 5-digit error code uniquely identifying this particular type of error.
'
example: 40149
type: number
message:
description: Message describing the error.
example: A brief description of the error.
type: string
type: object
securitySchemes:
apiKeyAuth:
description: 'Find your API Key in your Obsidian settings
in the "Local REST API" section under "Plugins".
'
scheme: bearer
type: http