Custom Fields

Define custom metadata for devices and networks

Rackd supports user-defined custom fields for devices, allowing you to track additional metadata specific to your organization.

Overview

Custom fields provide flexibility to extend device records with organization-specific data:

  • Asset tracking numbers
  • Warranty information
  • Department/owner assignments
  • Physical location details
  • Compliance attributes
  • Any custom metadata you need

Custom Field Types

TypeDescriptionExample
textFree-form text inputSerial numbers, notes
numberNumeric valuesRack units, power draw
booleanTrue/false checkboxUnder maintenance
selectDropdown with predefined optionsEnvironment, tier

Custom Field Definition

FieldTypeDescription
idstringUnique identifier
namestringField name (display label)
keystringUnique key for API access
typestringField type (text/number/boolean/select)
requiredboolWhether field is mandatory
descriptionstringHelp text for users
options[]stringOptions for select type
default_valuestringDefault value for new devices
sort_orderintDisplay order
created_attimestampCreation timestamp
updated_attimestampLast update timestamp

API Endpoints

List Custom Field Definitions

GET /api/custom-fields

Response:

[
  {
    "id": "cf-abc123",
    "name": "Asset Tag",
    "key": "asset_tag",
    "type": "text",
    "required": false,
    "description": "Organization asset tracking number"
  },
  {
    "id": "cf-def456",
    "name": "Environment",
    "key": "environment",
    "type": "select",
    "required": true,
    "options": ["production", "staging", "development", "testing"]
  }
]

Get Custom Field Definition

GET /api/custom-fields/{id}

Get Available Field Types

GET /api/custom-fields/types

Response:

["text", "number", "boolean", "select"]

Create Custom Field Definition

POST /api/custom-fields

Request body:

{
  "name": "Warranty Expiry",
  "key": "warranty_expiry",
  "type": "text",
  "required": false,
  "description": "Warranty expiration date"
}

For select fields:

{
  "name": "Environment",
  "key": "environment",
  "type": "select",
  "required": true,
  "options": ["production", "staging", "development"]
}

Update Custom Field Definition

PUT /api/custom-fields/{id}

Note: Field type cannot be changed after creation.

Delete Custom Field Definition

DELETE /api/custom-fields/{id}

Warning: This will remove all values for this field from all devices.

Using Custom Fields on Devices

Create Device with Custom Fields

POST /api/devices
{
  "hostname": "server01.example.com",
  "ip_address": "192.168.1.10",
  "custom_fields": [
    {"key": "asset_tag", "value": "AST-12345"},
    {"key": "environment", "value": "production"}
  ]
}

Update Device Custom Fields

PUT /api/devices/{id}
{
  "custom_fields": [
    {"key": "asset_tag", "value": "AST-12345-UPDATED"},
    {"key": "warranty_expiry", "value": "2025-12-31"}
  ]
}

CLI Commands

List Custom Field Definitions

rackd customfield list

Get Custom Field Definition

rackd customfield get --id cf-abc123

List Available Types

rackd customfield types

Create Custom Field Definition

# Text field
rackd customfield create \
  --name "Asset Tag" \
  --key "asset_tag" \
  --type text \
  --description "Organization asset tracking number"

# Select field
rackd customfield create \
  --name "Environment" \
  --key "environment" \
  --type select \
  --required \
  --options "production,staging,development,testing"

Update Custom Field Definition

rackd customfield update \
  --id cf-abc123 \
  --name "Asset ID" \
  --required

Delete Custom Field Definition

rackd customfield delete --id cf-abc123

Web UI

Custom Fields Management Page

Access at /custom-fields in the web interface.

Features:

  • List all custom field definitions
  • Create new fields with type selection
  • Edit field properties
  • Reorder fields via drag-and-drop
  • Delete unused fields

Device Form Integration

Custom fields appear in device forms:

  • Create/Edit Modal: Custom Fields tab with all defined fields
  • Device Detail: Custom fields section showing values
  • Validation: Required fields enforced on form submission

RBAC Permissions

PermissionDescription
custom-fields:listView list of custom field definitions
custom-fields:readView field definition details
custom-fields:createCreate new field definitions
custom-fields:updateModify field definitions
custom-fields:deleteDelete field definitions

Note: Device-level custom field values respect device permissions.

Common Use Cases

Asset Management

{
  "name": "Asset Tag",
  "key": "asset_tag",
  "type": "text",
  "required": true
}
{
  "name": "Purchase Date",
  "key": "purchase_date",
  "type": "text",
  "description": "Date device was purchased (YYYY-MM-DD)"
}
{
  "name": "Warranty Expiry",
  "key": "warranty_expiry",
  "type": "text"
}

Physical Location

{
  "name": "Rack Position",
  "key": "rack_position",
  "type": "text",
  "description": "Rack and U position (e.g., R10-U15)"
}
{
  "name": "Data Center",
  "key": "dc_location",
  "type": "select",
  "options": ["DC1 - Primary", "DC2 - Secondary", "DC3 - DR"]
}

Operational Status

{
  "name": "Under Maintenance",
  "key": "maintenance",
  "type": "boolean"
}
{
  "name": "Environment",
  "key": "environment",
  "type": "select",
  "required": true,
  "options": ["production", "staging", "development", "testing", "sandbox"]
}

Compliance

{
  "name": "PCI Scope",
  "key": "pci_scope",
  "type": "boolean",
  "description": "Is this device in PCI DSS scope?"
}
{
  "name": "Compliance Review Date",
  "key": "compliance_review",
  "type": "text"
}

Best Practices

  1. Key Naming: Use snake_case for keys (e.g., asset_tag, warranty_expiry)
  2. Required Fields: Only mark fields as required if truly mandatory
  3. Select Options: Keep option lists manageable (< 20 items)
  4. Descriptions: Add help text for fields that may be ambiguous
  5. Naming Convention: Use clear, consistent field names
  6. Avoid Duplicates: Check existing fields before creating new ones
  7. Type Selection: Choose appropriate types (use number for numeric data, not text)