# Record Field Classes

{% hint style="info" %}
**Go SDK v1.7.0** - Requires **Go 1.16+**. This page covers all standard and PAM field types. For a complete list of field type strings registered in the SDK, see the `getKeeperRecordField` switch in `record_data.go`.
{% endhint %}

Record fields in the Keeper Secrets Manager Go SDK are represented as strongly-typed Go structs. Each field type extends the base `KeeperRecordField` type.

### Accessing Record Fields

Use the `GetFieldsByType` function to access record fields.

**Using GetFieldsByType:**

`GetFieldsByType(fieldType string) []map[string]interface{}`

Returns all standard fields matching the given type as a slice of raw maps. Fields are not automatically deserialized. Access values via map key and type assertion, or unmarshal into a typed struct (see [Example 2](#example-2-access-complex-fields-phone-address)).

```go
// Get login field from record
if loginFields := record.GetFieldsByType("login"); len(loginFields) > 0 {
  loginField := loginFields[0]
  // loginField is map[string]interface{} — access values via key
  if values, ok := loginField["value"].([]interface{}); ok && len(values) > 0 {
    loginValue := values[0].(string)
    fmt.Printf("Login: %s\n", loginValue)
  }
}
```

**Using GetFieldValueByType (recommended for simplicity):**

```go
import ksm "github.com/keeper-security/secrets-manager-go/core"

// Get login value directly
login := record.GetFieldValueByType("login")
fmt.Printf("Login: %s\n", login)

// Get password value
password := record.GetFieldValueByType("password")
fmt.Printf("Password: %s\n", password)
```

{% hint style="info" %}
`GetFieldValueByType` returns a string value for simple fields. For complex fields (Phone, Address, etc.), use `GetFieldsByType` with JSON unmarshaling as shown in Example 2 below.
{% endhint %}

## Field Type Classes Reference

### KeeperRecordField

All Record Fields extend the `KeeperRecordField` class, and contain a `Label` and `Type` fields

```go
type KeeperRecordField struct {
	Type  string `json:"type"`
	Label string `json:"label,omitempty"`
}
```

#### Field Values

| Name    | Type     | Required | Default |
| ------- | -------- | -------- | ------- |
| `Label` | `string` | No       | `""`    |
| `Type`  | `string` | Yes      | `""`    |

### Login

```go
type Login struct {
    KeeperRecordField
    Required      bool     `json:"required,omitempty"`
    PrivacyScreen bool     `json:"privacyScreen,omitempty"`
    Value         []string `json:"value,omitempty"`
}
```

#### **Field Values**

| Name            | Type       | Required | Default |
| --------------- | ---------- | -------- | ------- |
| `Label`         | `string`   | No       | `""`    |
| `Required`      | `bool`     | No       | `false` |
| `PrivacyScreen` | `bool`     | No       | `false` |
| `Value`         | `[]string` | Yes      |         |

### PasswordComplexity

```go
type PasswordComplexity struct {
    Length    int `json:"length,omitempty"`
    Caps      int `json:"caps,omitempty"`
    Lowercase int `json:"lowercase,omitempty"`
    Digits    int `json:"digits,omitempty"`
    Special   int `json:"special,omitempty"`
}
```

#### Field Values

| Name        | Type  | Required | Default | Description                |
| ----------- | ----- | -------- | ------- | -------------------------- |
| `Length`    | `int` | No       | `0`     | Total password length      |
| `Caps`      | `int` | No       | `0`     | Minimum uppercase letters  |
| `Lowercase` | `int` | No       | `0`     | Minimum lowercase letters  |
| `Digits`    | `int` | No       | `0`     | Minimum digits             |
| `Special`   | `int` | No       | `0`     | Minimum special characters |

{% hint style="warning" %}
`Password.Complexity` is a pointer field (`*PasswordComplexity`). Its default value is `nil` (no complexity policy). Always allocate before setting fields:

```go
pwd := &ksm.Password{}
pwd.Complexity = &ksm.PasswordComplexity{
    Length:  16,
    Caps:    2,
    Digits:  2,
    Special: 2,
}
```

{% endhint %}

### Password

```go
type Password struct {
	KeeperRecordField
	Required          bool                `json:"required,omitempty"`
	PrivacyScreen     bool                `json:"privacyScreen,omitempty"`
	EnforceGeneration bool                `json:"enforceGeneration,omitempty"`
	Complexity        *PasswordComplexity `json:"complexity,omitempty"`
	Value             []string            `json:"value,omitempty"`
}
```

#### Field Values

<table data-header-hidden><thead><tr><th width="237">Name</th><th width="150">Type</th><th width="150">Required</th><th>Default</th></tr></thead><tbody><tr><td>Name</td><td>Type</td><td>Required</td><td>Default</td></tr><tr><td><code>Label</code></td><td><code>string</code></td><td>No</td><td><code>""</code></td></tr><tr><td><code>Required</code></td><td><code>bool</code></td><td>No</td><td><code>false</code></td></tr><tr><td><code>PrivacyScreen</code></td><td><code>bool</code></td><td>No</td><td><code>false</code></td></tr><tr><td><code>EnforceGeneration</code></td><td><code>bool</code></td><td>No</td><td><code>false</code></td></tr><tr><td><code>Value</code></td><td><code>[]string</code></td><td>Yes</td><td></td></tr></tbody></table>

### Url

```go
type Url struct {
	KeeperRecordField
	Required      bool     `json:"required,omitempty"`
	PrivacyScreen bool     `json:"privacyScreen,omitempty"`
	Value         []string `json:"value,omitempty"`
}
```

#### Field Values

| Name            | Type       | Required | Default |
| --------------- | ---------- | -------- | ------- |
| `Label`         | `string`   | No       | `""`    |
| `Required`      | `bool`     | No       | `false` |
| `PrivacyScreen` | `bool`     | No       | `false` |
| `Value`         | `[]string` | Yes      |         |

### FileRef

```go
type FileRef struct {
	KeeperRecordField
	Required bool     `json:"required,omitempty"`
	Value    []string `json:"value,omitempty"`
}
```

#### Field Values

| Name       | Type       | Required | Default |
| ---------- | ---------- | -------- | ------- |
| `Label`    | `string`   | No       | `""`    |
| `Required` | `bool`     | No       | `false` |
| `Value`    | `[]string` | Yes      |         |

### OneTimeCode

```go
type OneTimeCode struct {
	KeeperRecordField
	Required      bool     `json:"required,omitempty"`
	PrivacyScreen bool     `json:"privacyScreen,omitempty"`
	Value         []string `json:"value,omitempty"`
}
```

#### Field Values

| Name            | Type       | Required | Default |
| --------------- | ---------- | -------- | ------- |
| `Label`         | `string`   | No       | `""`    |
| `Required`      | `bool`     | No       | `false` |
| `PrivacyScreen` | `bool`     | No       | `false` |
| `Value`         | `[]string` | Yes      |         |

### OneTimePassword

```go
type OneTimePassword struct {
    KeeperRecordField
    Required      bool     `json:"required,omitempty"`
    PrivacyScreen bool     `json:"privacyScreen,omitempty"`
    Value         []string `json:"value,omitempty"`
}
```

JSON field type string: `"otp"` (distinct from `OneTimeCode` which uses `"oneTimeCode"`).

#### Field Values

| Name            | Type       | Required | Default |
| --------------- | ---------- | -------- | ------- |
| `Label`         | `string`   | No       | `""`    |
| `Required`      | `bool`     | No       | `false` |
| `PrivacyScreen` | `bool`     | No       | `false` |
| `Value`         | `[]string` | Yes      |         |

### Name

```go
type Name struct {
	First  string `json:"first,omitempty"`
	Middle string `json:"middle,omitempty"`
	Last   string `json:"last,omitempty"`
}
```

#### Field Values

| Name     | Type     | Required | Default |
| -------- | -------- | -------- | ------- |
| `First`  | `string` | No       | `""`    |
| `Middle` | `string` | No       | `""`    |
| `Last`   | `string` | No       | `""`    |

### Names

```go
type Names struct {
	KeeperRecordField
	Required      bool   `json:"required,omitempty"`
	PrivacyScreen bool   `json:"privacyScreen,omitempty"`
	Value         []Name `json:"value,omitempty"`
}
```

#### Field Values

| Name            | Type     | Required | Default |
| --------------- | -------- | -------- | ------- |
| `Label`         | `string` | No       | `""`    |
| `Required`      | `bool`   | No       | `false` |
| `PrivacyScreen` | `bool`   | No       | `false` |
| `Value`         | `[]Name` | Yes      |         |

### BirthDate

```go
type BirthDate struct {
	KeeperRecordField
	Required      bool    `json:"required,omitempty"`
	PrivacyScreen bool    `json:"privacyScreen,omitempty"`
	Value         []int64 `json:"value,omitempty"`
}
```

#### Field Values

| Name            | Type      | Required | Default |
| --------------- | --------- | -------- | ------- |
| `Label`         | `string`  | No       | `""`    |
| `Required`      | `bool`    | No       | `false` |
| `PrivacyScreen` | `bool`    | No       | `false` |
| `Value`         | `[]int64` | Yes      |         |

{% hint style="warning" %}
**Date Format**: Date values are stored as **Unix timestamps in milliseconds** (epoch time). To convert to/from Go `time.Time`:

```go
import "time"

// Unix milliseconds to time.Time
dateValue := int64(1641934793000) // from field
goTime := time.Unix(dateValue/1000, (dateValue%1000)*1000000)

// time.Time to Unix milliseconds
goTime := time.Now()
milliseconds := goTime.UnixNano() / 1000000
```

{% endhint %}

### Date

```go
type Date struct {
	KeeperRecordField
	Required      bool    `json:"required,omitempty"`
	PrivacyScreen bool    `json:"privacyScreen,omitempty"`
	Value         []int64 `json:"value,omitempty"`
}
```

#### Field Values

| Name            | Type      | Required | Default |
| --------------- | --------- | -------- | ------- |
| `Label`         | `string`  | No       | `""`    |
| `Required`      | `bool`    | No       | `false` |
| `PrivacyScreen` | `bool`    | No       | `false` |
| `Value`         | `[]int64` | Yes      |         |

{% hint style="warning" %}
**Date Format**: Date values are stored as **Unix timestamps in milliseconds** (epoch time).

See note beneath [#birthdate](#birthdate "mention") for a code example.
{% endhint %}

### ExpirationDate

```go
type ExpirationDate struct {
	KeeperRecordField
	Required      bool    `json:"required,omitempty"`
	PrivacyScreen bool    `json:"privacyScreen,omitempty"`
	Value         []int64 `json:"value,omitempty"`
}
```

#### Field Values

| Name            | Type      | Required | Default |
| --------------- | --------- | -------- | ------- |
| `Label`         | `string`  | No       | `""`    |
| `Required`      | `bool`    | No       | `false` |
| `PrivacyScreen` | `bool`    | No       | `false` |
| `Value`         | `[]int64` | Yes      |         |

{% hint style="warning" %}
**Date Format**: Date values are stored as **Unix timestamps in milliseconds** (epoch time).

See note beneath [#birthdate](#birthdate "mention") for a code example.
{% endhint %}

### Text

```go
type Text struct {
	KeeperRecordField
	Required      bool     `json:"required,omitempty"`
	PrivacyScreen bool     `json:"privacyScreen,omitempty"`
	Value         []string `json:"value,omitempty"`
}
```

#### Field Values

| Name            | Type       | Required | Default |
| --------------- | ---------- | -------- | ------- |
| `Label`         | `string`   | No       | `""`    |
| `Required`      | `bool`     | No       | `false` |
| `PrivacyScreen` | `bool`     | No       | `false` |
| `Value`         | `[]string` | Yes      |         |

### SecurityQuestion

```go
type SecurityQuestion struct {
	Question string `json:"question,omitempty"`
	Answer   string `json:"answer,omitempty"`
}
```

#### Field Values

| Name       | Type     | Required | Default |
| ---------- | -------- | -------- | ------- |
| `Question` | `string` | No       | `""`    |
| `Answer`   | `string` | No       | `""`    |

### SecurityQuestions

```go
type SecurityQuestions struct {
	KeeperRecordField
	Required      bool               `json:"required,omitempty"`
	PrivacyScreen bool               `json:"privacyScreen,omitempty"`
	Value         []SecurityQuestion `json:"value,omitempty"`
}
```

#### Field Values

<table data-header-hidden><thead><tr><th>Name</th><th width="232">Type</th><th width="152">Required</th><th>Default</th></tr></thead><tbody><tr><td>Name</td><td>Type</td><td>Required</td><td>Default</td></tr><tr><td><code>Label</code></td><td><code>string</code></td><td>No</td><td><code>""</code></td></tr><tr><td><code>Required</code></td><td><code>bool</code></td><td>No</td><td><code>false</code></td></tr><tr><td><code>PrivacyScreen</code></td><td><code>bool</code></td><td>No</td><td><code>false</code></td></tr><tr><td><code>Value</code></td><td><code>[]SecurityQuestion</code></td><td>Yes</td><td></td></tr></tbody></table>

### Multiline

```go
type Multiline struct {
	KeeperRecordField
	Required      bool     `json:"required,omitempty"`
	PrivacyScreen bool     `json:"privacyScreen,omitempty"`
	Value         []string `json:"value,omitempty"`
}
```

#### Field Values

| Name            | Type       | Required | Default |
| --------------- | ---------- | -------- | ------- |
| `Label`         | `string`   | No       | `""`    |
| `Required`      | `bool`     | No       | `false` |
| `PrivacyScreen` | `bool`     | No       | `false` |
| `Value`         | `[]string` | Yes      |         |

### Email

```go
type Email struct {
	KeeperRecordField
	Required      bool     `json:"required,omitempty"`
	PrivacyScreen bool     `json:"privacyScreen,omitempty"`
	Value         []string `json:"value,omitempty"`
}
```

#### Field Values

| Name            | Type       | Required | Default |
| --------------- | ---------- | -------- | ------- |
| `Label`         | `string`   | No       | `""`    |
| `Required`      | `bool`     | No       | `false` |
| `PrivacyScreen` | `bool`     | No       | `false` |
| `Value`         | `[]string` | Yes      |         |

### CardRef

```go
type CardRef struct {
	KeeperRecordField
	Required      bool     `json:"required,omitempty"`
	PrivacyScreen bool     `json:"privacyScreen,omitempty"`
	Value         []string `json:"value,omitempty"`
}
```

#### Field Values

| Name            | Type       | Required | Default |
| --------------- | ---------- | -------- | ------- |
| `Label`         | `string`   | No       | `""`    |
| `Required`      | `bool`     | No       | `false` |
| `PrivacyScreen` | `bool`     | No       | `false` |
| `Value`         | `[]string` | Yes      |         |

### AddressRef

```go
type AddressRef struct {
	KeeperRecordField
	Required      bool     `json:"required,omitempty"`
	PrivacyScreen bool     `json:"privacyScreen,omitempty"`
	Value         []string `json:"value,omitempty"`
}
```

#### Field Values

| Name            | Type       | Required | Default |
| --------------- | ---------- | -------- | ------- |
| `Label`         | `string`   | No       | `""`    |
| `Required`      | `bool`     | No       | `false` |
| `PrivacyScreen` | `bool`     | No       | `false` |
| `Value`         | `[]string` | Yes      |         |

### PinCode

```go
type PinCode struct {
	KeeperRecordField
	Required      bool     `json:"required,omitempty"`
	PrivacyScreen bool     `json:"privacyScreen,omitempty"`
	Value         []string `json:"value,omitempty"`
}
```

#### Field Values

| Name            | Type       | Required | Default |
| --------------- | ---------- | -------- | ------- |
| `Label`         | `string`   | No       | `""`    |
| `Required`      | `bool`     | No       | `false` |
| `PrivacyScreen` | `bool`     | No       | `false` |
| `Value`         | `[]string` | Yes      |         |

### Phone

```go
type Phone struct {
	Region string `json:"region,omitempty"`
	Number string `json:"number,omitempty"`
	Ext    string `json:"ext,omitempty"`
	Type   string `json:"type,omitempty"`
}
```

#### Field Values

| Name     | Type     | Required | Default |
| -------- | -------- | -------- | ------- |
| `Region` | `string` | No       | `""`    |
| `Number` | `string` | No       | `""`    |
| `Ext`    | `string` | No       | `""`    |
| `Type`   | `string` | No       | `""`    |

### Phones

```go
type Phones struct {
	KeeperRecordField
	Required      bool    `json:"required,omitempty"`
	PrivacyScreen bool    `json:"privacyScreen,omitempty"`
	Value         []Phone `json:"value,omitempty"`
}
```

#### Field Values

| Name            | Type      | Required | Default |
| --------------- | --------- | -------- | ------- |
| `Label`         | `string`  | No       | `""`    |
| `Required`      | `bool`    | No       | `false` |
| `PrivacyScreen` | `bool`    | No       | `false` |
| `Value`         | `[]Phone` | Yes      |         |

### Secret

```go
type Secret struct {
	KeeperRecordField
	Required      bool     `json:"required,omitempty"`
	PrivacyScreen bool     `json:"privacyScreen,omitempty"`
	Value         []string `json:"value,omitempty"`
}
```

#### Field Values

<table data-header-hidden><thead><tr><th>Name</th><th width="167">Type</th><th width="160.3170731707317">Required</th><th>Default</th></tr></thead><tbody><tr><td>Name</td><td>Type</td><td>Required</td><td>Default</td></tr><tr><td><code>Label</code></td><td><code>string</code></td><td>No</td><td><code>""</code></td></tr><tr><td><code>Required</code></td><td><code>bool</code></td><td>No</td><td><code>false</code></td></tr><tr><td><code>PrivacyScreen</code></td><td><code>bool</code></td><td>No</td><td><code>false</code></td></tr><tr><td><code>Value</code></td><td><code>[]string</code></td><td>Yes</td><td></td></tr></tbody></table>

### SecureNote

```go
type SecureNote struct {
	KeeperRecordField
	Required      bool     `json:"required,omitempty"`
	PrivacyScreen bool     `json:"privacyScreen,omitempty"`
	Value         []string `json:"value,omitempty"`
}
```

#### Field Values

| Name            | Type       | Required | Default |
| --------------- | ---------- | -------- | ------- |
| `Label`         | `string`   | No       | `""`    |
| `Required`      | `bool`     | No       | `false` |
| `PrivacyScreen` | `bool`     | No       | `false` |
| `Value`         | `[]string` | Yes      |         |

### AccountNumber

```go
type AccountNumber struct {
	KeeperRecordField
	Required      bool     `json:"required,omitempty"`
	PrivacyScreen bool     `json:"privacyScreen,omitempty"`
	Value         []string `json:"value,omitempty"`
}
```

#### Field Values

| Name            | Type       | Required | Default |
| --------------- | ---------- | -------- | ------- |
| `Label`         | `string`   | No       | `""`    |
| `Required`      | `bool`     | No       | `false` |
| `PrivacyScreen` | `bool`     | No       | `false` |
| `Value`         | `[]string` | Yes      |         |

### PaymentCard

```go
type PaymentCard struct {
	CardNumber         string `json:"cardNumber,omitempty"`
	CardExpirationDate string `json:"cardExpirationDate,omitempty"`
	CardSecurityCode   string `json:"cardSecurityCode,omitempty"`
}
```

#### Field Values

<table data-header-hidden><thead><tr><th width="247.202216066482">Name</th><th width="150">Type</th><th width="157">Required</th><th>Default</th></tr></thead><tbody><tr><td>Name</td><td>Type</td><td>Required</td><td>Default</td></tr><tr><td><code>CardNumber</code></td><td><code>string</code></td><td>No</td><td><code>""</code></td></tr><tr><td><code>CardExpirationDate</code></td><td><code>string</code></td><td>No</td><td><code>""</code></td></tr><tr><td><code>CardSecurityCode</code></td><td><code>string</code></td><td>No</td><td><code>""</code></td></tr></tbody></table>

### PaymentCards

```go
type PaymentCards struct {
	KeeperRecordField
	Required      bool          `json:"required,omitempty"`
	PrivacyScreen bool          `json:"privacyScreen,omitempty"`
	Value         []PaymentCard `json:"value,omitempty"`
}
```

#### Field Values

| Name            | Type            | Required | Default |
| --------------- | --------------- | -------- | ------- |
| `Label`         | `string`        | No       | `""`    |
| `Required`      | `bool`          | No       | `false` |
| `PrivacyScreen` | `bool`          | No       | `false` |
| `Value`         | `[]PaymentCard` | Yes      |         |

### BankAccount

```go
type BankAccount struct {
	AccountType   string `json:"accountType,omitempty"`
	RoutingNumber string `json:"routingNumber,omitempty"`
	AccountNumber string `json:"accountNumber,omitempty"`
	OtherType     string `json:"otherType,omitempty"`
}
```

#### Field Values

| Name            | Type     | Required | Default |
| --------------- | -------- | -------- | ------- |
| `AccountType`   | `string` | No       | `""`    |
| `RoutingNumber` | `string` | No       | `""`    |
| `AccountNumber` | `string` | No       | `""`    |
| `OtherType`     | `string` | No       | `""`    |

### BankAccounts

```go
type BankAccounts struct {
	KeeperRecordField
	Required      bool          `json:"required,omitempty"`
	PrivacyScreen bool          `json:"privacyScreen,omitempty"`
	Value         []BankAccount `json:"value,omitempty"`
}
```

#### Field Values

| Name            | Type            | Required | Default |
| --------------- | --------------- | -------- | ------- |
| `Label`         | `string`        | No       | `""`    |
| `Required`      | `bool`          | No       | `false` |
| `PrivacyScreen` | `bool`          | No       | `false` |
| `Value`         | `[]BankAccount` | Yes      |         |

### KeyPair

```go
type KeyPair struct {
	PublicKey  string `json:"publicKey,omitempty"`
	PrivateKey string `json:"privateKey,omitempty"`
}
```

| Name         | Type     | Required | Default |
| ------------ | -------- | -------- | ------- |
| `PublicKey`  | `string` | No       | `""`    |
| `PrivateKey` | `string` | No       | `""`    |

### KeyPairs

```go
type KeyPairs struct {
	KeeperRecordField
	Required      bool      `json:"required,omitempty"`
	PrivacyScreen bool      `json:"privacyScreen,omitempty"`
	Value         []KeyPair `json:"value,omitempty"`
}
```

#### Field Values

| Name            | Type        | Required | Default |
| --------------- | ----------- | -------- | ------- |
| `Label`         | `string`    | No       | `""`    |
| `Required`      | `bool`      | No       | `false` |
| `PrivacyScreen` | `bool`      | No       | `false` |
| `Value`         | `[]KeyPair` | Yes      |         |

### Host

```go
type Host struct {
	Hostname string `json:"hostName,omitempty"`
	Port     string `json:"port,omitempty"`
}
```

#### Field Values

| Name       | Type     | Required | Default |
| ---------- | -------- | -------- | ------- |
| `Hostname` | `string` | No       | `""`    |
| `Port`     | `string` | No       | `""`    |

### Hosts

```go
type Hosts struct {
	KeeperRecordField
	Required      bool   `json:"required,omitempty"`
	PrivacyScreen bool   `json:"privacyScreen,omitempty"`
	Value         []Host `json:"value,omitempty"`
}
```

#### Field Values

| Name            | Type     | Required | Default |
| --------------- | -------- | -------- | ------- |
| `Label`         | `string` | No       | `""`    |
| `Required`      | `bool`   | No       | `false` |
| `PrivacyScreen` | `bool`   | No       | `false` |
| `Value`         | `[]Host` | Yes      |         |

### Address

```go
type Address struct {
	Street1 string `json:"street1,omitempty"`
	Street2 string `json:"street2,omitempty"`
	City    string `json:"city,omitempty"`
	State   string `json:"state,omitempty"`
	Country string `json:"country,omitempty"`
	Zip     string `json:"zip,omitempty"`
}
```

#### Field Values

| Name      | Type     | Required | Default |
| --------- | -------- | -------- | ------- |
| `Street1` | `string` | No       | `""`    |
| `Street2` | `string` | No       | `""`    |
| `City`    | `string` | No       | `""`    |
| `State`   | `string` | No       | `""`    |
| `Country` | `string` | No       | `""`    |
| `Zip`     | `string` | No       | `""`    |

### Addresses

```go
type Addresses struct {
	KeeperRecordField
	Required      bool      `json:"required,omitempty"`
	PrivacyScreen bool      `json:"privacyScreen,omitempty"`
	Value         []Address `json:"value,omitempty"`
}
```

#### Field Values

| Name            | Type        | Required | Default |
| --------------- | ----------- | -------- | ------- |
| `Label`         | `string`    | No       | `""`    |
| `Required`      | `bool`      | No       | `false` |
| `PrivacyScreen` | `bool`      | No       | `false` |
| `Value`         | `[]Address` | Yes      |         |

### LicenseNumber

```go
type LicenseNumber struct {
	KeeperRecordField
	Required      bool     `json:"required,omitempty"`
	PrivacyScreen bool     `json:"privacyScreen,omitempty"`
	Value         []string `json:"value,omitempty"`
}
```

#### Field Values

| Name            | Type       | Required | Default |
| --------------- | ---------- | -------- | ------- |
| `Label`         | `string`   | No       | `""`    |
| `Required`      | `bool`     | No       | `false` |
| `PrivacyScreen` | `bool`     | No       | `false` |
| `Value`         | `[]string` | Yes      |         |

### RecordRef

```go
type RecordRef struct {
    KeeperRecordField
    Required bool     `json:"required,omitempty"`
    Value    []string `json:"value,omitempty"`
}
```

#### Field Values

| Name       | Type       | Required | Default |
| ---------- | ---------- | -------- | ------- |
| `Label`    | `string`   | No       | `""`    |
| `Required` | `bool`     | No       | `false` |
| `Value`    | `[]string` | Yes      |         |

### Checkbox

```go
type Checkbox struct {
    KeeperRecordField
    Required bool   `json:"required,omitempty"`
    Value    []bool `json:"value,omitempty"`
}
```

#### Field Values

| Name       | Type     | Required | Default |
| ---------- | -------- | -------- | ------- |
| `Label`    | `string` | No       | `""`    |
| `Required` | `bool`   | No       | `false` |
| `Value`    | `[]bool` | Yes      |         |

### Dropdown

```go
type Dropdown struct {
    KeeperRecordField
    Required bool     `json:"required,omitempty"`
    Value    []string `json:"value,omitempty"`
}
```

#### Field Values

| Name       | Type       | Required | Default |
| ---------- | ---------- | -------- | ------- |
| `Label`    | `string`   | No       | `""`    |
| `Required` | `bool`     | No       | `false` |
| `Value`    | `[]string` | Yes      |         |

### Schedule

```go
type Schedule struct {
    Type          string `json:"type,omitempty"`
    Cron          string `json:"cron,omitempty"`
    Time          string `json:"time,omitempty"`
    Tz            string `json:"tz,omitempty"`
    Weekday       string `json:"weekday,omitempty"`
    IntervalCount int    `json:"intervalCount,omitempty"`
}
```

#### Field Values

| Name            | Type     | Required | Default | Description                               |
| --------------- | -------- | -------- | ------- | ----------------------------------------- |
| `Type`          | `string` | No       | `""`    | Schedule type (e.g. `"weekly"`)           |
| `Cron`          | `string` | No       | `""`    | Cron expression                           |
| `Time`          | `string` | No       | `""`    | Time of day (replaces deprecated UtcTime) |
| `Tz`            | `string` | No       | `""`    | IANA timezone (e.g. `"America/Chicago"`)  |
| `Weekday`       | `string` | No       | `""`    | Day of week for weekly schedules          |
| `IntervalCount` | `int`    | No       | `0`     | Repeat interval count                     |

### Schedules

```go
type Schedules struct {
    KeeperRecordField
    Required bool       `json:"required,omitempty"`
    Value    []Schedule `json:"value,omitempty"`
}
```

#### Field Values

| Name       | Type         | Required | Default |
| ---------- | ------------ | -------- | ------- |
| `Label`    | `string`     | No       | `""`    |
| `Required` | `bool`       | No       | `false` |
| `Value`    | `[]Schedule` | Yes      |         |

### DirectoryType

```go
type DirectoryType struct {
    KeeperRecordField
    Required bool     `json:"required,omitempty"`
    Value    []string `json:"value,omitempty"`
}
```

#### Field Values

| Name       | Type       | Required | Default |
| ---------- | ---------- | -------- | ------- |
| `Label`    | `string`   | No       | `""`    |
| `Required` | `bool`     | No       | `false` |
| `Value`    | `[]string` | Yes      |         |

### DatabaseType

```go
type DatabaseType struct {
    KeeperRecordField
    Required bool     `json:"required,omitempty"`
    Value    []string `json:"value,omitempty"`
}
```

#### Field Values

| Name       | Type       | Required | Default |
| ---------- | ---------- | -------- | ------- |
| `Label`    | `string`   | No       | `""`    |
| `Required` | `bool`     | No       | `false` |
| `Value`    | `[]string` | Yes      |         |

### PamHostname

```go
type PamHostname struct {
    KeeperRecordField
    Required      bool   `json:"required,omitempty"`
    PrivacyScreen bool   `json:"privacyScreen,omitempty"`
    Value         []Host `json:"value,omitempty"`
}
```

#### Field Values

| Name            | Type     | Required | Default |
| --------------- | -------- | -------- | ------- |
| `Label`         | `string` | No       | `""`    |
| `Required`      | `bool`   | No       | `false` |
| `PrivacyScreen` | `bool`   | No       | `false` |
| `Value`         | `[]Host` | Yes      |         |

`Value` uses the same `Host` struct as `Hosts`. See [Host](#host).

### AllowedSettings

```go
type AllowedSettings struct {
    Connections         bool `json:"connections,omitempty"`
    PortForwards        bool `json:"portForwards,omitempty"`
    Rotation            bool `json:"rotation,omitempty"`
    SessionRecording    bool `json:"sessionRecording,omitempty"`
    TypescriptRecording bool `json:"typescriptRecording,omitempty"`
}
```

#### Field Values

| Name                  | Type   | Required | Default |
| --------------------- | ------ | -------- | ------- |
| `Connections`         | `bool` | No       | `false` |
| `PortForwards`        | `bool` | No       | `false` |
| `Rotation`            | `bool` | No       | `false` |
| `SessionRecording`    | `bool` | No       | `false` |
| `TypescriptRecording` | `bool` | No       | `false` |

### PamResource

```go
type PamResource struct {
    ControllerUid   string          `json:"controllerUid,omitempty"`
    FolderUid       string          `json:"folderUid,omitempty"`
    ResourceRef     []string        `json:"resourceRef,omitempty"`
    AllowedSettings AllowedSettings `json:"allowedSettings,omitempty"`
}
```

#### Field Values

| Name              | Type              | Required | Default |
| ----------------- | ----------------- | -------- | ------- |
| `ControllerUid`   | `string`          | No       | `""`    |
| `FolderUid`       | `string`          | No       | `""`    |
| `ResourceRef`     | `[]string`        | No       | `nil`   |
| `AllowedSettings` | `AllowedSettings` | No       |         |

### PamResources

```go
type PamResources struct {
    KeeperRecordField
    Required bool          `json:"required,omitempty"`
    Value    []PamResource `json:"value,omitempty"`
}
```

#### Field Values

| Name       | Type            | Required | Default |
| ---------- | --------------- | -------- | ------- |
| `Label`    | `string`        | No       | `""`    |
| `Required` | `bool`          | No       | `false` |
| `Value`    | `[]PamResource` | Yes      |         |

### Script

```go
type Script struct {
    FileRef   string   `json:"fileRef,omitempty"`
    Command   string   `json:"command,omitempty"`
    RecordRef []string `json:"recordRef,omitempty"`
}
```

#### Field Values

| Name        | Type       | Required | Default | Description                              |
| ----------- | ---------- | -------- | ------- | ---------------------------------------- |
| `FileRef`   | `string`   | No       | `""`    | UID of the attached script file          |
| `Command`   | `string`   | No       | `""`    | Shell command to execute                 |
| `RecordRef` | `[]string` | No       | `nil`   | UIDs of records passed as script context |

### Scripts

```go
type Scripts struct {
    KeeperRecordField
    Required      bool     `json:"required,omitempty"`
    PrivacyScreen bool     `json:"privacyScreen,omitempty"`
    Value         []Script `json:"value,omitempty"`
}
```

#### Field Values

| Name            | Type       | Required | Default |
| --------------- | ---------- | -------- | ------- |
| `Label`         | `string`   | No       | `""`    |
| `Required`      | `bool`     | No       | `false` |
| `PrivacyScreen` | `bool`     | No       | `false` |
| `Value`         | `[]Script` | Yes      |         |

### PamSettingsPortForward

```go
type PamSettingsPortForward struct {
    ReusePort bool   `json:"reusePort,omitempty"`
    Port      string `json:"port,omitempty"`
}
```

#### Field Values

| Name        | Type     | Required | Default |
| ----------- | -------- | -------- | ------- |
| `ReusePort` | `bool`   | No       | `false` |
| `Port`      | `string` | No       | `""`    |

### PamSettingsConnection

```go
type PamSettingsConnection struct {
    Protocol     string   `json:"protocol,omitempty"`
    UserRecords  []string `json:"userRecords,omitempty"`
    Security     string   `json:"security,omitempty"`
    IgnoreCert   bool     `json:"ignoreCert,omitempty"`
    ResizeMethod string   `json:"resizeMethod,omitempty"`
    ColorScheme  string   `json:"colorScheme,omitempty"`
}
```

#### Field Values

| Name           | Type       | Required | Default |
| -------------- | ---------- | -------- | ------- |
| `Protocol`     | `string`   | No       | `""`    |
| `UserRecords`  | `[]string` | No       | `nil`   |
| `Security`     | `string`   | No       | `""`    |
| `IgnoreCert`   | `bool`     | No       | `false` |
| `ResizeMethod` | `string`   | No       | `""`    |
| `ColorScheme`  | `string`   | No       | `""`    |

### PamSetting

```go
type PamSetting struct {
    PortForward []PamSettingsPortForward `json:"portForward,omitempty"`
    Connection  []PamSettingsConnection  `json:"connection,omitempty"`
}
```

#### Field Values

| Name          | Type                       | Required | Default |
| ------------- | -------------------------- | -------- | ------- |
| `PortForward` | `[]PamSettingsPortForward` | No       | `nil`   |
| `Connection`  | `[]PamSettingsConnection`  | No       | `nil`   |

### PamSettings

```go
type PamSettings struct {
    KeeperRecordField
    Required bool         `json:"required,omitempty"`
    Value    []PamSetting `json:"value,omitempty"`
}
```

#### Field Values

| Name       | Type           | Required | Default |
| ---------- | -------------- | -------- | ------- |
| `Label`    | `string`       | No       | `""`    |
| `Required` | `bool`         | No       | `false` |
| `Value`    | `[]PamSetting` | Yes      |         |

### PamRbiConnection

```go
type PamRbiConnection struct {
    Protocol                   string   `json:"protocol,omitempty"`
    UserRecords                []string `json:"userRecords,omitempty"`
    AllowUrlManipulation       bool     `json:"allowUrlManipulation,omitempty"`
    AllowedUrlPatterns         string   `json:"allowedUrlPatterns,omitempty"`
    AllowedResourceUrlPatterns string   `json:"allowedResourceUrlPatterns,omitempty"`
    HttpCredentialsUid         string   `json:"httpCredentialsUid,omitempty"`
    AutofillConfiguration      string   `json:"autofillConfiguration,omitempty"`
}
```

#### Field Values

| Name                         | Type       | Required | Default |
| ---------------------------- | ---------- | -------- | ------- |
| `Protocol`                   | `string`   | No       | `""`    |
| `UserRecords`                | `[]string` | No       | `nil`   |
| `AllowUrlManipulation`       | `bool`     | No       | `false` |
| `AllowedUrlPatterns`         | `string`   | No       | `""`    |
| `AllowedResourceUrlPatterns` | `string`   | No       | `""`    |
| `HttpCredentialsUid`         | `string`   | No       | `""`    |
| `AutofillConfiguration`      | `string`   | No       | `""`    |

### PamRemoteBrowserSetting

```go
type PamRemoteBrowserSetting struct {
    Connection PamRbiConnection `json:"connection,omitempty"`
}
```

#### Field Values

| Name         | Type               | Required | Default |
| ------------ | ------------------ | -------- | ------- |
| `Connection` | `PamRbiConnection` | No       |         |

### PamRemoteBrowserSettings

```go
type PamRemoteBrowserSettings struct {
    KeeperRecordField
    Required bool                      `json:"required,omitempty"`
    Value    []PamRemoteBrowserSetting `json:"value,omitempty"`
}
```

#### Field Values

| Name       | Type                        | Required | Default |
| ---------- | --------------------------- | -------- | ------- |
| `Label`    | `string`                    | No       | `""`    |
| `Required` | `bool`                      | No       | `false` |
| `Value`    | `[]PamRemoteBrowserSetting` | Yes      |         |

### KeeperFileData

```go
type KeeperFileData struct {
	Title        string `json:"title,omitempty"`
	Name         string `json:"name,omitempty"`
	Type         string `json:"type,omitempty"`
	Size         int64  `json:"size,omitempty"`
	LastModified int64  `json:"lastModified,omitempty"`
}
```

#### Field Values

| Name           | Type     | Description                                 |
| -------------- | -------- | ------------------------------------------- |
| `Title`        | `string` | Display title for the file attachment       |
| `Name`         | `string` | Original filename                           |
| `Type`         | `string` | MIME type                                   |
| `Size`         | `int64`  | File size in bytes                          |
| `LastModified` | `int64`  | Last modified timestamp (Unix milliseconds) |

{% hint style="info" %}
`KeeperFileData` is populated by the server when a file is uploaded. All fields use `omitempty` — the SDK does not enforce any field as required.
{% endhint %}

## Field Access Best Practices

{% hint style="info" %}
**Improved in v1.7.0**: The SDK now gracefully handles broken or missing field data instead of failing
{% endhint %}

#### Safe Field Access Pattern

When accessing record fields, always check for:

1. **Field existence** - The field may not be present in the record
2. **Value existence** - The field may exist but have no value
3. **Type assertions** - The value may not be in the expected format

**Recommended pattern:**

```go
import (
  "fmt"
  ksm "github.com/keeper-security/secrets-manager-go/core"
)

func safeGetFieldValue(record *ksm.Record, fieldType string) string {
  // Get field by type
  fields := record.GetFieldsByType(fieldType)
  if len(fields) == 0 {
    fmt.Printf("Field '%s' not found in record\n", fieldType)
    return ""
  }

  // Extract value from first field
  field := fields[0]
  if values, ok := field["value"].([]interface{}); ok && len(values) > 0 {
    if strValue, ok := values[0].(string); ok {
      return strValue
    }
  }

  fmt.Printf("Field '%s' has no valid value\n", fieldType)
  return ""
}

// Usage
login := safeGetFieldValue(record, "login")
password := safeGetFieldValue(record, "password")
```

**Using GetFieldValueByType (simpler):**

```go
import ksm "github.com/keeper-security/secrets-manager-go/core"

// GetFieldValueByType handles missing fields gracefully, returns empty string if not found
login := record.GetFieldValueByType("login")
password := record.GetFieldValueByType("password")
url := record.GetFieldValueByType("url")

// Check for empty values
if login == "" {
  fmt.Println("Login field is empty or missing")
}
```

#### Handling Broken Fields

{% hint style="success" %}
**v1.7.0 Enhancement**: The SDK automatically skips fields with broken encryption and continues processing valid fields.
{% endhint %}

If a record contains fields with broken encryption:

* **Valid fields** are still accessible
* **Broken fields** are silently skipped
* **No errors** are thrown for individual field failures

**Example:**

```go
records, err := sm.GetSecrets([]string{"RECORD_UID"})
if err != nil {
  fmt.Printf("Error: %v\n", err)
  return
}

// Even if some fields have broken encryption, you can still access valid fields
record := records[0]
title := record.Title()
notes := record.Notes()

// Attempt to get fields - broken fields return empty values
password := record.GetFieldValueByType("password") // Returns "" if field is broken
login := record.GetFieldValueByType("login")       // Returns valid value if not broken

fmt.Printf("Title: %s\n", title)
fmt.Printf("Login: %s\n", login)
fmt.Printf("Password: %s\n", password)
```

### Common Field Access Patterns

#### Example 1: Retrieve All Fields from a Login Record

```go
import (
  "fmt"
  ksm "github.com/keeper-security/secrets-manager-go/core"
)

func displayLoginRecord(record *ksm.Record) {
  fmt.Printf("Title: %s\n", record.Title())
  fmt.Printf("Type: %s\n", record.Type())

  // Get standard fields using GetFieldValueByType
  login := record.GetFieldValueByType("login")
  password := record.GetFieldValueByType("password")
  url := record.GetFieldValueByType("url")

  fmt.Printf("Login: %s\n", login)
  fmt.Printf("Password: %s\n", password)
  fmt.Printf("URL: %s\n", url)

  // Get notes
  fmt.Printf("Notes: %s\n", record.Notes())
}

func main() {
  clientOptions := &ksm.ClientOptions{
    Config: ksm.NewFileKeyValueStorage("ksm-config.json"),
  }
  sm := ksm.NewSecretsManager(clientOptions)

  records, err := sm.GetSecrets([]string{"RECORD_UID"})
  if err != nil {
    fmt.Printf("Error: %v\n", err)
    return
  }

  if len(records) > 0 {
    displayLoginRecord(records[0])
  }
}
```

#### Example 2: Access Complex Fields (Phone, Address)

```go
import (
  "encoding/json"
  "fmt"
  ksm "github.com/keeper-security/secrets-manager-go/core"
)

func getPhoneNumbers(record *ksm.Record) []ksm.Phone {
  phones := []ksm.Phone{}

  // Get phone fields
  phoneFields := record.GetFieldsByType("phone")
  for _, field := range phoneFields {
    if values, ok := field["value"].([]interface{}); ok {
      for _, v := range values {
        // Convert to JSON and unmarshal to Phone struct
        if jsonBytes, err := json.Marshal(v); err == nil {
          var phone ksm.Phone
          if json.Unmarshal(jsonBytes, &phone) == nil {
            phones = append(phones, phone)
          }
        }
      }
    }
  }

  return phones
}

func main() {
  clientOptions := &ksm.ClientOptions{
    Config: ksm.NewFileKeyValueStorage("ksm-config.json"),
  }
  sm := ksm.NewSecretsManager(clientOptions)

  records, err := sm.GetSecrets([]string{"RECORD_UID"})
  if err != nil {
    fmt.Printf("Error: %v\n", err)
    return
  }

  if len(records) > 0 {
    phones := getPhoneNumbers(records[0])
    for _, phone := range phones {
      fmt.Printf("Phone: %s %s ext %s (%s)\n",
        phone.Region, phone.Number, phone.Ext, phone.Type)
    }
  }
}
```

#### Example 3: Check if Field Exists Before Accessing

```go
import (
  "fmt"
  ksm "github.com/keeper-security/secrets-manager-go/core"
)

func hasField(record *ksm.Record, fieldType string) bool {
  fields := record.GetFieldsByType(fieldType)
  return len(fields) > 0
}

func main() {
  clientOptions := &ksm.ClientOptions{
    Config: ksm.NewFileKeyValueStorage("ksm-config.json"),
  }
  sm := ksm.NewSecretsManager(clientOptions)

  records, err := sm.GetSecrets([]string{"RECORD_UID"})
  if err != nil {
    fmt.Printf("Error: %v\n", err)
    return
  }

  if len(records) > 0 {
    record := records[0]

    // Check for specific fields
    if hasField(record, "login") {
      login := record.GetFieldValueByType("login")
      fmt.Printf("Login: %s\n", login)
    } else {
      fmt.Println("No login field found")
    }

    if hasField(record, "password") {
      password := record.GetFieldValueByType("password")
      fmt.Printf("Password: %s\n", password)
    }

    if hasField(record, "url") {
      url := record.GetFieldValueByType("url")
      fmt.Printf("URL: %s\n", url)
    }

    // Check for TOTP
    if hasField(record, "oneTimeCode") {
      totpUrl := record.GetFieldValueByType("oneTimeCode")
      if totp, err := ksm.GetTotpCode(totpUrl); err == nil {
        fmt.Printf("TOTP Code: %s (valid for %d seconds)\n",
          totp.Code, totp.TimeLeft)
      }
    }
  }
}
```

## Related Documentation

* [Go SDK Main Documentation](/en/keeperpam/secrets-manager/developer-sdk-library/golang-sdk.md) - SDK initialization, configuration, and operations
* [Keeper Notation](/en/keeperpam/secrets-manager/about/keeper-notation.md) - Advanced field access notation syntax
* [Record Types](/en/keeperpam/secrets-manager/about/field-record-types.md) - Complete list of record types and their fields


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.keeper.io/en/keeperpam/secrets-manager/developer-sdk-library/golang-sdk/record-field-classes.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
