Skip to content

Misc API

English API reference for the clipboard, console, log, menu, misc, panel, system, test family.

This page is the primary owner for the namespaces listed below. Method names, parameter keys, and return fields follow the C++ RegisterApi handlers.

clipboard

clipboard.read

Public API method. Runtime authority: src/api/ClipboardApi.cpp:319.

No parameters.

Returns: {"files":[],"hasFiles":true,"hasImage":true,"hasText":true,"success":true,"text":"..."}

js
const result = await fb2k.invoke('clipboard.read');

clipboard.write

Public API method. Runtime authority: src/api/ClipboardApi.cpp:322.

ParameterTypeRequiredDescription
textstringNoOptional; default .

Returns: {"error":"...","success":true}

js
const result = await fb2k.invoke('clipboard.write', { text: /* value */ });

clipboard.writeFiles

Public API method. Runtime authority: src/api/ClipboardApi.cpp:328.

ParameterTypeRequiredDescription
pathsarrayYesRequired.

Returns: {"error":"...","fileCount":"...","success":true}

js
const result = await fb2k.invoke('clipboard.writeFiles', { paths: /* value */ });

clipboard.writeHTML

Public API method. Runtime authority: src/api/ClipboardApi.cpp:325.

ParameterTypeRequiredDescription
htmlstringNoOptional; default .
plainTextstringNoOptional; default .

Returns: {"error":"...","htmlWritten":"...","success":true,"textWritten":"..."}

js
const result = await fb2k.invoke('clipboard.writeHTML', { html: /* value */, plainText: /* value */ });

console

console.error

Public API method. Runtime authority: src/api/ConsoleApi.cpp:308.

Provide one of message or args. Empty payloads fail with message is required.

ParameterTypeRequiredDescription
messagestringNoOptional log text. Non-string values are serialized.
argsarrayNoOptional argument list joined with spaces when message is omitted.

Returns: {"error":"...","success":true}

js
const result = await fb2k.invoke('console.error', { message: 'failed to load artwork' });

console.log

Public API method. Runtime authority: src/api/ConsoleApi.cpp:302.

Provide one of message or args. Empty payloads fail with message is required.

ParameterTypeRequiredDescription
messagestringNoOptional log text. Non-string values are serialized.
argsarrayNoOptional argument list joined with spaces when message is omitted.

Returns: {"error":"...","success":true}

js
const result = await fb2k.invoke('console.log', { message: 'track started' });

console.warn

Public API method. Runtime authority: src/api/ConsoleApi.cpp:305.

Provide one of message or args. Empty payloads fail with message is required.

ParameterTypeRequiredDescription
messagestringNoOptional log text. Non-string values are serialized.
argsarrayNoOptional argument list joined with spaces when message is omitted.

Returns: {"error":"...","success":true}

js
const result = await fb2k.invoke('console.warn', { args: ['retry', 3] });

log

log.clear

Public API method. Runtime authority: src/api/ConsoleApi.cpp:317.

No parameters.

Returns: {"error":"...","success":true}

js
const result = await fb2k.invoke('log.clear');

log.read

Public API method. Runtime authority: src/api/ConsoleApi.cpp:314.

ParameterTypeRequiredDescription
linesintegerNoOptional; default 100.

Returns: {"content":"...","error":"...","lineCount":"...","lines":"...","success":true,"totalLines":"..."}

js
const result = await fb2k.invoke('log.read', { lines: /* value */ });

log.write

Public API method. Runtime authority: src/api/ConsoleApi.cpp:311.

ParameterTypeRequiredDescription
messagestringNoOptional; default omitted.
argsarrayNoOptional; default [].
filestringNoOptional; default omitted.
levelstringNoOptional; default info.
appendbooleanNoOptional; default true.
timestampbooleanNoOptional; default true.

Returns: {"error":"...","path":"...","success":true}

js
const result = await fb2k.invoke('log.write', { message: /* value */, args: /* value */, append: /* value */, file: /* value */, level: /* value */, timestamp: /* value */ });

Public API method. Runtime authority: src/api/MenuApi.cpp:1141-1146.

ParameterTypeRequiredDefaultDescription
reasonstringNoapiOptional close reason passed to the overlay host; default api.

Returns: {"success":true}

js
const result = await fb2k.invoke('menu.close', { reason: 'api' });

Public API method. Runtime authority: src/api/MenuApi.cpp:1330.

ParameterTypeRequiredDescription
handlesarrayNoOptional; default [].
i18nbooleanNoOptional; default true.
localestringNoOptional; default auto.
modestringNoOptional; auto, selection, playlist, nowPlaying, or handles; default auto.
withAvailabilitybooleanNoOptional; default true.

Returns: {"Failed to initialize context menu":"...","error":"...","i18n":"...","items":"...","locale":"...","mode":"...","success":true,"withAvailability":"..."}

js
const result = await fb2k.invoke('menu.getContextMenu', { i18n: /* value */, locale: /* value */, mode: /* value */, withAvailability: /* value */, handles: /* value */ });

Public API method. Runtime authority: src/api/MenuApi.cpp:1329.

ParameterTypeRequiredDescription
i18nbooleanNoOptional; default true.
localestringNoOptional; default auto.
rootstringNoOptional; default .
withAvailabilitybooleanNoOptional; default true.

Returns: {"error":"...","fallback":"...","items":[],"success":true}

js
const result = await fb2k.invoke('menu.getMainMenu', { i18n: /* value */, locale: /* value */, root: /* value */, withAvailability: /* value */ });

Public API method. Runtime authority: src/api/MenuApi.cpp:1328.

ParameterTypeRequiredDescription
commandstringNoOptional; default .

Returns: {"error":"...","guid":"...","itemCount":"...","success":true}

js
const result = await fb2k.invoke('menu.runContextCommand', { command: /* value */ });

Public API method. Runtime authority: src/api/MenuApi.cpp:1331.

ParameterTypeRequiredDescription
idintegerNoOptional; default -1.
modestringNoOptional; default auto.
handlesarrayNoOptional; default [].

Returns: {"Failed to initialize context menu":"...","error":"...","success":true}

js
const result = await fb2k.invoke('menu.runContextCommandById', { id: /* value */, mode: /* value */, handles: /* value */ });

Public API method. Runtime authority: src/api/MenuApi.cpp:1327.

ParameterTypeRequiredDescription
commandstringNoOptional; default .

Returns: {"error":"...","guid":"...","success":true}

js
const result = await fb2k.invoke('menu.runMainMenuCommand', { command: /* value */ });

Public API method. Runtime authority: src/api/MenuApi.cpp:1333.

ParameterTypeRequiredDescription
itemsarrayNoOptional; default omitted.
xintegerNoOptional; default -1.
yintegerNoOptional; default -1.

Returns: {"error":"...","menuId":"...","success":true}

js
const result = await fb2k.invoke('menu.show', { items: /* value */, x: /* value */, y: /* value */ });

Public API method. Runtime authority: src/api/MenuApi.cpp:1332.

ParameterTypeRequiredDescription
handlesarrayNoOptional; default [].
modestringNoOptional; auto, selection, playlist, nowPlaying, or handles; default auto.

Returns: {"error":"...","success":true}

js
const result = await fb2k.invoke('menu.showNativePopup', { handles: /* value */, mode: /* value */ });

misc

misc.exit

Public API method. Runtime authority: src/api/MiscApi.cpp:132.

No parameters.

Returns: {"success":true}

js
const result = await fb2k.invoke('misc.exit');

misc.getComponentPath

Public API method. Runtime authority: src/api/MiscApi.cpp:126.

No parameters.

Returns: {"path":"...","value":"..."}

js
const result = await fb2k.invoke('misc.getComponentPath');

misc.getFoobarPath

Public API method. Runtime authority: src/api/MiscApi.cpp:124.

No parameters.

Returns: {"path":"...","value":"..."}

js
const result = await fb2k.invoke('misc.getFoobarPath');

misc.getProfilePath

Public API method. Runtime authority: src/api/MiscApi.cpp:125.

No parameters.

Returns: {"path":"...","value":"..."}

js
const result = await fb2k.invoke('misc.getProfilePath');

misc.restart

Public API method. Runtime authority: src/api/MiscApi.cpp:131.

No parameters.

Returns: {"success":true}

js
const result = await fb2k.invoke('misc.restart');

misc.showConsole

Public API method. Runtime authority: src/api/MiscApi.cpp:127.

No parameters.

Returns: {"success":true}

js
const result = await fb2k.invoke('misc.showConsole');

misc.showLibrarySearch

Public API method. Runtime authority: src/api/MiscApi.cpp:129.

ParameterTypeRequiredDescription
querystringNoOptional; default .

Returns: {"query":"...","success":true}

js
const result = await fb2k.invoke('misc.showLibrarySearch', { query: /* value */ });

misc.showPopupMessage

Public API method. Runtime authority: src/api/MiscApi.cpp:130.

ParameterTypeRequiredDescription
messagestringNoOptional; default .
msgstringNoOptional; default .
titlestringNoOptional; default Message.

Returns: {"success":true}

js
const result = await fb2k.invoke('misc.showPopupMessage', { message: /* value */, msg: /* value */, title: /* value */ });

Owner-family behavior and limits

  • clipboard.writeFiles accepts media-read-authorized paths. clipboard.writeHTML writes HTML plus a plain-text fallback; clipboard.read reports only formats currently available from the Windows clipboard.
  • console.log, console.warn, console.error, and log.write require one of message or args. log.write.file, when accepted, is only a leaf .log or .txt filename under the profile directory; paths, traversal and Windows reserved device names are rejected by the runtime.
  • menu.getContextMenu, menu.runContextCommandById, and menu.showNativePopup use mode to select handles, nowPlaying, selection, or playlist context. auto tries those sources in that order, ending with playlist context. In handles mode, every path is media-access validated before a handle is created. menu.showNativePopup uses screen cursor coordinates and returns before the native menu is displayed.
  • menu.show opens the self-drawn overlay after resource validation. menu.close only closes the active overlay; menu.__* endpoints are internal and are not public APIs.
  • misc.showPopupMessage accepts message, falling back to msg, and defaults title to "Message". The restart and exit methods request the corresponding foobar2000 standard command.
  • panel.setConfig changes only its documented panel fields. system.* reports registered runtime and plugin information; test.* is diagnostic surface rather than application behavior.

misc.showPreferences

Public API method. Runtime authority: src/api/MiscApi.cpp:128.

No parameters.

Returns: {"success":true}

js
const result = await fb2k.invoke('misc.showPreferences');

panel

panel.getConfig

Public API method. Runtime authority: src/api/WindowApi.cpp:2470.

No parameters.

Returns: {"config":{},"success":true}

js
const result = await fb2k.invoke('panel.getConfig');

panel.setConfig

Public API method. Runtime authority: src/api/WindowApi.cpp:2471.

ParameterTypeRequiredDescription
enableDragDropbooleanNoOptional; default omitted.
grabFocusbooleanNoOptional; default omitted.
panelNamestringNoOptional; default omitted.
transparentBackgroundbooleanNoOptional; default omitted.

Returns: {"changed":"...","error":"...","success":true}

js
const result = await fb2k.invoke('panel.setConfig', { enableDragDrop: /* value */, grabFocus: /* value */, panelName: /* value */, transparentBackground: /* value */ });

system

system.getApiStats

Public API method. Runtime authority: src/api/PluginRegistry.cpp:490.

No parameters.

Returns: {"registered":"...","success":true}

js
const result = await fb2k.invoke('system.getApiStats');

system.getApisByNamespace

Public API method. Runtime authority: src/api/PluginRegistry.cpp:454.

ParameterTypeRequiredDescription
namespacestringNoOptional; default .

Returns: JSON object from the runtime handler.

js
const result = await fb2k.invoke('system.getApisByNamespace', { namespace: /* value */ });

system.getDPI

Public API method. Runtime authority: src/api/WindowApi.cpp:2426.

No parameters.

Returns: {"dpi":"...","scale":"..."}

js
const result = await fb2k.invoke('system.getDPI');

system.getLocale

Public API method. Runtime authority: src/api/WindowApi.cpp:2429.

No parameters.

Returns: {"country":"...","language":"...","locale":"..."}

js
const result = await fb2k.invoke('system.getLocale');

system.getRegisteredPlugins

Public API method. Runtime authority: src/api/PluginRegistry.cpp:496.

No parameters.

Returns: {"registered":"...","success":true}

js
const result = await fb2k.invoke('system.getRegisteredPlugins');

system.getTheme

Public API method. Runtime authority: src/api/WindowApi.cpp:2425.

No parameters.

Returns: {"accentColor":"...","darkMode":"...","isDark":"...","transparency":"..."}

js
const result = await fb2k.invoke('system.getTheme');

system.isPluginRegistered

Public API method. Runtime authority: src/api/PluginRegistry.cpp:509.

ParameterTypeRequiredDescription
namespacestringNoOptional; default .

Returns: {"registered":"...","success":true}

js
const result = await fb2k.invoke('system.isPluginRegistered', { namespace: /* value */ });

system.listAvailableApis

Public API method. Runtime authority: src/api/PluginRegistry.cpp:438.

ParameterTypeRequiredDescription
includeExternalbooleanNoOptional; default true.
includeInternalbooleanNoOptional; default true.

Returns: JSON object from the runtime handler.

js
const result = await fb2k.invoke('system.listAvailableApis', { includeExternal: /* value */, includeInternal: /* value */ });

system.searchApis

Public API method. Runtime authority: src/api/PluginRegistry.cpp:472.

ParameterTypeRequiredDescription
querystringNoOptional; default .

Returns: JSON object from the runtime handler.

js
const result = await fb2k.invoke('system.searchApis', { query: /* value */ });

test

test.echo

Public API method. Runtime authority: src/api/PlaybackApi.cpp:697.

ParameterTypeRequiredDescription
messagejsonNoOptional; default omitted.

Returns: {"echo":"...","input":"...","success":true}

js
const result = await fb2k.invoke('test.echo', { message: /* value */ });

test.ping

Public API method. Runtime authority: src/api/PlaybackApi.cpp:698.

No parameters.

Returns: {"pong":"...","timestamp":"..."}

js
const result = await fb2k.invoke('test.ping');

Contract supplements

The sections below close public-contract findings from the strict parameter audit without replacing existing explanations.

Contract supplement: log.write

Verified contract supplement. Runtime authority: src/api/ConsoleApi.cpp:140-221.

ParameterTypeRequiredDefaultDescription
messagestringNoomittedOptional; default omitted.
argsarrayNo[]Optional; default [].
filestringNoomittedOptional; default omitted.
levelstringNoinfoOptional; default info.
appendbooleanNotrueOptional; default true.
timestampbooleanNotrueOptional; default true.

Return fields

FieldTypeOptional
errorstringYes
successbooleanNo
pathjsonNo

Semantics: omitted optional parameters use handler defaults; failure branches and error fields are defined by this source file.

js
const result = await fb2k.invoke('log.write', { message: /* value */, args: /* value */, file: /* value */, level: /* value */, append: /* value */, timestamp: /* value */ });

Contract supplement: menu.getContextMenu

Verified contract supplement. Runtime authority: src/api/MenuApi.cpp:980-1024.

ParameterTypeRequiredDefaultDescription
handlesarrayNo[]Optional; default [].
i18nbooleanNotrueOptional; default true.
localestringNoautoOptional; default auto.
modestringNoautoOptional; default auto.
withAvailabilitybooleanNotrueOptional; default true.

Return fields

FieldTypeOptional
errorstringYes
successbooleanNo
i18njsonNo
itemsjsonNo
localejsonNo
modejsonNo
withAvailabilityjsonNo

Semantics: omitted optional parameters use handler defaults; failure branches and error fields are defined by this source file.

js
const result = await fb2k.invoke('menu.getContextMenu', { handles: /* value */, i18n: /* value */, locale: /* value */, mode: /* value */, withAvailability: /* value */ });

Contract supplement: menu.runContextCommandById

Verified contract supplement. Runtime authority: src/api/MenuApi.cpp:1024-1045.

ParameterTypeRequiredDefaultDescription
idintegerNo-1Optional; default -1.
modestringNoautoOptional; default auto.
handlesarrayNo[]Optional; default [].

Return fields

FieldTypeOptional
errorstringYes
successbooleanNo

Semantics: omitted optional parameters use handler defaults; failure branches and error fields are defined by this source file.

js
const result = await fb2k.invoke('menu.runContextCommandById', { id: /* value */, mode: /* value */, handles: /* value */ });

Contract supplement: misc.showPopupMessage

Verified contract supplement. Runtime authority: src/api/MiscApi.cpp:97-105.

ParameterTypeRequiredDefaultDescription
messagestringNo``Optional; default .
msgstringNo``Optional; default .
titlestringNoMessageOptional; default Message.

Return fields

FieldTypeOptional
successbooleanNo

Semantics: omitted optional parameters use handler defaults; failure branches and error fields are defined by this source file.

js
const result = await fb2k.invoke('misc.showPopupMessage', { message: /* value */, msg: /* value */, title: /* value */ });