> For the complete documentation index, see [llms.txt](https://docs.omnidesk.io/omnidesk/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.omnidesk.io/omnidesk/ticket/form-field.md).

# Using forms

\
Get available forms (list)
--------------------------

<mark style="color:blue;">`GET`</mark> `https://account.omnidesk.com/api/v2/form`

{% tabs %}
{% tab title="200 " %}

```yaml
{
    type: "itemList",
    itemStart: 0,
    itemTotal: 2,
    itemLimit: 15,
    items: [
        {
            id: 1,
            brandName: "Jupiter",
            title: "form1",
            name: "form1"
        },
        {
            id: 2,
            brandName: "Jupiter",
            title: "form2",
            name: "form2"
        }
    ]
}
```

{% endtab %}
{% endtabs %}

## Get all information of a form

<mark style="color:blue;">`GET`</mark> `https://account.omnidesk.com/api/v2/form/1`

No further parameters required in the request. Just specify the form id in the path to get information on the form, like the fields it contains.

{% tabs %}
{% tab title="200 " %}

```yaml
{
    type: "item",
    item: {
        id: 1,
        title: "form1",
        brandID: 1,
        fields: [
            {
                id: 1,
                formID: 1,
                inputType: "select",
                title: "product",
                defaultValue: "",
                required: false,
                formFieldOptionIDCondition: null,
                options: [
                    {
                        id: 2,
                        formFieldID: 1,
                        title: "postpaid",
                        formFieldOptionIDCondition: null
                    },
                    {
                        id: 1,
                        formFieldID: 1,
                        title: "prepaid",
                        formFieldOptionIDCondition: null
                    }
                ]
            },
            {
                id: 2,
                formID: 1,
                inputType: "text",
                title: "title of the product",
                defaultValue: "",
                required: true,
                formFieldOptionIDCondition: 2
            },
            {
                id: 3,
                formID: 1,
                inputType: "select",
                title: "field2",
                defaultValue: "",
                required: false,
                formFieldOptionIDCondition: null,
                options: [
                    {
                        id: 3,
                        formFieldID: 3,
                        title: "prepaid cool",
                        formFieldOptionIDCondition: 1
                    }
                ]
            }
        ]
    }
}
```

{% endtab %}

{% tab title="400 " %}

```yaml
{
    status: "error",
    message: "Form not found."
}
```

{% endtab %}
{% endtabs %}

> This might be the moment you want to create a ticket and specify what type of form you want to use for the ticket. See the ticket documentation. For the next step you can use the ticket ID in the response to save form fields to the ticket.

## Save form field

<mark style="color:orange;">`PUT`</mark> `https://account.omnidesk.com/api/v2/form/saveFormFields`

This endpoint allows you to save content to a form.

#### Request Body

| Name                          | Type    | Description |
| ----------------------------- | ------- | ----------- |
| fields\[1]\['formFieldValue'] | string  | value2      |
| fields\[1]\['formFieldID']    | integer | 15          |
| fields\[0]\['formFieldValue'] | string  | value1      |
| fields\[0]\['formFieldID']    | integer | 12          |
| ticketID                      | integer |             |

{% tabs %}
{% tab title="200 Successfuly saved" %}

```javascript
{
    "type": "result",
    "status": "success",
    "message": "Form field saved."
}
```

{% endtab %}

{% tab title="302 " %}

```
```

{% endtab %}
{% endtabs %}

## Get ticket form field values

<mark style="color:blue;">`GET`</mark> `https://account.omnidesk.com/api/v2/form/getFormForTicket?ticketID=1`

This endpoint will return the form field information from a single ticket.\
The data that was filled in can be found in two different keys:\
\- For select fields (dropdown fields) it can be found under they key "selectedFields"\
\- For other fields (text fields etc) it can be found under the key "values"\
\
For the selectedFields the formFieldID will match the formFieldID's under fields.options.

#### Path Parameters

| Name     | Type    | Description |
| -------- | ------- | ----------- |
| ticketID | integer |             |

{% tabs %}
{% tab title="200 " %}

```javascript
{
    "type": "item",
    "item": {
        "id": 1,
        "title": "Assign to view",
        "brandID": 1,
        "channelID": 0,
        "fields": [
            {
                "id": 1,
                "formID": 1,
                "inputType": "select",
                "title": "Type Klant",
                "defaultValue": "",
                "required": false,
                "formFieldOptionIDCondition": null,
                "fieldOrder": 1,
                "externalCode": null,
                "options": [
                    {
                        "id": 2,
                        "formFieldID": 13,
                        "title": "Bedrijf",
                        "formFieldOptionIDCondition": null
                    },
                    {
                        "id": 3,
                        "formFieldID": 13,
                        "title": "Klant",
                        "formFieldOptionIDCondition": null
                    }
                ]
            },
            {
                "id": 2,
                "formID": 1,
                "inputType": "text",
                "title": "Extra Informatie",
                "defaultValue": "",
                "required": false,
                "formFieldOptionIDCondition": null,
                "fieldOrder": 1,
                "externalCode": null
            }
        ],
        "selectedFields": [
            {
                "id": 1,
                "ticketID": 1,
                "formFieldID": 1,
                "formFieldValue": 2,
                "createdAt": "2020-01-01 12:00:00",
                "formFieldValueText": null
            }
        ],
        "values": [
            {
                "id": 2,
                "ticketID": 1,
                "formFieldID": 2,
                "formFieldValue": null,
                "createdAt": "2020-05-13 13:29:30",
                "formFieldValueText": "Dit is het text gedeelte"
            }
        ]
    }

```

{% endtab %}
{% endtabs %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.omnidesk.io/omnidesk/ticket/form-field.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
