JavaScript API
A global window.Redline is available once the classic script loads. The
ES module exports the same controller as default, plus named init and
destroy functions. The module does not start until init(config) is called.
Redline.open(); // show the review layer and open the comments panel
Redline.close();
Redline.toggle();
Redline.enable(); // show the review layer
Redline.disable(); // collapse to the launcher
Redline.setTool("highlight");// show the layer, then choose cursor | highlight | rect | circle | pen | pin
Redline.comments(); // → array of comment objects for this page
Redline.focus(id); // scroll to & highlight a comment
Redline.export(); // trigger the JSON download for this page
Redline.export({ scope: "site" }); // one file with every page's comments
Redline.import(); // open the file picker
await Redline.submit(); // POST the JSON export to postUrl
Redline.refresh(); // manually re-read the current page when spa is off
Redline.destroy(); // remove UI, observers, and event listeners
Redline.init({ spa: true }); // start again with programmatic settings
Redline.clear(); // delete all comments on this page (local)
Redline.toast("Saved!"); // show a toast
Redline.markdown({ detail: "standard" }); // Markdown for AI agents ("" when nothing is open)
await Redline.copy(); // copy that Markdown; { format: "json" } copies the export
Redline.setFrozen(true); // pause page animations, transitions and media; returns the new state
Redline.isFrozen(); // true while motion is frozen
window.addEventListener("annotate:freeze", e => console.log(e.detail.frozen));
Redline.version; // "2.4.0"
Comment shape
{
"id": "c…",
"page": "marketing-site:/pricing",
"url": "https://example.com/pricing",
"type": "highlight",
"author": "Jane Doe",
"text": "This price looks out of date.",
"color": "#f59e0b",
"anchor": { "exact": "…", "prefix": "…", "suffix": "…" },
"geom": null,
"target": { "label": "Paragraph \"…\"", "selector": "…", "…": "…" },
"resolved": false,
"replies": [],
"createdAt": "2026-06-16T10:00:00.000Z",
"updatedAt": "2026-06-16T10:00:00.000Z"
}
target is present on comments made with 1.6 or later.
