# Custom fields

Custom fields let you attach arbitrary key-value metadata to contacts. Before setting values, you need to define the field schema in your [organisation settings](https://admin.glu.io).

#### Types of fields

| Type           | Accepts                                 | Example value                                |
| -------------- | --------------------------------------- | -------------------------------------------- |
| `Text`         | Free text string                        | `"Vegetarian"`                               |
| `Number`       | Numeric value                           | `"42"`                                       |
| `Date`         | ISO date string                         | `"2026-04-07"`                               |
| `Boolean`      | `"true"` or `"false"`                   | `"true"`                                     |
| `Email`        | Valid email address                     | `"jane@example.com"`                         |
| `Phone`        | Phone number                            | `"+44 7700 900000"`                          |
| `URL`          | Valid URL                               | `"https://example.com"`                      |
| `Textarea`     | Multi-line text                         | `"Allergic to nuts.\nPrefers ground floor."` |
| `Select`       | One value from predefined options       | `"Gold"`                                     |
| `Multi select` | Multiple values from predefined options | `"Swimming,Spa"`                             |

#### Reading a contact's custom fields

`GET /contacts/{contactId}/custom-fields`

{% code title="" lineNumbers="true" expandable="true" %}

```json
[
  {
    "id": 1,
    "contactId": 1042,
    "fieldName": "dietary_preference",
    "fieldId": 5,
    "fieldLabel": "Dietary Preference",
    "fieldType": "Select",
    "value": "Vegetarian",
    "displayValue": "Vegetarian",
    "typedValue": "Vegetarian",
    "createdAt": "2026-03-15T10:00:00+00:00",
    "updatedAt": "2026-04-01T08:30:00+00:00"
  },
  {
    "id": 2,
    "contactId": 1042,
    "fieldName": "external_crm_id",
    "fieldId": 8,
    "fieldLabel": "External CRM ID",
    "fieldType": "Text",
    "value": "CRM-48291",
    "displayValue": "CRM-48291",
    "typedValue": "CRM-48291",
    "createdAt": "2026-03-15T10:00:00+00:00",
    "updatedAt": "2026-03-15T10:00:00+00:00"
  }
]
```

{% endcode %}

#### Setting a custom field value

`POST /contacts/{contactId}/custom-fields`

Reference the field by its name:

{% code title="" lineNumbers="true" %}

```json
{
  "fieldName": "dietary_preference",
  "value": "Vegan"
}
```

{% endcode %}

The value is validated against the field type — for example, a `Select` field will reject values not in its predefined options, and a `Number` field will reject non-numeric input.

#### Updating a custom field value

`PUT /contacts/{contactId}/custom-fields/{fieldId}`

{% code title="" lineNumbers="true" %}

```json
{
  "value": "Pescatarian"
}
```

{% endcode %}


---

# 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://glu.gitbook.io/docs/concepts/contacts/custom-fields.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.
