Skip to content
Python API client library for Netbox.
Branch: master
Clone or download
zachmoody Merge pull request #223 from digitalocean/fix-nb27-choice
Fixes #221 - Account for changes in choices field
Latest commit 2523bd9 Feb 11, 2020

Build Status


Python API client library for NetBox.


To install run pip install pynetbox.

Alternatively, you can clone the repo and run python install.

Quick Start

The full pynetbox API is documented on Read the Docs, but the following should be enough to get started using it.

To begin, import pynetbox and instantiate the API.

import pynetbox
nb = pynetbox.api(

The first argument the .api() method takes is the NetBox URL. There are a handful of named arguments you can provide, but in most cases none are required to simply pull data. In order to write, the token argument should to be provided. To decrypt information from the secrets endpoint either the private_key_file or private_key argument needs to be provided.


The pynetbox API is setup so that NetBox's apps are attributes of the .api() object, and in turn those apps have attribute representing each endpoint. Each endpoint has a handful of verbs available to carry out actions on the endpoint. For example, in order to query all the objects in the devices endpoint you would do the following:

[test1-leaf1, test1-leaf2]
You can’t perform that action at this time.