Skip to main content



pynautobot

Python API client library for Nautobot.

pynautobot was initially developed as a fork of pynetbox. pynetbox was originally developed by Zach Moody at DigitalOcean and the NetBox Community.

The complete documentation for pynautobot can be found on our docs page.

Questions? Comments? Join us in the #nautobot Slack channel on Network to Code!

Installation

You can install via pip or poetry

Using pip

$ pip install pynautobot
...

Using poetry

$ git clone https://github.com/nautobot/pynautobot.git
...
$ pip install poetry
...
$ poetry shell
Virtual environment already activated: /home/user/pynautobot/.venv
$ poetry install
...

Quick Start

A short introduction is provided here; the full documentation for pynautobot is on our docs page.

To begin, import pynautobot and instantiate an Api object, passing the url and token.

import pynautobot

nautobot = pynautobot.api(
    url="http://localhost:8000",
    token="d6f4e314a5b5fefd164995169f28ae32d987704f",
)

The Api object provides access to the Apps in Nautobot. The Apps provide access to the Models and the field data stored in Nautobot. Pynautobot uses the Endpoint class to represent Models. For example, here is how to access Devices stored in Nautobot:

devices = nautobot.dcim.devices
devices
<pynautobot.core.endpoint.Endpoint object at 0x7fe801e62fa0>

Jobs

Pynautobot provides a specialized Endpoint class to represent the Jobs model. This class is called JobsEndpoint. This extends the Endpoint class by adding the run method so pynautobot can be used to call/execute a job run.

  1. Run from an instance of a job.
>>> gc_backup_job = nautobot.extras.jobs.get(name="Backup Configurations")
>>> job_result = gc_backup_job.run()
>>> job_result.job_result.id
'1838f8bd-440f-434e-9f29-82b46549a31d' # <-- Job Result ID.
  1. Run with Job Inputs
job = nautobot.extras.jobs.get(name="Verify Hostnames")
job.run(data={"hostname_regex": ".*"})
  1. Run by providing the job id
>>> my_job_id = nautobot.extras.jobs.get(name="Backup Configurations").id
>>> gc_backup_job = nautobot.extras.jobs.run(job_id=my_job_id)
>>> gc_backup_job.job_result.id
'548832dc-e586-4c65-a7c1-a4e799398a3b' # <-- Job Result ID.
  1. Run by providing the job name
>>> gc_backup_job = nautobot.extras.jobs.run(job_name="Backup Configurations")
>>> gc_backup_job.job_result.id
'29e82353-c0ef-4187-9211-92fb40a74923' # <-- Job Result ID.

Queries

Pynautobot provides several ways to retrieve objects from Nautobot. Only the get() method is shown here. To continue from the example above, the Endpoint object returned will be used to get the device named hq-access-01.

switch = devices.get(name="hq-access-01")

The object returned from the get() method is an implementation of the Record class. This object provides access to the field data from Nautobot.

switch.id
"6929b68d-8f87-4470-8377-e7fdc933a2bb"
switch.name
"hq-access-01"
switch.site
hq

Threading

Pynautobot supports multithreaded calls for .filter() and .all() queries. It is highly recommended you have MAX_PAGE_SIZE in your Nautobot install set to anything except 0 or None. The default value of 1000 is usually a good value to use. To enable threading, add threading=True parameter when instantiating the Api object:

nautobot = pynautobot.api(
    url="http://localhost:8000",
    token="d6f4e314a5b5fefd164995169f28ae32d987704f",
    threading=True,
)

Versioning

Used for Nautobot Rest API versioning. Versioning can be controlled globally by setting api_version on initialization of the API class and/or for a specific request e.g (all(), filter(), get(), create() etc.) by setting an optional api_version parameter.

Global versioning

import pynautobot

nautobot = pynautobot.api(
    url="http://localhost:8000", token="d6f4e314a5b5fefd164995169f28ae32d987704f", api_version="2.1"
)

Request specific versioning

import pynautobot

nautobot = pynautobot.api(
    url="http://localhost:8000",
    token="d6f4e314a5b5fefd164995169f28ae32d987704f",
)
tags = nautobot.extras.tags
tags.create(name="Tag", api_version="2.0", content_types=["dcim.device"])
tags.get(
    api_version="2.1",
)

Retry logic

By default, the client will not retry any operation. This behavior can be adjusted via the retries optional parameters. This will only affect HTTP codes: 429, 500, 502, 503, and 504.

Retries

import pynautobot

nautobot = pynautobot.api(url="http://localhost:8000", token="d6f4e314a5b5fefd164995169f28ae32d987704f", retries=3)

Please see our wiki for a list of relevant community projects.

Release files for pynautobot 3.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pynautobot 3.2.0
File Size Uploaded
pynautobot-3.2.0.tar.gz 33.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pynautobot 3.2.0
File Interpreter ABI Platform
pynautobot-3.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 76.5 kB

Release files / pynautobot-3.2.0.tar.gz

Download URL pynautobot-3.2.0.tar.gz
Size 33.9 kB
Tags Source
SHA-256 checksum
How to use checksums
96be682771bfd69bc6e071e180742ad412c0c961a8b7f92c01f2ecd39c662a6a
BLAKE2b-256 checksum
How to use checksums
6cbcdd5dacdc14ab9030403c41cd2ecd75f55d3a82006142d228e8d55da4951a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 21, 2026.

Transparency log

Release files / pynautobot-3.2.0-py3-none-any.whl

Download URL pynautobot-3.2.0-py3-none-any.whl
Size 42.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8b3d5e896a957b045a735680b7455f6fc9f1d37ee0a69c485f05d89b0dd2a50e
BLAKE2b-256 checksum
How to use checksums
7afcf46fe6c7fb604b158f25c99cb12e16e0bb94ffa8a56a6c83b9c4cef22c96
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 21, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

3.2.0 This release

2 release files

3.1.1

2 release files

3.1.0

2 release files

3.0.0

2 release files

2.7.2

2 release files

2.7.1

2 release files

2.7.0

2 release files

2.6.6

2 release files

2.6.5

2 release files

2.6.4

2 release files

2.6.3

2 release files

2.6.2

2 release files

2.6.1

2 release files

2.6.0

2 release files

2.5.0

2 release files

2.4.2

2 release files

2.4.1

2 release files

2.4.0

2 release files

2.3.0

2 release files

2.2.1

2 release files

2.2.0

2 release files

2.1.1

2 release files

2.1.0

2 release files

2.0.2

2 release files

2.0.1

2 release files

2.0.0

2 release files

1.5.5

2 release files

1.5.4

2 release files

1.5.3

2 release files

1.5.2

2 release files

1.5.1

2 release files

1.5.0

2 release files

1.4.0

2 release files

1.3.0

2 release files

1.2.2

2 release files

1.2.1

2 release files

1.2.0

2 release files

1.1.2

2 release files

1.1.1

2 release files

1.1.0

2 release files

1.0.4

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page