Skip to the document
DocsReference

WordPress REST API

The plugin registers its own namespace, vergeml/v1, at /wp-json/vergeml/v1/…. It is what the plugin's own screens are built on, and it is available to you for the same reason.

Media taxonomies are also exposed through core's REST API — media_category is registered with show_in_rest, so wp/v2/media reports which folders a file is in and wp/v2/media_category lists the folders themselves. If all you need is "which folders is this file in", use core's routes.

Authentication #

These are logged-in admin endpoints, not a public API. They authenticate the same way any WordPress REST route does:

  • From the browser: the logged-in cookie plus a nonce in the X-WP-Nonce header, from wp_create_nonce( 'wp_rest' ).
  • From outside: application passwords, or whatever authentication plugin your site uses.

Every route has a permission callback. There is no anonymous access to any of them.

Capabilities #

CapabilityCovers
upload_filesReading the tree, reading folder lists
manage_categoriesCreating and changing folders, assigning files, running the AI, folder sorting, duplicates, the importer
manage_optionsSettings, including the licence key
delete_postsRemoving a duplicate from the duplicates screen
edit_post (per object)Quick edit, and assigning terms to a specific post

Assignment uses a coarse gate at the endpoint and then decides per object inside the handler, which is where it has always really been decided.


Folders and the tree #

RouteMethodCapabilityPurpose
/treeGETupload_filesThe whole folder tree with counts
/stateGETupload_filesThe tree's UI state for the current user
/folderPOSTmanage_categoriesCreate, rename, move, colour, reorder, delete a folder
/assignPOSTupload_files / per objectFile attachments into folders
/folder-privacyPOSTmanage_categoriesMake a folder private, or public again
/gallery-foldersGETupload_filesFolder list for the gallery block and builder elements

/tree is the hot path and is built to stay flat: 4 queries whatever the folder count, measured from 200 to 2,000 folders. See Performance.

RouteMethodCapabilityPurpose
/smart-scanPOSTmanage_categoriesRun one chunk of the reference scan
/search-meaningGETupload_filesSearch by meaning
/similarGETmanage_categoriesFiles like this one

Duplicates and setting aside #

RouteMethodCapabilityPurpose
/health-scanPOSTmanage_categoriesHash one batch
/health-reportGETmanage_categoriesDuplicate groups, sizes, totals
/health-usesGETmanage_categoriesWhere one file is referenced
/health-deletePOSTdelete_postsDelete a duplicate and repoint references
/merge-planGETmanage_categoriesWhich copy would be kept, and why
/merge-runPOSTmanage_categoriesApply that plan
/quarantineGETmanage_categoriesWhat has been set aside
/quarantine-actPOSTmanage_categoriesSet aside, or take back
/quarantine-manifestGETmanage_categoriesThe downloadable manifest

There is no delete endpoint in the set-aside feature. See Set aside.

Importing #

RouteMethodCapabilityPurpose
/importPOSTmanage_categoriesPlan, run a chunk, or undo an import

The AI #

RouteMethodCapabilityPurpose
/ai-statusGETmanage_categoriesWhether a key is set (has_license, boolean), credits, counts
/ai-settingsPOSTmanage_optionsWrite settings, including the licence key
/ai-indexPOSTmanage_categoriesDescribe the next few files
/ai-runGETmanage_categoriesState of the background run
/ai-altGETmanage_categoriesThe alt-text gap report
/alt-fill-stepPOSTmanage_categoriesFill alt text from stored descriptions
/alt-undoPOSTmanage_categoriesRemove alt text this plugin wrote

/ai-status never returns the licence key. It reports a boolean.

Folder sorting #

RouteMethodCapabilityPurpose
/librarian-schemesGETmanage_categoriesAvailable schemes
/librarian-preflightGET, POSTmanage_categoriesWhat a scheme would propose
/librarian-batchesGETmanage_categoriesPast runs
/librarian-apply-stepPOSTmanage_categoriesApply one chunk
/librarian-pausePOSTmanage_categoriesPause a run
/librarian-undo-stepPOSTmanage_categoriesUndo one chunk
/organize-quoteGETmanage_categoriesCost and shape of a subject run
/organize-runGETmanage_categoriesState of a clustering run
/organize-stepPOSTmanage_categoriesOne clustering step
/organize-cancelPOSTmanage_categoriesCancel it

Folder talk and instructions #

RouteMethodCapabilityPurpose
/folders-proposePOSTmanage_categoriesRevise a folder plan from an instruction
/folders-applyPOSTmanage_categoriesApply the plan you were shown
/folders-undoPOSTmanage_categoriesUndo it
/say-planPOSTmanage_categoriesParse a sentence into a plan
/say-runPOSTmanage_categoriesRun a plan you were shown

/say-run takes a plan, never the text. Four verbs are allowed — move, tag, rename, create — and there is no delete in the file to reach.

Auto-filing #

RouteMethodCapabilityPurpose
/autofile-stepPOSTmanage_categoriesSuggest folders for unfiled files
/autofile-actPOSTmanage_categoriesAccept or dismiss a suggestion

Miscellaneous #

RouteMethodCapabilityPurpose
/stats-optPOSTmanage_categoriesOpt in or out of the local statistics summary

A worked example #

Read the tree from the browser:

fetch( wpApiSettings.root + 'vergeml/v1/tree', {
  headers: { 'X-WP-Nonce': wpApiSettings.nonce },
} )
  .then( r => r.json() )
  .then( tree => console.log( tree ) );

File two attachments into folder 42, keeping them where they already are:

fetch( wpApiSettings.root + 'vergeml/v1/assign', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'X-WP-Nonce': wpApiSettings.nonce,
  },
  body: JSON.stringify( {
    taxonomy:    'media_category',
    attachments: [ 1841, 1842 ],
    add:         [ 42 ],
  } ),
} );

/assign takes taxonomy (required), then attachments with add and remove lists — or a batch array carrying its own attachments per group. mode decides whether a drop moves or adds, and post_type says which list the caller is looking at, so the counts that come back are the ones it is showing.

The permission callback is a coarse gate. The real check is per attachment inside the handler, because a batch is a batch of separate permissions: one call naming forty files must not be authorised by whether the caller may edit the first.

Or skip all of it and use core, since folders are terms:

wp_set_object_terms( 1841, array( 42 ), 'media_category', true );

That last line is the whole argument for the taxonomy decision.

Written from version 3.15.0 of the plugin. Last updated 2026-10-02. All documentation · Legal · Support