Simple Javascript to Remove "API" from the DOM in the Discourse Main Admin Nav Menu

Here is some simple JS to remove the "API" menu item in the main Discourse admin nav bar (desktop view), for those who do not use the API and so don't need to display this menu item:

let items = document.querySelectorAll(".admin-main-nav > ul > li");
items.forEach(removeAPIMenuItem);
function removeAPIMenuItem(item){
   if (item.innerText == "API"){
       item.remove();
   }
}

Main menu after removing the "API" menu item from the DOM:

Unused menu item gone and menu simplified by simply customizing the theme in Discourse.