# Record Type Commands

A Keeper Record Type is a structured template that can contain any type of information such as logins, payment cards, SSH keys, servers, etc. The commands associated with Record Types are listed below.

## Commands

#### Keeper Command Reference

Whether using the interactive shell, CLI or JSON config file, Keeper supports the following commands, each command supports additional parameters and options.

To get help on a particular command, run:

`help <command>`

#### All commands associated with record types

| Command                     | Explanation                                                       |
| --------------------------- | ----------------------------------------------------------------- |
| `record-type-info` or `rti` | List record types or see information about a specific record type |
| `record-type` or `rt`       | Add, edit, or delete custom record types                          |
| `convert`                   | Convert legacy records to record-typed records                    |

### **record-type-info command:**

**Command:** `record-type-info` or `rti`

**Detail:** List available record types or display the field-level details of a specific record type

**Switches:**

`-lr`, `--list-record <RECORD TYPE OR ID (optional)>`

* If record type name or ID is not given, lists all record type names and IDs
* if a record type name or ID is given, displays the record type's details and fields

`-lf`, `--list-field <FIELD NAME>` show information about a specified field type. Can use "\*" to show all fields.

`-e`, `--example` generate example json for a record type or field. \*Must use with `-lr` or `-lf`

`--syntax-help` display extended help on record type parameters

`--format <{csv, json, table}>` choose the format to output in

`--output <OUTPUT FILE>` output results to a given file \*ignored if table format is used

#### **Examples:**

Get syntax help

```
My Vault> rti --syntax-help

Get Record Types Command Syntax Description:

Column Name       Description
  recordTypeId      Record Type Id
  content           Record type description in JSON format

--format:
            csv     CSV format
            json    JSON format
            table   Table format (default)

--example|-e:       Print example JSON for the field or record type

--list-record|-lr:  List specific record type - search by name or ID
--list-field|-lf:   List specific field type - search by name
```

Show a list of record types:

```
My Vault> rti

  Record Type ID  Record Type Name
----------------  ------------------------------
               1  address
               2  bankAccount
               3  bankCard
               4  birthCertificate
               5  contact
               6  databaseCredentials
               7  driverLicense
               8  encryptedNotes
               9  file
              10  general
              11  healthInsurance
              12  login
              13  membership
              14  passport
              15  photo
              16  serverCredentials
              17  softwareLicense
              18  sshKeys
              19  ssnCard
              96  wifiCredentials
         3000082  pamDatabase
         3000083  pamDirectory
         3000084  pamMachine
         3000085  pamUser
         3000093  pamRemoteBrowser
         4000086  pamAwsConfiguration
         4000087  pamAzureConfiguration
         4000088  pamLocalConfiguration
         4000089  pamNetworkConfiguration
         4000094  pamDomainConfiguration
```

Show the fields and JSON structure of the "login" record type:

```
My Vault> rti -lr login

  Record Type ID  Content
----------------  ----------------------------------
              12  {
                    "$id": "login",
                    "categories": [
                      "login"
                    ],
                    "description": "Login template",
                    "fields": [
                      {
                        "$ref": "passkey"
                      },
                      {
                        "$ref": "login"
                      },
                      {
                        "$ref": "password"
                      },
                      {
                        "$ref": "url"
                      },
                      {
                        "$ref": "fileRef"
                      },
                      {
                        "$ref": "oneTimeCode"
                      }
                    ]
                  }
```

Display a list of all field types:

```
/My Vault> rti -lf *

Field Type ID     Type              Lookup         Multiple    Description
----------------  ----------------  -------------  ----------  ------------------------------------------------------------------------------
text              text                                         plain text
secret            text                                         plain text
title             text                                         plain text
login             login             login                      Login field, detected as the website login for browser extension or KFFA.
password          password                                     Field value is masked and allows for generation. Also complexity enforcements.
name              name              name                       multiple fields to capture name
company           text              company                    plain text
phone             phone             phone          optional    numbers and symbols only plus tag
email             email             email          optional    valid email address plus tag
address           address                                      multiple fields to capture address
addressRef        addressRef        addressRef                 reference to the address field on another record
date              date                                         calendar date with validation, stored as unix milliseconds
expirationDate    date                                         calendar date with validation, stored as unix milliseconds
birthDate         date                                         calendar date with validation, stored as unix milliseconds
paymentCard       paymentCard                                  Field consisting of validated card number, expiration date and security code.
accountNumber     text              accountNumber              plain text
groupNumber       text                                         plain text
bankAccount       bankAccount       accountNumber              bank account information
cardRef           cardRef           bankCard       default     reference to the bankCard field on another record
note              multiline                                    multiline text
url               url                              optional    url string, can be clicked
fileRef           fileRef                          default     reference to the file field on another record
host              host              host           optional    multiple fields to capture host information
securityQuestion  securityQuestion                 default     Security Question and Answer
pinCode           secret                                       the field value is masked
oneTimeCode       otp                                          captures the seed, displays QR code
keyPair           privateKey                                   private key in ASN.1 format
licenseNumber     multiline                                    multiline text
multiline         multiline                                    multiline text
passkey           passkey                                      Password-less login
```

Get the field defails of the "host" field type:

```
My Vault> rti -lf host

Field Type ID    Type    Value Type    Value Format
---------------  ------  ------------  ----------------------------
host             host    object        {'hostName': '', 'port': ''}
```

Show an example full JSON record of a "passport" type:

```
My Vault> rti -lr passport -e
{
  "type": "passport",
  "title": "text",
  "notes": "text",
  "fields": [
    {
      "type": "accountNumber",
      "value": [
        "text"
      ],
      "label": "passportNumber"
    },
    {
      "type": "name",
      "value": [
        {
          "first": "text",
          "middle": "text",
          "last": "text"
        }
      ]
    },
    {
      "type": "birthDate",
      "value": [
        0
      ]
    },
    {
      "type": "addressRef",
      "value": []
    },
    {
      "type": "expirationDate",
      "value": [
        0
      ]
    },
    {
      "type": "date",
      "value": [
        0
      ],
      "label": "dateIssued"
    },
    {
      "type": "password",
      "value": [
        "text"
      ]
    },
    {
      "type": "fileRef",
      "value": []
    }
  ],
  "custom": []
}
```

Write the record type information as a CSV to a file:

```
rti --output logs/record-types.csv --format csv
```

***

### **record-type command:**

**Command:** `record-type` or `rt`

#### **Detail:**

Add, modify, or delete custom record types

#### **Parameters:**

Record type ID (if updating or deleting)

#### **Switches:**

`-a`, `--action <{add, update, remove}>` action to perform

* add - create a new custom record type
* update - modify an existing custom record type
* remove - delete an existing custom record type

`--data <DATA>` JSON formatted definition of the record type

#### Format:

Record types utilize the following formatting:

{% code overflow="wrap" %}

```
{ 
  "$id": <record type name>,
  "fields": [ 
    { "$ref": <field type>}, 
    { "$ref": <field type>, "label": <field label(optional)>, required: <true/false>}
  ] 
}
```

{% endcode %}

Example:

```javascript
{
   "$id":"My Record Type",
   "fields": [
      {
        "$ref":"login",
        "label":"AppLogin",
        "required":true
      },
      {
        "$ref":"name",
        "label":"Your name"
      },
      {
        "$ref":"address",
        "required":true
      }
    ]
}
```

Use the following command to see a list of available field types: `rti -lf *`

**Examples:**

{% code overflow="wrap" lineNumbers="true" %}

```
rt --action add --data '{"$id":"My Record Type", "fields": [{"$ref":"login","label":"AppLogin","required":true},{"$ref":"name","label":"Your name"},{"$ref":"address","required":true}]}'
rt 102 -a update --data '{"$id":"My Record Type", "fields": [{"$ref":"login","label":"AppLogin","required":true},{"$ref":"name","label":"Your name"}]}'
rt 102 -a remove
```

{% endcode %}

1. Add a new record type named "My Record Type"
2. Update the "My Record Type" record Type (which has an ID of 102 in this example). Here, the 'Address' field was removed
3. Remove the record type with ID 102

***

### convert command:

**Required Version:** `v16.5.9+`

**Command:** `convert`

**Detail:** Convert legacy (General typed or untyped) records to typed records.

{% hint style="info" %}
The convert command will only convert legacy, untyped records to typed records.

To convert the type of a typed record, use the [edit](https://docs.keeper.io/en/keeperpam/commander-cli/command-reference/..#edit-command-record-types) command.
{% endhint %}

**Parameters:**

Pattern to match records in the current folder. Matches against UIDs and titles. Can use "?" to match any single character and "\*" to match any number of characters

**Switches:**

`-t`, `--record-type <RECORD TYPE OR ID >` The type to convert records to

`-q`, `--quiet` Do not show info about matched and converted records

`-u`, `--url <URL Pattern>` Only converts records with URLs that match the given pattern. Can use "?" to match any single character and "\*" to match any number of characters

`-n`, `--dry-run` Display the outcome of the conversion without converting any records

`-r`, `--recursive` apply conversion to all matching records in the current and child folders

`--ignore-ownership` convert records even if they are not owned by the current account

**Examples:**

```
convert Dtvb84zwkBmZgxrUByUfpg --record-type login
convert * --record-type login --recursive --dry-run
convert * -t login -r
convert *sql* -t databaseCredentials 
convert *ssh-? -t sshKeys --recursive
```

1. Convert the untyped record with the given UID to a login type record
2. Perform a dry-run of conversion of all records in the vault and display what records would be converted. (will match all records if performed at the root directory)
3. Convert all untyped records in the vault to login type (if performed at the root directory)
4. Convert any untyped record that contains 'sql' in its name to a database credential
5. Convert any record that ends in ssh-\<anything> to a sshKey type record
   1. e.g convert a record titled "Github ssh-1" and a record titled "Github ssh-2"
