---
updatedAt: 2025-09-16T01:46:23.000Z
agentTools:
  projectIndex: https://developers.gorgias.com/llms.txt
---

# Create a ticket using API

## Introduction

In this tutorial, we’ll quickly go through one of the most used features by our app partners, creating tickets in Gorgias using API.\
You can learn more about the ticket object [here](https://developers.gorgias.com/reference/the-ticket-object) as we’ll focus more on defining specific parameters depending on the ticket channel you wish to use.

## Step-by-Step Tutorial

## Step 1: Configure the endpoint for the request

As you might already learn from the ticket object section, we’ll be using the tickets endpoint and POST method

```text template
--request POST \`

--url https://your-domain.gorgias.com/api/tickets \

--header 'accept: application/json' \

--header 'content-type: application/json'
```

## Step 2: Authenticate your account

There are different levels of authentication depending on your app usage (private vs public). You can learn more [here](https://developers.gorgias.com/reference/authentication).

## Step 3: Define the request body

We’ll dive a bit deeper into defining the request body for ticket creation calls depending on the channel you wish to use. Here’s an exampled list of available channels through which tickets can be created in Gorgias through the API:

<ul>
<li> aircall</li>
<li> API </li>
<li> Email </li>
<li> Facebook </li>
<li> Facebook-mention </li>
<li> Help-center </li>
<li> Internal-note </li>
<li> Phone </li>
<li> SMS </li>
</ul>

The channels we’ll be focusing on are API, email, chat, phone, and SMS.

Please note that no matter which channel you use, the `messages object` will be required.

Since a ticket in Gorgias cannot be created without a ticket message, the required parameters when creating a ticket via API will depend on the message channel chosen as well.

Also, please check [these guidelines](https://developers.gorgias.com/changelog/stricter-ticket-messages-validation) depending on whether the message under the ticket is incoming/outgoing.

## API Ticket Channel

Required body params for <strong>ticket channel api</strong> and <strong>message channel api</strong> (incoming message):

<ul><li> messages object </li>
<ul> <li> sender object </li>
<ul> <li> id and/or </li>
<li> email </li></ul>
<li> channel - api </li>
<li> via - api </li>
<li> from agent - false </li> </ul>
<li> channel - api </li>
<li> from agent - false </li>
<li> via - api </li></ul>

> 🚧
>
> Please note that if the message channel is set as API, our auto-reply rules won’t trigger for those tickets. Other rule actions such as auto-tag for example, will be triggered properly.\
> Also, rules that should trigger upon specific keywords inside the message body won’t trigger as well unless the <strong>message.stripped\_text</strong> is defined.

Required body params for <strong>ticket channel api</strong> and <strong>message channel email</strong> (incoming message):

<ul><li> messages object</li>
<ul><li> source object </li>
<ul><li> To object </li>
<ul><li> email address</li></ul></ul>
<ul><li> From object </li>
<ul><li> email address</li></ul></ul>
<li> channel - email </li>
<li> from agent - false </li>
<li> via - api/email </li></ul>
<li> channel - api </li>
<li> from agent - false </li>
<li> via - api </li></ul>

Required body params for <strong>ticket channel api</strong> and <strong>message channel internal note</strong> (internal message):

<ul><li> messages object </li>
<ul> <li> sender object </li>
<ul> <li> id and/or </li>
<li> email </li></ul>
<li> channel - internal-note </li>
<li> via - internal-note </li>
<li> from agent - true </li> </ul>
<li> channel - api </li>
<li> from agent - true </li>
<li> via - api </li></ul>

> 🚧
>
> Note that if the sender is not a user in Gorgias, the internal note will be sent from the ‘Gorgias Bot’. If you use an id or an email address of an existing user in Gorgias, it will be shown as sent by that specific user.\
> This will soon be deprecated so we <strong>highly recommend setting the sender as an existing user in Gorgias</strong>.

Request payload example:

```json API
{
     "customer": {
          "email": "barryhalen@yahoo.com"
     },
     "messages": [
          {
               "sender": {
                    "email": "barryhalen@yahoo.com"
               },
               "body_html": "Hello, this is a test ticket! ",
               "body_text": "Hello, this is a test ticket! ",
               "channel": "api",
               "from_agent": false,
               "stripped_text": "Hello, this is a test ticket! ",
               "subject": "Test ticket",
               "via": "api"
          }
     ],
     "meta": {
          "meta": "example"
     },
     "tags": [
          {
               "name": "test"
          }
     ],
     "channel": "api",
     "from_agent": false,
     "status": "open",
     "via": "api"
}
```

## Email ticket channel

Required body params for <strong>ticket channel email</strong> and <strong>message channel email</strong> (incoming message):

<ul><li> messages object</li>
<ul><li> source object </li>
<ul><li> To object </li>
<ul><li> email address</li></ul></ul>
<ul><li> From object </li>
<ul><li> email address</li></ul></ul>
<li> channel - email </li>
<li> from agent - false </li>
<li> via - api/email </li></ul>
<li> channel - email </li>
<li> from agent - false </li>
<li> via - api/email </li></ul>

Request payload example:

```json
{
     "customer": {
          "email": "barryhalen@yahoo.com"
     },
     "messages": [
          {
               "sender": {
                    "email": "barryhalen@yahoo.com"
               },
               "source": {
                    "to": [
                         {
                              "address": "sfbicycles1@gmail.com"
                         }
                    ],
                    "from": {
                         "address": "barryhalen@yahoo.com"
                    }
               },
               "body_html": "Hello, this is a test message! ",
               "body_text": "Hello, this is a test message! ",
               "channel": "email",
               "from_agent": false,
               "via": "api"
          }
     ],
     "meta": {
          "meta_object": "example"
     },
     "tags": [
          {
               "name": "urgent"
          },
          {
               "name": "test"
          }
     ],
     "channel": "email",
     "from_agent": false,
     "subject": "This is a test ticket",
     "via":"api"
}
```

## Phone ticket channel

Required body params for <strong>ticket channel phone</strong> and <strong>message channel phone</strong> (incoming message):

<ul><li> messages object </li>
<ul> <li> sender object </li>
<ul> <li> id and/or </li>
<li> phone number </li></ul>
<li> channel - phone </li>
<li> via - api </li>
<li> from agent - false </li> </ul>
<li> channel - phone </li>
<li> from agent - false </li>
<li> via - api </li></ul>

```json
{
     "customer": {
          "email": "barryhalen@yahoo.com"
     },
     "messages": [
          {
               "source": {
                    "to": [
                         {
                              "address": "+123456789"
                         }
                    ],
                    "from": {
                         "address": "+123456789"
                    },
                    "type": "phone"
               },
               "body_html": "Hello, this is a test phone ticket!  ",
               "body_text": "Hello, this is a test phone ticket!  ",
               "channel": "phone",
               "from_agent": false,
               "stripped_text": "Hello, this is a test phone ticket!  ",
               "via": "api"
          }
     ],
     "meta": {
          "meta": "example"
     },
     "tags": [
          {
               "name": "test"
          }
     ],
     "channel": "phone",
     "from_agent": false,
     "status": "open",
     "via": "api",
     "subject": "Test ticket"
}
```

## SMS ticket channel

Required body params for <strong>ticket channel SMS</strong> and <strong>message channel SMS</strong> (incoming message):

<ul><li> messages object </li>
<ul> <li> sender object </li>
<ul> <li> id and/or </li>
<li> phone number </li></ul>
<li> channel - sms </li>
<li> via - api </li>
<li> from agent - false </li> </ul>
<li> channel - sms </li>
<li> from agent - false </li>
<li> via - api </li></ul>

```json
{
     "customer": {
          "email": "barryhalen@yahoo.com"
     },
     "messages": [
          {
               "source": {
                    "to": [
                         {
                              "address": "+123456789"
                         }
                    ],
                    "from": {
                         "address": "+123456789"
                    },
                    "type": "phone"
               },
               "body_html": "Hello, this is a test phone ticket!  ",
               "body_text": "Hello, this is a test phone ticket!  ",
               "channel": "sms",
               "from_agent": false,
               "stripped_text": "Hello, this is a test phone ticket!  ",
               "via": "api"
          }
     ],
     "meta": {
          "meta": "example"
     },
     "tags": [
          {
               "name": "test"
          }
     ],
     "channel": "sms",
     "from_agent": false,
     "status": "open",
     "via": "api",
     "subject": "Test ticket"
}
```