> 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/contact-forms.md).

# Contact forms

## Create an empty ticket

<mark style="color:green;">`POST`</mark> `https://{{account}}.omnidesk.com/api/v2/ticket`

With this endpoint you create a new empty ticket with the data required. Below you can find an example of how this request can be made. All the values in the double brackets are variables you can adjust for your own purposes.

```
curl --location 'https://{{account}}.omnidesk.com/api/v2/ticket' \
--header 'Content-Type: multipart/form-data' \
--header 'apiKey: {{api-key}}' \
--form 'brandID="{{brand-id}}"' \
--form 'channelID="1"' \
--form 'direction="inbound"' \
--form 'from="{{customer-email}}"' \
--form 'to="{{brand-email}}"' \
--form 'title="{{ticket-title}}"'
```

Additionally, you can also add these optional parameters if needed:

* `fromName` - The name of the customer
* `assignedGroupID` - The group this ticket will be assigned to
* `formID` - The form this ticket will have on it

The response will return the ticket ID in it as well. Make sure you save this, as you need it in the next request.

***

## Create content for the ticket (a message)

<mark style="color:green;">`POST`</mark> `https://{{account}}.omnidesk.com/api/v2/message`

With this endpoint you create a message in the newly created ticket, containing the contact form data itself. For the message parameter, HTML is accepted.

```
curl --location 'https://{{account}}.omnidesk.com/api/v2/message' \
--header 'Content-Type: multipart/form-data' \
--header 'apiKey: {{api-key}}' \
--form 'ticketID="{{id-newly-created-ticket}}"' \
--form 'type="contactform"' \
--form 'message="{{contact-form-message}}"'
```

If this request returns a HTTP code of 200, everything successfully came through and the contact form is now created within Omnidesk.

***

{% hint style="info" %}
You can also attach files to the contact form message by adding the attachments\[] parameter:
{% endhint %}

```
curl --location 'https://{{acount}}.omnidesk.com/api/v2/message' \
--header 'Content-Type: multipart/form-data' \
--header 'apiKey: {{api-key}}' \
--form 'ticketID="{{id-newly-created-ticket}}"' \
--form 'type="contactform"' \
--form 'message="{{contact-form-message}}"' \
--form 'attachments[]=@"{{file-location}}"'
```

Multiple files can also be sent by simply adding the attachments\[] parameter multiple times.


---

# 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/contact-forms.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.
