npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@brickert/edgeosapi

v0.0.4

Published

Ubiquiti EdgeOS NodeJS API Wrapper

Readme

EdgeOSAPI

An unofficial API wrapper in NodeJS for the Ubiquiti EdgeOS devices v1.x.x.

Notes

Tested on a EdgeRouter X v1.10.7. I'm assuming this is only compatible on the v1.x.x firmware only.

You may want to do a dry-run with an API client like PostMan on the endpoint /api/edge/get.json. After logging-in with a cookie session to view all the object properties.

Logging in on the root directory with a POST request with an x-www-form-urlencoded body with username and password key pair. Reuse the cookies for the subsequent requests. If you don't get 3 cookies (That I'm aware of) you may need to manually handle the initial redirects to the dashboard.

Protected requests (anything that changes the device) requires adding a X-CSRF-TOKEN to the headers; obtained from the cookies after login. Cookies by default are only good for about 20 minutes. It renews with every successful request.

Most of the help was from Matthew1471 from their repo at https://github.com/matthew1471/EdgeOS-API/tree/master/Documentation. Thank you!

Features

I have changed some properties to make it easier to access. However, you will need to follow exactly (including case-sensitivity) how it's structured when setting, updating, and removing configurations. (See the /api/edge/get.json response) The request will still go through, but nothing will update. This is a limitation by Ubiquiti that cannot be worked around from what I know.

Enough methods are completed for the basic CRUD operations on most properties on the device. With most things requiring the use of batch set and delete endpoint and method EdgeOS.batchSetConfig() & EdgeOS.batchDeleteConfig()

As I push updates to this more methods will appear. There will be some properties missing here that are not accessible. It's around 90% coverage. I have not implemented anything related to the Unifi and UNMS stuff.

Installation

Use the package manager npm to install.

npm install @brickert/edgeosapi

Usage

import { EdgeOS } from '@brickert/edgeosapi`;

try {
   const edgeOS = new EdgeOS({
       cookie_session_lifetime = 10,
       hostName = "example.local",
       username = "admin",
       password = "password",
       userAgent = "EdgeOSAPI"
   });

   await edgeOS.retryableLogin(3);
   
   await edgeOS.firewall.fetch();
   
   console.log(edgeOS.firewall.groups.network_groups.filter(group => group.name == "LAN"));
   /*   {
            name: "LAN",
            address: ["192.168.1.0/24"],
            description: "Example comment"
        }
    */
} catch (e) {
   throw e;
}