Docly Developers
Function API only Updated 17 Oct 2026

removeTag(path, tag)

Removes a tag from a document without touching its other tags.

The counterpart of addTag, and incremental for the same reason: only the tag you name is deleted, so a script running next to yours does not lose the tags it just added.

Parameters

pathstringrequired

Path to the document, from the site root. This is the published path, so it follows the same rules as a link: a schema-bound document is addressed without its .docly extension, while a schemaless document keeps its .json. Passing "/Invoices/Invoice 1001.docly" throws File not found; "/Invoices/Invoice 1001" is correct. The leading slash is optional.

tagstringrequired

The tag to remove. Normalized the same way it was when it was stored, so the casing you pass in does not matter. A value of several words removes every word in it.

Returns

An array of strings — the document's tags after the operation.

Removing a tag the document does not have is not an error. The end state is the one you asked for and the list comes back unchanged, so the call is safe to repeat.

Throws an error if the path or the tag is empty, if the path contains .. or a backslash, or if the file is not found.

The call runs as the user who published the site, not as the visitor. Check the visitor's own rights with allowModify before you change anything on their behalf. A target that only exists in the app (publish template) the site runs from throws error 110: the app's files are shared by every site on it and can't be changed from a site.

Example

Normal JavaScript, running in the browser or on the Docly™ server.
// Remove one tag. The document's other tags are left alone.
var tags = docly.removeTag("Invoices/Invoice 1001", "Paid");
// -> ["invoice", "2024"]

// Removing a tag that is not there is not an error.
docly.removeTag("Invoices/Invoice 1001", "unpaid");
// -> ["invoice", "2024"] - unchanged

// A tag of several words was stored as one tag per word,
// and is removed the same way - both words go.
docly.removeTag("Reports/Report 2024", "Annual report");

// Retag without a read-modify-write of the whole list
docly.removeTag("Invoices/Invoice 1001", "draft");
docly.addTag("Invoices/Invoice 1001", "approved");