> ## Documentation Index
> Fetch the complete documentation index at: https://developer.qminder.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Creating an Input Field

> Create a new input field for a location.

To create an input field, send a POST request to `/input-fields`.
The `id` field must be a client-generated UUID.

<CodeGroup>
  ```bash curl theme={null}
  curl -X POST https://api.qminder.com/input-fields \
    -H "X-Qminder-REST-API-Key: YOUR_API_KEY" \
    -H "X-Qminder-API-Version: 2020-09-01" \
    -H "Content-Type: application/json" \
    -d '{
      "id": "550e8400-e29b-41d4-a716-446655440000",
      "location": { "id": 12345 },
      "type": "TEXT",
      "title": "Reason for visit",
      "isMandatoryBeforeAdded": true,
      "isMandatoryBeforeServed": false,
      "isMandatoryInRemoteSignIn": false,
      "isVisibleInWaitingDrawer": true,
      "isVisibleInServingDrawer": true,
      "showInRemoteSignIn": true,
      "visibleForLines": []
    }'
  ```

  ```typescript TypeScript theme={null}
  import { Qminder } from 'qminder-api';
  Qminder.setKey('YOUR_API_KEY');

  await Qminder.Location.createInputField({
    id: '550e8400-e29b-41d4-a716-446655440000',
    location: { id: 12345 },
    type: 'TEXT',
    title: 'Reason for visit',
    isMandatoryBeforeAdded: true,
    isMandatoryBeforeServed: false,
    isMandatoryInRemoteSignIn: false,
    isVisibleInWaitingDrawer: true,
    isVisibleInServingDrawer: true,
    showInRemoteSignIn: true,
    visibleForLines: [],
  });
  ```
</CodeGroup>

**Response:** `201 Created` with an empty body.

## Common Fields

These fields are required for all input field types:

| Field                       | Type          | Description                                                                  |
| --------------------------- | ------------- | ---------------------------------------------------------------------------- |
| `id`                        | string (UUID) | Client-generated UUID for the input field                                    |
| `location`                  | object        | Location reference: `{"id": number}`                                         |
| `type`                      | string        | Field type (see [Field Types](#field-types) below)                           |
| `isMandatoryBeforeAdded`    | boolean       | Must be filled before ticket is added                                        |
| `isMandatoryBeforeServed`   | boolean       | Must be filled before ticket is served                                       |
| `isMandatoryInRemoteSignIn` | boolean       | Must be filled in remote sign-in                                             |
| `isVisibleInWaitingDrawer`  | boolean       | Shown in the waiting drawer                                                  |
| `isVisibleInServingDrawer`  | boolean       | Shown in the serving drawer                                                  |
| `showInRemoteSignIn`        | boolean       | Show in remote sign-in                                                       |
| `visibleForLines`           | array         | Lines this field applies to: `[{"id": number}]`. Empty array means all lines |

## Field Types

The `type` field determines which additional properties are available.

### Built-in Types

**FIRST\_NAME** and **LAST\_NAME** are built-in field types with fixed titles. They have no additional required properties beyond the common fields.

Optional field:

* `isRequiredInAppointments` (boolean) — Whether the field is required when booking appointments. Only available for `LAST_NAME` and `EMAIL` types.

**EMAIL** and **PHONE\_NUMBER** are singleton types — only one of each can exist per location. Attempting to create a second will return a `409` error.

Optional field for `EMAIL`:

* `isRequiredInAppointments` (boolean) — Whether the field is required when booking appointments

### TEXT

A free-form text input field.

| Field                | Type   | Required | Description                                      |
| -------------------- | ------ | -------- | ------------------------------------------------ |
| `title`              | string | Yes      | Display title                                    |
| `visitorFacingTitle` | string | No       | Title shown to visitors                          |
| `translations`       | array  | No       | Translations (see [Translations](#translations)) |

### SELECT

A dropdown selection field with custom options.

| Field                | Type    | Required | Description                                      |
| -------------------- | ------- | -------- | ------------------------------------------------ |
| `title`              | string  | Yes      | Display title                                    |
| `multiSelect`        | boolean | Yes      | Allow multiple selections                        |
| `options`            | array   | Yes      | Array of select options (see below)              |
| `visitorFacingTitle` | string  | No       | Title shown to visitors                          |
| `translations`       | array   | No       | Translations (see [Translations](#translations)) |

Each option in the `options` array:

| Field   | Type          | Required | Description                          |
| ------- | ------------- | -------- | ------------------------------------ |
| `id`    | string (UUID) | Yes      | Client-generated UUID for the option |
| `title` | string        | Yes      | Option display title                 |
| `color` | string        | No       | Option color                         |

**Example — creating a SELECT field:**

<CodeGroup>
  ```bash curl theme={null}
  curl -X POST https://api.qminder.com/input-fields \
    -H "X-Qminder-REST-API-Key: YOUR_API_KEY" \
    -H "X-Qminder-API-Version: 2020-09-01" \
    -H "Content-Type: application/json" \
    -d '{
      "id": "660e8400-e29b-41d4-a716-446655440001",
      "location": { "id": 12345 },
      "type": "SELECT",
      "title": "Service type",
      "multiSelect": false,
      "options": [
        { "id": "770e8400-e29b-41d4-a716-446655440001", "title": "General inquiry" },
        { "id": "770e8400-e29b-41d4-a716-446655440002", "title": "Returns" },
        { "id": "770e8400-e29b-41d4-a716-446655440003", "title": "Pickup" }
      ],
      "isMandatoryBeforeAdded": true,
      "isMandatoryBeforeServed": false,
      "isMandatoryInRemoteSignIn": false,
      "isVisibleInWaitingDrawer": true,
      "isVisibleInServingDrawer": true,
      "showInRemoteSignIn": true,
      "visibleForLines": []
    }'
  ```

  ```typescript TypeScript theme={null}
  import { Qminder } from 'qminder-api';
  Qminder.setKey('YOUR_API_KEY');

  await Qminder.Location.createInputField({
    id: '660e8400-e29b-41d4-a716-446655440001',
    location: { id: 12345 },
    type: 'SELECT',
    title: 'Service type',
    multiSelect: false,
    options: [
      { id: '770e8400-e29b-41d4-a716-446655440001', title: 'General inquiry' },
      { id: '770e8400-e29b-41d4-a716-446655440002', title: 'Returns' },
      { id: '770e8400-e29b-41d4-a716-446655440003', title: 'Pickup' },
    ],
    isMandatoryBeforeAdded: true,
    isMandatoryBeforeServed: false,
    isMandatoryInRemoteSignIn: false,
    isVisibleInWaitingDrawer: true,
    isVisibleInServingDrawer: true,
    showInRemoteSignIn: true,
    visibleForLines: [],
  });
  ```
</CodeGroup>

### URL

A URL input field.

| Field   | Type   | Required | Description   |
| ------- | ------ | -------- | ------------- |
| `title` | string | Yes      | Display title |

<Note>URL fields cannot be shown in remote sign-in — `showInRemoteSignIn` is always treated as `false`.</Note>

### DATE

A date input field.

| Field                | Type   | Required | Description                                      |
| -------------------- | ------ | -------- | ------------------------------------------------ |
| `title`              | string | Yes      | Display title                                    |
| `visitorFacingTitle` | string | No       | Title shown to visitors                          |
| `translations`       | array  | No       | Translations (see [Translations](#translations)) |

### NUMERIC

A numeric input field with optional constraints.

| Field                | Type   | Required | Description                                      |
| -------------------- | ------ | -------- | ------------------------------------------------ |
| `title`              | string | Yes      | Display title                                    |
| `visitorFacingTitle` | string | No       | Title shown to visitors                          |
| `constraints`        | object | No       | Min/max constraints (see below)                  |
| `translations`       | array  | No       | Translations (see [Translations](#translations)) |

The `constraints` object:

| Field   | Type    | Required | Description              |
| ------- | ------- | -------- | ------------------------ |
| `min`   | number  | No       | Minimum allowed value    |
| `max`   | number  | No       | Maximum allowed value    |
| `scale` | integer | Yes      | Number of decimal places |

**Example — creating a NUMERIC field with constraints:**

<CodeGroup>
  ```bash curl theme={null}
  curl -X POST https://api.qminder.com/input-fields \
    -H "X-Qminder-REST-API-Key: YOUR_API_KEY" \
    -H "X-Qminder-API-Version: 2020-09-01" \
    -H "Content-Type: application/json" \
    -d '{
      "id": "880e8400-e29b-41d4-a716-446655440001",
      "location": { "id": 12345 },
      "type": "NUMERIC",
      "title": "Amount",
      "constraints": {
        "min": 0,
        "max": 10000,
        "scale": 2
      },
      "isMandatoryBeforeAdded": false,
      "isMandatoryBeforeServed": true,
      "isMandatoryInRemoteSignIn": false,
      "isVisibleInWaitingDrawer": true,
      "isVisibleInServingDrawer": true,
      "showInRemoteSignIn": false,
      "visibleForLines": []
    }'
  ```

  ```typescript TypeScript theme={null}
  import { Qminder } from 'qminder-api';
  Qminder.setKey('YOUR_API_KEY');

  await Qminder.Location.createInputField({
    id: '880e8400-e29b-41d4-a716-446655440001',
    location: { id: 12345 },
    type: 'NUMERIC',
    title: 'Amount',
    constraints: {
      min: 0,
      max: 10000,
      scale: 2,
    },
    isMandatoryBeforeAdded: false,
    isMandatoryBeforeServed: true,
    isMandatoryInRemoteSignIn: false,
    isVisibleInWaitingDrawer: true,
    isVisibleInServingDrawer: true,
    showInRemoteSignIn: false,
    visibleForLines: [],
  });
  ```
</CodeGroup>

## Translations

The following field types support translations: `TEXT`, `SELECT`, `URL`, `DATE`, and `NUMERIC`.

Each translation object:

| Field                | Type   | Required | Description                           |
| -------------------- | ------ | -------- | ------------------------------------- |
| `languageCode`       | string | Yes      | Language code (e.g. "fr", "es", "de") |
| `title`              | string | No       | Translated field title                |
| `visitorFacingTitle` | string | No       | Translated visitor-facing title       |

```json theme={null}
{
  "translations": [
    { "languageCode": "fr", "title": "Raison de la visite", "visitorFacingTitle": "Votre raison" },
    { "languageCode": "es", "title": "Motivo de la visita" }
  ]
}
```

## Error Responses

| Status | Code                         | Description                                                  |
| ------ | ---------------------------- | ------------------------------------------------------------ |
| 400    | `duplicate_items_in_request` | SELECT options have duplicate titles                         |
| 400    | `parameter_invalid_blank`    | Translation title or visitor-facing title is blank           |
| 400    | Bad request                  | Missing `type` field or invalid request body                 |
| 404    | `resource_missing`           | Location not found                                           |
| 409    | `input_field_duplicate`      | Input field with the same ID already exists                  |
| 409    | `input_field_duplicate`      | EMAIL or PHONE\_NUMBER field already exists in this location |
