Share this post on:


The beauty of netbox is that we can pull any data we want from its API. The data is JSON formatted, and then we can use it for further automation.


First, we need to create a token that will be used for API request. In the top right corner, select the user and then click on tokens. From there create a new token, default empty values are OK for first basic API request. Once created, copy and save token.

API request

Open up a linux shell or any other utlity for API requests (Postman etc.):

curl -H "Authorization: Token 6588713b7a7bbd3a24c9e44529e9f0e491e75932" \
-H "Accept: application/json; indent=4" \

It should authenticate correctly, and it should return our site’s data in beautiful JSON format.

"count": 1,
"next": null,
"previous": null,
"results": [
"id": 1,
"url": "",
"display": "kuligowski",
"name": "kuligowski",
"slug": "kuligowski",
"status": {
"value": "active",
"label": "Active"
"region": null,
"group": null,
"tenant": null,
"facility": "",
"asn": 65001,
"time_zone": "Europe/London",
"description": "",
"physical_address": "",
"shipping_address": "",
"latitude": null,
"longitude": null,
"contact_name": "",
"contact_phone": "",
"contact_email": "",
"comments": "",
"tags": [],
"custom_fields": {},
"created": "2021-08-09",
"last_updated": "2021-08-09T19:15:31.536522Z",
"circuit_count": 0,
"device_count": 1,
"prefix_count": 0,
"rack_count": 0,
"virtualmachine_count": 0,
"vlan_count": 1

Leave a Comment

Your email address will not be published. Required fields are marked *