Tintero Developers

API reference

All 97 methods the plugin SDK exposes, with the permission each one requires.

On this page

Read out of tintero-plugin-sdk.build.ts, the SDK that Tintero puts inside your plugin's frame. The shapes and descriptions come from the published type definitions. The permission each one needs comes from methodScopeMap, which is the table Tintero itself checks on every call.

tintero.project

tintero.project.addCharacter() #

Create a new character. Requires at least name.

addCharacter(data: CharacterInput)Promise<Character>

tintero.project.addDoc() #

Create a new document in the project. Returns the created doc metadata.

addDoc(data: DocInput)Promise<DocMetadata>

tintero.project.addFile() #

Create a new file in the project. Returns the created file metadata.

addFile(data: FileInput)Promise<FileMetadata>

tintero.project.addImage() #

Save an image (a base64 string or a data: URI) into the project and return a reference to the saved image. Assign it to a character/worldbuilding portrait or landscape. Requires the project.write.images scope. Pairs with net.fetch({ responseType: 'base64' }) to import a remote image.

addImage(data: string, fileName?: string)Promise<string>

tintero.project.addNote() #

Create a new note. Requires location.

addNote(data: NoteInput)Promise<Note>

tintero.project.addWorldbuildingElement() #

Create a new worldbuilding element. Requires name and type.

addWorldbuildingElement(data: WorldbuildingInput)Promise<WorldbuildingElement>

tintero.project.getCardboards() #

Get all cardboard grids with their cells.

getCardboards()Promise<CardboardGrid[]>

tintero.project.getCharacterById() #

Get a character by ID.

getCharacterById(id: string)Promise<Character | null>

tintero.project.getCharacters() #

Get all characters.

getCharacters()Promise<Character[]>

tintero.project.getCollections() #

Get all collections.

getCollections()Promise<Collection[]>

tintero.project.getCustomWorldbuildingTemplates() #

Get the project's custom worldbuilding templates. Read-only.

getCustomWorldbuildingTemplates()Promise<CustomWorldbuildingTemplate[]>

tintero.project.getDocContent() #

Get the raw content of a document by its ID. Returns a ProseMirror/TipTap JSON string, or null. Same format as getFileContent().

getDocContent(docId: string)Promise<string | null>

tintero.project.getDocs() #

Get all documents (metadata only).

getDocs()Promise<DocMetadata[]>

tintero.project.getFileContent() #

Get the raw content of a file by its ID. Returns the file content as a ProseMirror/TipTap JSON string (the internal document format), or null if the file does not exist or has no content. You must JSON.parse() the result to obtain a ProseMirrorDocument object, or pass the raw string directly to tintero.convert.toHtml() / toMarkdown() / toText(). Those methods accept both the raw string and a parsed object.

getFileContent(fileId: string)Promise<string | null>

tintero.project.getFileSnapshots() #

Get the version snapshots of a file by its ID. Read-only.

getFileSnapshots(fileId: string)Promise<FileSnapshot[]>

tintero.project.getFiles() #

Get all project files (metadata only, no content).

getFiles()Promise<FileMetadata[]>

tintero.project.getFlowMaps() #

Get all flow maps (nodes and connections). Read-only.

getFlowMaps()Promise<FlowMap[]>

tintero.project.getFolders() #

Get the project's folder tree structure.

getFolders()Promise<FolderInfo[]>

tintero.project.getImageData() #

Get a project image as a base64 data URL. Accepts the image fileName or relativePath (e.g. "portrait.png" or "images/portrait.png"). Returns a string like "data:image/png;base64,..." or null if not found. Use this to display project images inside plugin iframes.

getImageData(imageRef: string)Promise<string | null>

tintero.project.getImages() #

Get all images metadata.

getImages()Promise<ImageInfo[]>

tintero.project.getMetadata() #

Get project metadata (name, dates, description).

getMetadata()Promise<ProjectMetadata>

tintero.project.getNotes() #

Get all notes.

getNotes()Promise<Note[]>

tintero.project.getPlotGrids() #

Get all plot grids with their columns and cells.

getPlotGrids()Promise<PlotGrid[]>

tintero.project.getScenes() #

Get the scenes defined within a file by its ID. Read-only.

getScenes(fileId: string)Promise<Scene[]>

tintero.project.getTags() #

Get all project tags.

getTags()Promise<string[]>

tintero.project.getTimelines() #

Get all timelines (lanes, blocks, notes, milestones). Read-only.

getTimelines()Promise<Timeline[]>

tintero.project.getWordCountLog() #

Get the per-day word count log. Read-only.

getWordCountLog()Promise<WordCountLog[]>

tintero.project.getWorldbuilding() #

Get all worldbuilding elements.

getWorldbuilding()Promise<WorldbuildingElement[]>

tintero.project.getWorldbuildingByType() #

Get worldbuilding elements by type (e.g. "location", "faction").

getWorldbuildingByType(type: string)Promise<WorldbuildingElement[]>

tintero.project.getWritingGoals() #

Get the user's writing goals (words/chapters/minutes targets). Read-only.

getWritingGoals()Promise<WritingGoal[]>

tintero.project.getWritingMinutesLog() #

Get the per-day writing-minutes log. Read-only.

getWritingMinutesLog()Promise<WritingMinutesLog[]>

tintero.project.removeWorldbuildingElement() #

Delete a worldbuilding element by ID.

removeWorldbuildingElement(id: string)Promise<void>

tintero.project.updateCharacter() #

Update an existing character's fields. Only provided fields are changed.

updateCharacter(id: string, data: Partial<CharacterInput>)Promise<void>

tintero.project.updateDocContent() #

Update the content of a document. Same format as updateFileContent().

updateDocContent(docId: string, jsonContent: string)Promise<void>

tintero.project.updateDocMeta() #

Update document metadata (not content). Only provided fields are changed.

updateDocMeta(id: string, data: DocMetaUpdate)Promise<void>

tintero.project.updateFileContent() #

Update the content of a file. jsonContent must be a ProseMirror/TipTap JSON string, i.e. the result of JSON.stringify(proseMirrorDocumentObject). To build a document from other formats, use tintero.convert.fromHtml(), fromMarkdown(), or fromText() first, then JSON.stringify() the returned object before passing it here.

updateFileContent(fileId: string, jsonContent: string)Promise<void>

tintero.project.updateFileMeta() #

Update file metadata (not content). Only provided fields are changed.

updateFileMeta(id: string, data: FileMetaUpdate)Promise<void>

tintero.project.updateTags() #

Replace all project tags.

updateTags(tags: string[])Promise<void>

tintero.project.updateWorldbuildingElement() #

Update an existing worldbuilding element.

updateWorldbuildingElement(id: string, data: Partial<WorldbuildingInput>)Promise<void>

tintero.fs

tintero.fs.deleteProjectFile() #

fs.write High

Delete a file from the project directory (relative path).

deleteProjectFile(location: string)Promise<void>

tintero.fs.getPlatform() #

Get the current platform as a compound string: "<os> | <runtime>". Examples: "darwin | Desktop", "win32 | Desktop", "linux | Desktop", "ios | Mobile", "android | Mobile", "unknown | Web".

getPlatform()Promise<string>

tintero.fs.readProjectFile() #

fs.read Medium

Read a file from the project directory (relative path).

readProjectFile(location: string)Promise<string | null>

tintero.fs.saveProject() #

fs.write High

Save the project metadata to disk.

saveProject()Promise<void>

tintero.fs.writeProjectFile() #

fs.write High

Write a file to the project directory (relative path).

writeProjectFile(location: string, content: string)Promise<void>

tintero.ui

tintero.ui.closeDialog() #

ui.dialog Medium

Close the plugin's open dialog.

closeDialog()Promise<void>

tintero.ui.hideSidebar() #

ui.window Medium

Hide the application sidebar.

hideSidebar()Promise<void>

tintero.ui.isFullscreen() #

ui.window Medium

Check if the application is currently in fullscreen mode.

isFullscreen()Promise<boolean>

tintero.ui.openDialog() #

ui.dialog Medium

Open a modal dialog for this plugin.

openDialog(options?: DialogOptions)Promise<void>

tintero.ui.render() #

ui.sidebar Medium

Render HTML into the active context. If a dialog is open for this plugin, renders into the dialog. Otherwise, renders into the sidebar panel's #plugin-root.

render(html: string)Promise<void>

tintero.ui.showNotification() #

Show a toast notification.

showNotification(message: string, type?: NotificationType, durationMs?: number)Promise<void>

tintero.ui.showSidebar() #

ui.window Medium

Show the application sidebar.

showSidebar()Promise<void>

tintero.ui.toggleFullscreen() #

ui.window Medium

Toggle fullscreen mode (Desktop only).

toggleFullscreen()Promise<void>

tintero.ui.toggleSidebar() #

ui.window Medium

Toggle the application sidebar visibility.

toggleSidebar()Promise<void>

tintero.storage

tintero.storage.get() #

storage Low

Get a stored value by key. Returns null if not found.

get(key: string)Promise<any | null>

tintero.storage.getAll() #

storage Low

Get all stored key-value pairs.

getAll()Promise<Record<string, any>>

tintero.storage.remove() #

storage Low

Remove a stored key.

remove(key: string)Promise<void>

tintero.storage.set() #

storage Low

Store a value. Values are JSON-serializable.

set(key: string, value: any)Promise<void>

tintero.settings

tintero.settings.get() #

settings Low

Get all plugin settings (manifest defaults merged with stored overrides).

get()Promise<Record<string, any>>

tintero.settings.getField() #

settings Low

Get a specific setting field value.

getField(key: string)Promise<any | null>

tintero.app

tintero.app.getSettings() #

Get a sanitized copy of application settings (AI credentials excluded).

getSettings()Promise<AppSettings>

tintero.app.getSettingsField() #

Get a specific setting field by dot path (e.g. "generalSettings.languageIsoCode").

getSettingsField(path: string)Promise<any | null>

tintero.app.updateSettings() #

Modify application settings. Allowed sections: generalSettings, trophySettings, hideSettings, editorSettings, editorToolbarSettings. AI settings cannot be modified.

updateSettings(changes: Partial<Pick<AppSettings, 'generalSettings' | 'trophySettings' | 'hideSettings' | 'editorSettings' | 'editorToolbarSettings'>>)Promise<void>

tintero.backup

tintero.backup.create() #

backup.create Medium

Create a backup. Returns the backup ID.

create(name?: string, observations?: string)Promise<string>

tintero.backup.getById() #

backup.list Medium

Get a specific backup by ID.

getById(id: string)Promise<BackupEntry | null>

tintero.backup.list() #

backup.list Medium

List all backups.

list()Promise<BackupEntry[]>

tintero.backup.restore() #

Restore a backup. WARNING: This replaces the current project data.

restore(id: string)Promise<void>

tintero.events

tintero.events.on() #

no permission

Subscribe to an event.

on(event: PluginEvent, callback: EventCallback)void

tintero.events.off() #

no permission

Unsubscribe from an event.

off(event: PluginEvent, callback: EventCallback)void

tintero.export

tintero.export.exportFile() #

export.file Medium

Trigger a file download to the user's device.

exportFile(fileName: string, content: string, mimeType?: string)Promise<void>

tintero.export.registerBookExporter() #

Register this plugin as a book exporter (all files concatenated).

registerBookExporter(config: BookExporterConfig)Promise<void>

tintero.export.registerExporter() #

export.file Medium

Register this plugin as a file exporter. The convert function is called when the user exports.

registerExporter(config: FileExporterConfig)Promise<void>

tintero.export.registerProjectExporter() #

Register this plugin as a project exporter.

registerProjectExporter(config: ProjectExporterConfig)Promise<void>

tintero.import

tintero.import.registerImporter() #

import.file Medium

Register this plugin as a file importer. The convert function receives raw file data.

registerImporter(config: FileImporterConfig)Promise<void>

tintero.import.registerProjectImporter() #

Register this plugin as a project importer.

registerProjectImporter(config: ProjectImporterConfig)Promise<void>

tintero.editor

Live editor state: active document, open tabs, text selection, and write operations.

tintero.editor.getActiveDocument() #

Get the currently active/focused document, or null if no editor is open.

getActiveDocument()Promise<OpenDocument | null>

tintero.editor.getOpenDocuments() #

Get all documents currently open in editor tabs.

getOpenDocuments()Promise<OpenDocument[]>

tintero.editor.getSelection() #

Get the current text selection in the active editor. Returns null if no editor is open. Positions are ProseMirror document positions (use with insertAt/replaceRange).

getSelection()Promise<EditorSelection | null>

tintero.editor.getWordCount() #

Get the word count of the active document. Returns 0 if no editor is open.

getWordCount()Promise<number>

tintero.editor.insertAt() #

Insert HTML content at a specific position in the active editor.

insertAt(position: number, html: string)Promise<void>

tintero.editor.replaceRange() #

Replace a range of content in the active editor.

replaceRange(from: number, to: number, html: string)Promise<void>

tintero.editor.replaceSelection() #

Replace the current selection with HTML content. If the selection is empty (cursor only), inserts at the cursor position.

replaceSelection(html: string)Promise<void>

tintero.debug

tintero.debug.clear() #

Clear the console log buffer.

clear()Promise<void>

tintero.debug.getLogs() #

Get all stored console log entries. Requires debug.console scope.

getLogs()Promise<ConsoleEntry[]>

tintero.convert

Stateless format converters between ProseMirror JSON, HTML, Markdown, and plain text.

tintero.convert.fromHtml() #

Convert HTML to ProseMirror JSON. Supports standard HTML elements: <p>, <h1><h6>, <strong>, <em>, <a>, <ul>, <ol>, <blockquote>, <code>, <table>, etc.

fromHtml(html: string)Promise<ProseMirrorDocument>

tintero.convert.fromMarkdown() #

Convert Markdown to ProseMirror JSON. Parses standard Markdown syntax (headings, bold, italic, links, lists, code blocks).

fromMarkdown(markdown: string)Promise<ProseMirrorDocument>

tintero.convert.fromText() #

Convert plain text to ProseMirror JSON. Each line becomes a paragraph node.

fromText(text: string)Promise<ProseMirrorDocument>

tintero.convert.toHtml() #

Convert ProseMirror JSON to clean HTML. Returns HTML fragment (no <html>/<body> wrapper). Supports headings, paragraphs, lists, bold, italic, links, images. Accepts a parsed ProseMirrorDocument object or a raw JSON string.

toHtml(json: ProseMirrorDocument | string)Promise<string>

tintero.convert.toMarkdown() #

Convert ProseMirror JSON to Markdown. Uses ATX-style headings (#), bold, *italic*, [links](url). Accepts a parsed ProseMirrorDocument object or a raw JSON string.

toMarkdown(json: ProseMirrorDocument | string)Promise<string>

tintero.convert.toText() #

Convert ProseMirror JSON to plain text. Extracts text content, discarding all formatting. Accepts a parsed ProseMirrorDocument object or a raw JSON string (as returned by getFileContent()).

toText(json: ProseMirrorDocument | string)Promise<string>

tintero.net

Proxied HTTP access to the hosts declared in `network.domains`.

tintero.net.fetch() #

net.fetch High

Perform an HTTP request to an external host (proxied by the host app). Requires the net.fetch scope and the target host must be listed in the plugin manifest's network.domains allow-list (the user approves those domains at install time). Requests to any other host are rejected. Supports exact hosts and leading-wildcard subdomains (*.example.com).

fetch(url: string, options?: NetFetchOptions)Promise<NetFetchResponse>

tintero.media

Control the host's background media player (public YouTube playback).

tintero.media.getNowPlaying() #

media.control Medium
getNowPlaying()Promise<MediaNowPlaying | null>

tintero.media.getState() #

media.control Medium
getState()Promise<'idle' | 'playing' | 'paused' | 'buffering' | 'ended'>

tintero.media.next() #

media.control Medium
next()Promise<void>

tintero.media.pause() #

media.control Medium
pause()Promise<void>

tintero.media.play() #

media.control Medium

Play a public YouTube video or playlist (URL or id) in the host's background player.

play(source: string)Promise<void>

tintero.media.previous() #

media.control Medium
previous()Promise<void>

tintero.media.resume() #

media.control Medium
resume()Promise<void>

tintero.media.setVolume() #

media.control Medium

Set the volume, 0–100.

setVolume(volume: number)Promise<void>

tintero.media.stop() #

media.control Medium
stop()Promise<void>