Use this when calling the NetBox REST API.
REST API
The NetBox REST API at /api/ exposes every object for create, read, update and delete with token authentication, filtering and pagination; pynetbox wraps it for Python.
1. NetBox REST API with token auth, filtering, pagination; GraphQL for reads.
2. pynetbox SDK.
3. Least-privilege tokens (write-enabled only when needed).
4. Handle pagination.
5. Bulk operations.
client → token → REST/GraphQL → objects
Context & applicabilityCommon mistakes · platform/version boundaries
Operational reference
Fast context before you go deeper.
GET <resource-uri>Primary Commands
Configuration and operational commands for this Topic.
Verification & Troubleshooting
Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.
Use the operational verification above to establish the expected state.
Capture the concrete output, symptom, packet, log or counter before changing anything.
Step 1 Common mistakes Narrow the fault
- Ignoring pagination limits.
- Tokens with write rights for read-only scripts.
- REST API at /api/ with token authentication.
- Supports filtering and pagination.
- pynetbox wraps it for Python.
curl -s -H 'Authorization: Token <t>' 'https://<netbox>/api/dcim/devices/?limit=100&offset=0'— paginated RESTpython3 -c "import pynetbox;nb=pynetbox.api('https://<netbox>',token='<t>');print(nb.status())"— pynetbox- GraphQL endpoint (/graphql/) — flexible queries
ReferenceWhy it matters1 section · depth on demand
What it is
The NetBox REST API (/api/) supports filtering, pagination and bulk operations; pynetbox wraps it in Python.
ReferenceImportant terms & boundaries2 sections · depth on demand
How it works
The API mirrors the UI models under /api/<app>/<model>/, supports filtering by most fields (?site=oslo&role=core), pagination (limit/offset, next link) and bulk create/update/delete with lists. Tokens can be read-only or write-enabled.
Example
import pynetbox
nb = pynetbox.api("https://netbox.example.com", token=token)
for d in nb.dcim.devices.filter(site="oslo", role="access-switch"):
print(d.name, d.primary_ip)
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Verification history & basis
When and against what this Topic was checked. Later text edits do not count as a new check.
Authoritative/upstream documentation reviewed for bounded claims in NetBox > REST API. Documentation verification only; this is not observed lab or production Evidence.
Basis: https://netbox.readthedocs.io/en/stable/ · confidence 94%