Skip to content

nb.version causes 403 with a valid token #718

@markkuleinio

Description

@markkuleinio

pynetbox version

v7.5.0

NetBox version

v4.4.7

Python version

3.11

Steps to Reproduce

On NetBox server:

sudo tail -f /var/log/nginx/access.log | grep /api/

Then:

import pynetbox

nb = pynetbox.api(NETBOX_URL, NETBOX_TOKEN)
nb.version

Expected Behavior

Request handled with status 200, and no errors in Django logs.

Observed Behavior

Request handled with status 403:

xxx.xxx.xxx.xxx - - [03/Dec/2025:15:39:34 +0200] "GET /api/ HTTP/1.1" 403 58 "-" "python-requests/2.32.5"

There is also error in Django logs (when logging has been enabled):

2025-12-03 15:39:34,257 django.request WARNING: Forbidden: /api/

The reason seems to be that Request.get_version() does not set the token in the request header:

headers = {
"Content-Type": "application/json",
}

Metadata

Metadata

Assignees

Labels

app: pynetboxseverity: lowDoes not significantly disrupt application functionality, or a workaround is availablestatus: acceptedThis issue has been accepted for implementationtype: bugA confirmed report of unexpected behavior in the application

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions