Extending NetBox Without Code: Custom Fields, Links, and Export Templates
NetBox's built-in Custom Fields, Custom Links, and Export Templates let you attach ticket URLs, add one-click navigation, and generate audit CSVs — all without writing plugins or forking code. A practical walkthrough with trade-offs.
06 Nov 2025, 18:03 UTC

The Problem: External References and Audit Reports
Your team uses NetBox as the source of truth for network infrastructure. But every device also lives in a ticketing system (Jira, ServiceNow, GitHub Issues), and auditors want a CSV mapping each device to its ticket URL. You could write a plugin, fork the codebase, or maintain a separate spreadsheet — each adds operational overhead.
NetBox v3.0+ includes three built-in features that solve this without deploying Python code: Custom Fields (arbitrary key-value data on any core model), Custom Links (dynamic UI buttons using Jinja2 templates), and Export Templates (Jinja2-rendered text output from querysets). All are managed in the UI under Admin → Customization and survive upgrades because they're stored in the database.
Custom Fields: Attach Structured Data to Any Object
Custom Fields let you add typed attributes — text, integer, boolean, date, URL, JSON, and more — to models like Device, Prefix, IPAddress, or VirtualMachine. Since v3.0 they support validation regex, default values, and required flags. The data is queryable via the REST API (?cf_<field_name>=value) and filterable in the UI.
For the ticket-tracking use case, create a Custom Field on the Device model:
- Name:
ticket_url - Type: URL
- Label: Ticket URL
- Required: False (or True if every device must have a ticket)
- Validation regex:
^https?://.*(optional, enforces valid URLs)
After saving, the field appears on every Device detail page and in the device creation/edit form. You can also bulk-edit it via the UI or API.
Custom Links: One-Click Navigation to External Systems
Custom Links render buttons or dropdown menu items on object detail pages. They use Jinja2 templating with access to the object's attributes, including custom field data via custom_field_data. This lets you build deep links to monitoring, ticketing, or config-management tools.
Create a Custom Link on the Device model:
- Name: Open Ticket
- Target URL:
{{ obj.custom_field_data.ticket_url }} - Link text: 🎫 View Ticket
- Group: External Systems (optional, creates a dropdown if multiple links share the group)
- Button class: btn-primary (or btn-outline for secondary style)
When a device has a ticket_url{% if obj.custom_field_data.ticket_url %}...{% endif %}.
Export Templates: Generate Audit-Ready Output
Export Templates use Jinja2 to transform a queryset into any text format — CSV, YAML, JSON, config snippets. They're accessible via the UI "Export" button on list views or the REST API with ?export=<template_name>. Since v3.0, templates can traverse ORM relationships (e.g., obj.site.name, obj.device_role.slug).
Create an Export Template on the Device model for a device-to-ticket audit CSV:
- Name: Device Ticket Audit
- Template code:
{% load netbox_filters %}
Name,Site,Role,Ticket URL
{% for obj in queryset %}
{{ obj.name }},{{ obj.site.name }},{{ obj.device_role.name }},{{ obj.custom_field_data.ticket_url|default:"" }}
{% endfor %}
- File extension: csv
- Mime type: text/csv
In the UI, filter devices (e.g., by site or role), click Export → Device Ticket Audit, and download the CSV. Via API: GET /api/dcim/devices/?export=device-ticket-audit (spaces in template name become hyphens).
Worked Example: End-to-End Setup
Assuming a NetBox v3.5+ instance (Docker Compose from the official repo works for testing):
- Navigate to Admin → Customization → Custom Fields → Add. Create
ticket_urlon Device as described. - Admin → Customization → Custom Links → Add. Create "Open Ticket" linking to
{{ obj.custom_field_data.ticket_url }}. - Admin → Customization → Export Templates → Add. Create "Device Ticket Audit" with the CSV template above.
- Edit a Device, paste a Jira URL into the Ticket URL field, save.
- On the Device detail page, verify the "🎫 View Ticket" button appears and opens the correct URL.
- Go to Devices list, filter as needed, click Export → Device Ticket Audit. Open the CSV and confirm columns: Name, Site, Role, Ticket URL.
- Test API filtering:
curl -H "Authorization: Token $TOKEN" "https://netbox.example.com/api/dcim/devices/?cf_ticket_url=https://jira.example.com/browse/NET-123"— response should includecustom_field_data.ticket_url.
Trade-offs and Limitations
- Database impact: Each Custom Field adds a column (or JSONB key) to the model's table. On high-cardinality models like IPAddress (millions of rows), excessive fields increase migration time and query latency. Limit fields on such models; consider a separate mapping table via plugin if you need dozens.
- Template security: Jinja2 in Custom Links and Export Templates runs with the NetBox process permissions. Avoid rendering sensitive fields (secrets, API keys) and never pass untrusted input directly into templates. NetBox sandboxes the environment, but treat templates as trusted code.
- API pagination: Export Templates via REST API respect the same pagination limits as list views (default 50, max 1000 via
?limit=). Large exports require multiple requests or a background script that iterates pages. - Webhook exclusion: Custom Field data is not included in webhook payloads unless you enable "Include custom field data" on the Webhook definition. Plan accordingly if downstream systems rely on webhooks.
- UI changes in v4.0: The customization menus were reorganized; some community screenshots and older docs show the pre-v4.0 layout. Refer to the official docs for current navigation.
Verification Checklist
Before rolling out to production:
- Deploy a local NetBox instance (Docker Compose) and reproduce the three-object setup above.
- Confirm REST API filtering works:
?cf_ticket_url=...returns expected devices withcustom_field_datapopulated. - Trigger the Export Template via API and inspect the raw output format.
- Review NetBox release notes v3.0 through v4.2 for any breaking changes to customization APIs.
- Load-test with your actual device count — monitor query times on Device and IPAddress list views after adding fields.
Start Small, Measure, Then Expand
NetBox's low-customization features cover a surprising range of integration needs without plugin maintenance. Begin with one Custom Field and one Export Template for your highest-value audit. Verify the API behavior, watch database performance, and only then add Custom Links for daily workflow convenience. The features are stable, upgrade-safe, and entirely UI-managed — but they're not free at scale. Treat them like schema changes: plan, test, and monitor.
0 replies
A thoughtful contribution can make all the difference. Be the first to share one.