Skip to main content
CommunityCloudEnterprise

Endpoint

Endpoint objects provide CRUD operations for NetBox API endpoints. They are created automatically when you access an attribute on an App instance.

Overview

import pynetbox

nb = pynetbox.api('http://netbox.example.com', token='your-token')

# Accessing an attribute on an App returns an Endpoint
devices = nb.dcim.devices # Endpoint

# Endpoint methods perform CRUD operations
all_devices = devices.all()
device = devices.get(1)
filtered = devices.filter(site='headquarters')
new_device = devices.create(name='test', site=1, device_type=1, role=1)

Slugs with underscores

Attribute access converts underscores to dashes (nb.dcim.ip_addresses → the ip-addresses endpoint), since Python attribute names can't contain dashes. For the rare endpoint whose URL slug legitimately contains an underscore (e.g. some custom-objects plugin types), use App.endpoint() to pass the slug verbatim:

# Attribute access — underscores become dashes:
nb.plugins.custom_objects.my_object # → .../custom-objects/my-object/

# endpoint() — slug used as-is:
nb.plugins.custom_objects.endpoint("my_object").all() # → .../custom-objects/my_object/

Endpoint Class

::: pynetbox.core.endpoint.Endpoint handler: python

  • choices
  • count
  • create
  • delete
  • filter
  • get
  • update show_source: true show_root_heading: true heading_level: 3

DetailEndpoint Class

DetailEndpoint represents a detail route on an existing record (e.g. /api/ipam/prefixes/{id}/available-ips/). It is returned by model-specific properties such as Prefixes.available_ips, not constructed directly.

::: pynetbox.core.endpoint.DetailEndpoint handler: python

  • list show_source: true show_root_heading: true heading_level: 3

ROMultiFormatDetailEndpoint Class

A read-only detail endpoint that supports multiple response formats. Used for endpoints (such as rack elevation) that can return either structured JSON or raw content like SVG.

::: pynetbox.core.endpoint.ROMultiFormatDetailEndpoint handler: python show_source: true show_root_heading: true heading_level: 3