Standardize Device Classification in NetBox with Custom Fields and Tags
Lock device classification in NetBox with custom fields for single-value attributes and tag groups for multi-value labels. A task guide covering prerequisites, creation steps, verification checks and safe enforcement with recovery options.
06 Aug 2026, 07:51 UTC

Problem: inconsistent device metadata blocks automation
Teams add owner, environment and compliance data to device names or free text notes. Filtering breaks, API consumers guess fields, and bulk imports create drift. The useful takeaway is to lock classification into structured custom fields for single-value attributes and tags for multi-value labels, both exposed in the UI and REST API.
Desired outcome
A self-hosted NetBox instance where every Device, Site and Prefix carries a consistent set of classification attributes that are enforced on create and update, queryable in the UI and via the API, and safe to use in automation gating.
Prerequisites
- Admin access to NetBox. Custom fields and tag groups are managed under System Administration.
- Decided taxonomy before creating fields. Example scope: Device model for asset tag, owner team and compliance tier; Prefix model for business unit.
- NetBox version where Custom Fields are built-in. UI paths and field names are version sensitive across major releases.
Design the taxonomy
Separate single-value attributes from multi-value labels.
Custom fields for Device:
- cf_asset_tag, type text, required false, description Asset identifier from procurement
- cf_owner_team, type choice, choices engineering, platform, network, required false
- cf_compliance_tier, type choice, choices tier1, tier2, tier3, required false
Tag groups for controlled vocabulary:
- Tag Group Environment with tags prod, staging, lab
- Tag Group Role with tags router, switch, server
Tags are not unique constraints. Define naming conventions now to avoid sprawl.
Create tag groups and tags
In NetBox UI navigate to Admin > Tag Groups. Create group Environment. Create tags prod, staging, lab under that group. Repeat for Role.
Tags can be applied to devices, interfaces and prefixes and are returned in API representations.
Create custom fields
Admin > Custom Fields > Add. Set Model to dcim.device for device attributes. Set Name to cf_asset_tag, Label to Asset Tag, Type to text. Set Required to false initially. Repeat for cf_owner_team and cf_compliance_tier with type choice and the defined choices.
Custom fields support text, integer, boolean, date, URL and choice, and can have default values.
Apply classification to a test object
Create a test Device via UI or API. Use a non-production name and site.
Example API payload shape for a PATCH to /api/dcim/devices//:
curl -X PATCH https://<netbox-host>/api/dcim/devices/<device-id>/ \
-H "Authorization: Token <token>" \
-H "Content-Type: application/json" \
-d '{"custom_fields": {"cf_asset_tag": "AST-1001", "cf_owner_team": "network", "cf_compliance_tier": "tier1"}, "tags": [{"name": "prod"}, {"name": "router"}]}'Run from a workstation with network access to NetBox and a token with device write permission. Do not run against production objects during design.
Expected checks
- UI form check. Open the test Device in the UI. Custom fields appear in the Custom Fields section and tags appear in the Tags field.
- API representation check. GET /api/dcim/devices/<device-id>/ and confirm custom_fields contains the three keys with expected values and tags list contains prod and router.
- Filter check. In the Devices list filter by Tag is prod and Custom Field cf_owner_team is network. The test device is returned and no unrelated devices appear.
- Validation check. Attempt an API update that omits a required field after enforcement is enabled. Validation should reject the write. Apply a corrective update with the field present to confirm recovery path works.
Enforcement and recovery
Making a custom field required after data exists can block edits or API writes for objects missing the value. Backfill before enforcement.
Backfill options:
- Bulk edit in UI for a small set
- API script that reads devices with null custom_fields and writes a default or derived value
If enforcement blocks a workflow, remove Required flag on the custom field, backfill, then re-enable Required.
Automation that depends on custom fields or tags should handle missing values gracefully to avoid failures during bulk imports or migrations.
Limitations
Custom field behavior and UI locations are version sensitive. Field names in the API are prefixed by cf_ by convention but depend on your naming.
Tags are free text within a group. Inconsistent capitalization creates duplicate filters. Use tag groups and a naming convention.
Webhooks and built-in automation scripts can react to object create update and delete events, enabling downstream validation or provisioning when classification fields change. Design those handlers to tolerate missing values.
0 replies
A thoughtful contribution can make all the difference. Be the first to share one.