netbox.rs: an ergonomic netbox client in rust

Sun, 25 Jan 2026 00:00:00 +0000
network automation, tooling, release

interact with netbox in your code and cli
cargo install netbox-cli

netbox.rs is a rust project that provides three pieces:

a low-level rust client autogenerated from an openapi spec,

an ergonomic client intended to be used by humans in their code, and

a cli that you can use to interact with netbox from your terminal.

why?

i realized that most existing rust solutions for interacting with netbox did not fit my needs. i want a client that would be a joy to use, because i’ll be using it extensively across many follow-on projects, most notably alembic, the larger dcim/ipam tool i’m currently working on¹.

quick start

from rust:

use netbox::{Client, ClientConfig};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let config = ClientConfig::new("https://netbox.example.com", "your-api-token");
    let client = Client::new(config)?;

    let devices = client.dcim().devices().list(None).await?;
    for device in devices.results {
        println!("device: {} (id: {})", device.display, device.id);
    }

    Ok(())
}

in the cli:

# list devices
netbox-cli --url https://netbox.example.com --token $TOKEN dcim devices list

# create a circuit
netbox-cli circuits circuits create --json '{"cid":"CIR-1001","provider":1,"type":1}'

# special: interaction with the branching plugin
netbox-cli plugin-branch-action 1 merge --json '{"commit":true}'

1. announcement for that project will follow when the dust settles.↩︎