# neodesk device-fields

Quelle: https://docs.neode.sk/de/command-line/reference/device-fields/
Zuletzt geändert: 2026-12-03

> 14 Befehle. Felder, die Admins für Geräte festlegen (Kunde, Vertrag, Garantiedatum), und ihre Werte.

Felder, die Admins für Geräte festlegen (Kunde, Vertrag, Garantiedatum), und ihre Werte.

Die Befehle stehen hier auf Englisch, so wie die Kommandozeile sie mit `neodesk device-fields --help` zeigt. Die Flags, die jeder Befehl kennt, stehen in der [Befehlsreferenz](https://docs.neode.sk/de/command-line/reference.md#flags-for-every-command).

## neodesk device-fields add

Add a device field for the whole server or one organization.

The server and each organization have at most 50 fields. Fields of the whole server need a server-level role; an organization's owners and admins add fields of their organization.

```text quoted
neodesk device-fields add --key KEY --type text|longtext|number|date|yesno|link|choice --label LABEL [flags]
```

| Flag | What it is |
|---|---|
| `--key KEY` | for the command line, the API and CSV: lowercase letters, digits and underscores, at most 40; it can't change later (required) |
| `--type text\|longtext\|number\|date\|yesno\|link\|choice` | the type of its values (required) |
| `--org-id ORG_ID` | the organization whose devices have it (left out: the whole server) |
| `--label LABEL` | the name people see, at most 80 characters (required) |
| `--help-text HELP_TEXT` | a help text under the field, at most 300 characters |
| `--default DEFAULT` | the value a device has until one is set (empty: none) |
| `--required` | a device's value can't be cleared |
| `--restricted` | only accounts with "See restricted device fields" see it and its values |
| `--personal` | the values are personal data: an account's personal data export has the values it entered |
| `--multiple` | a choice field holds several values of its list |
| `--choices JSON` | the list of a choice field, in order: [{"label":"Gold"},{"id":2,"label":"Silver"}]; an id keeps (and renames) a value that exists |

Needs device.fields_edit; changes something: needs a token with read and write access. Calls `POST /api/device-fields`.

```bash quoted
neodesk device-fields add --key customer --label Customer --type text
neodesk device-fields add --key tier --label Tier --type choice --choices '[{"label":"Gold"},{"label":"Silver"}]'
neodesk device-fields add --key warranty --label "Warranty until" --type date --org-id acme
```

## neodesk device-fields bulk

Set or clear one field on many devices.

Devices outside the field's organization are skipped and listed.

```text quoted
neodesk device-fields bulk --devices A,B --key KEY [flags]
```

| Flag | What it is |
|---|---|
| `--devices A,B` | the device IDs, separated by commas or repeated (required) |
| `--key KEY` | the field's key (required) |
| `--value VALUE` | the value (a choice field with several values: separated by ;) |
| `--clear` | clear the value instead |

Needs device.fields_edit; changes something: needs a token with read and write access. Calls `POST /api/device-fields/bulk`.

```bash quoted
neodesk device-fields bulk --devices 111,222,333 --key customer --value Acme
```

## neodesk device-fields change

Change a device field: label, type, help, default, required, restricted, the choice list.

A new type, one value instead of several, or a value taken off a choice list must fit every stored value; otherwise nothing changes and the answer counts the values that don't fit. A renamed choice is renamed on every device.

```text quoted
neodesk device-fields change <id> [flags]
```

| Argument | What it is |
|---|---|
| `<id>` | The field ID (device-fields list shows it) |

| Flag | What it is |
|---|---|
| `--type text\|longtext\|number\|date\|yesno\|link\|choice` | a new type; every stored value must fit it |
| `--label LABEL` | the name people see, at most 80 characters |
| `--help-text HELP_TEXT` | a help text under the field, at most 300 characters |
| `--default DEFAULT` | the value a device has until one is set (empty: none) |
| `--required` | a device's value can't be cleared |
| `--restricted` | only accounts with "See restricted device fields" see it and its values |
| `--personal` | the values are personal data: an account's personal data export has the values it entered |
| `--multiple` | a choice field holds several values of its list |
| `--choices JSON` | the list of a choice field, in order: [{"label":"Gold"},{"id":2,"label":"Silver"}]; an id keeps (and renames) a value that exists |

Needs device.fields_edit; changes something: needs a token with read and write access. Calls `PATCH /api/device-fields/{id}`.

## neodesk device-fields delete

Delete a device field and every device's value of it.

```text quoted
neodesk device-fields delete <id> [flags]
```

| Argument | What it is |
|---|---|
| `<id>` | The field ID (device-fields list shows it) |

| Flag | What it is |
|---|---|
| `--confirm true` | true: delete it although devices have a value (without it the answer counts them) |

Needs device.fields_edit; changes something: needs a token with read and write access; deletes or ends something for good, so it asks first unless --yes is given. Calls `DELETE /api/device-fields/{id}`.

```bash quoted
neodesk device-fields delete 4 --confirm true --yes
```

## neodesk device-fields export

Export device field values as CSV: id, then one column per field key (use --output).

The file has the values set on each device, not defaults, and only fields you see. A text a spreadsheet would read as a formula gets a single quote in front; the import takes it off again.

```text quoted
neodesk device-fields export [flags]
```

| Flag | What it is |
|---|---|
| `--filter FILTER` | keep the devices that match key:operator:value (eq, contains, min, max, or key:empty and key:notempty); repeat to combine |
| `--keys KEYS` | the fields to export, keys separated by commas (left out: every field you see) |
| `--sep comma\|semicolon` | the separator (left out: comma) |

Needs device.view; only reads. Calls `GET /api/device-fields/export`.

```bash quoted
neodesk device-fields export --output fields.csv
neodesk device-fields export --keys customer,warranty --filter customer:eq:Acme --sep semicolon --output acme.csv
```

## neodesk device-fields from-tags

Turn tags name:value into device fields and set each device's value from its tag.

Creates a text field of the whole server per name. A name with a device that has two values, a key that is taken, or more fields than the server may have changes nothing. The tags stay as they are. Needs a server-level role.

```text quoted
neodesk device-fields from-tags --fields JSON [flags]
```

| Flag | What it is |
|---|---|
| `--fields JSON` | the tag names to convert: [{"name":"customer"},{"name":"room","key":"room_number","label":"Room number"}]; key and label left out take the proposed ones (required) |

Needs device.fields_edit; changes something: needs a token with read and write access. Calls `POST /api/device-fields/tag-conversion`.

```bash quoted
neodesk device-fields from-tags --fields '[{"name":"customer"}]'
```

## neodesk device-fields get

Show a device's fields and values.

```text quoted
neodesk device-fields get <device> [flags]
```

| Argument | What it is |
|---|---|
| `<device>` | The device ID |

Needs device.view; only reads. Calls `GET /api/devices/{device}/fields`.

## neodesk device-fields import

Import device field values from a CSV file (id, then one column per field key); try it with --dry-run first.

An empty cell leaves the value as it is, a cell with just - clears it. A choice field's several values are separated by ;. The file takes a comma, a semicolon or a tab between cells, at most 2 MB and 10,000 devices. A column that is no key of a field you see refuses the import.

```text quoted
neodesk device-fields import --file PATH [flags]
```

| Flag | What it is |
|---|---|
| `--dry-run` | change nothing; list per line what would change, what doesn't fit and unknown devices |
| `--skip-bad-rows` | import the lines without problems and leave the others out (without it, any problem refuses the import) |
| `--plan-id PLAN_ID` | the plan_id of the dry run: refuse when the import would now do something else |
| `--file PATH` | the file to upload |

Needs device.fields_edit; changes something: needs a token with read and write access. Calls `POST /api/device-fields/import`.

```bash quoted
neodesk device-fields import --file fields.csv --dry-run
neodesk device-fields import --file fields.csv --skip-bad-rows
```

## neodesk device-fields list

List the device fields you see: the server's, then each organization's.

Restricted fields show only with "See restricted device fields", and an organization's fields only to its members and the server-level roles.

```text quoted
neodesk device-fields list [flags]
```

Needs device.view; only reads. Calls `GET /api/device-fields`.

## neodesk device-fields order

Put the server's or an organization's device fields in a new order.

```text quoted
neodesk device-fields order --ids JSON [flags]
```

| Flag | What it is |
|---|---|
| `--ids JSON` | every field ID of the scope once, in the new order: [3,1,2] (required) |
| `--org-id ORG_ID` | the organization (left out: the server's fields) |

Needs device.fields_edit; changes something: needs a token with read and write access. Calls `PUT /api/device-fields/order`.

## neodesk device-fields set

Set or clear a device's field values.

Every value is checked first; one that doesn't fit its field changes nothing. Each change goes into the audit log with the old and the new value (a restricted field's only that it changed).

```text quoted
neodesk device-fields set <device> --values JSON [flags]
```

| Argument | What it is |
|---|---|
| `<device>` | The device ID |

| Flag | What it is |
|---|---|
| `--values JSON` | {"key": value}; null or "" clears a value (required) |

Needs device.fields_edit; changes something: needs a token with read and write access. Calls `PUT /api/devices/{device}/fields`.

```bash quoted
neodesk device-fields set 123456789 --values '{"customer":"Acme","warranty":"2027-03-31"}'
```

## neodesk device-fields show

Show one device field, with how many devices have a value of it.

```text quoted
neodesk device-fields show <id> [flags]
```

| Argument | What it is |
|---|---|
| `<id>` | The field ID (device-fields list shows it) |

Needs device.view; only reads. Calls `GET /api/device-fields/{id}`.

## neodesk device-fields tags

Show which tags name:value could become device fields, with the devices and values.

Tags are grouped by name in any letter case. Each group proposes a key and a label for a text field of the whole server, and lists the devices that have two values of it, which keep it from being converted. Needs a server-level role.

```text quoted
neodesk device-fields tags [flags]
```

Needs device.fields_edit; only reads. Calls `GET /api/device-fields/tag-conversion`.

```bash quoted
neodesk device-fields tags --json
```

## neodesk device-fields values

List device field values of a selection of devices, or of the devices a filter keeps.

Values of fields you don't see are left out, and a filter by such a field is refused like one by a key that doesn't exist. Numbers and dates compare as numbers and dates.

```text quoted
neodesk device-fields values [flags]
```

| Flag | What it is |
|---|---|
| `--device DEVICE` | a device ID; repeat for more (left out: every device you see) |
| `--filter FILTER` | key:operator:value with eq, contains, min, max, or key:empty and key:notempty; repeat to combine |

Needs device.view; only reads. Calls `GET /api/device-fields/values`.

```bash quoted
neodesk device-fields values --device 123456789
neodesk device-fields values --filter warranty:max:2027-01-31 --filter customer:eq:Acme --json
```
