> For the complete documentation index, see [llms.txt](https://developer.tiledesk.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.tiledesk.com/apis/rest-api/events.md).

# Events

You can use the API to get or set event information.

## The Event Model

| Key           | Type   | Description                                                                                        |
| ------------- | ------ | -------------------------------------------------------------------------------------------------- |
| id            | String | The unique identifier for the event which is given by Tiledesk.                                    |
| name          | String | The event name. You can find the standard Tiledesk events [here](/apis/webhooks.md#webhook-events) |
| project\_user | Object | The user who creates the event.                                                                    |
| attributes    | Object | The custom attributes which are set for the event.                                                 |
| createdAt     | String | The time (ISO-8601 date string) when the event was created.                                        |
| updatedAt     | String | The time (ISO-8601 date string) when the event was updated.                                        |
| createdBy     | String | The unique identifier of the row creator                                                           |
| id\_project   | String | The unique identifier of the project                                                               |

## Get all events

<mark style="color:blue;">`GET`</mark> `https://api.tiledesk.com/v3/:project_id/events`

#### Path Parameters

| Name        | Type   | Description                                                                              |
| ----------- | ------ | ---------------------------------------------------------------------------------------- |
| project\_id | string | the Project Id is a unique code assigned to your project when you create it in Tiledesk. |

#### Query Parameters

| Name      | Type   | Description                                                                                                          |
| --------- | ------ | -------------------------------------------------------------------------------------------------------------------- |
| sortField | string | what field to sort the results by.                                                                                   |
| direction | string | <p>sort direction: 1 or -1. Return the results in ascending or descending order.</p><p><em>defaults to desc</em></p> |
| page      | number | what page of results to fetch. defaults to first page.                                                               |

#### Headers

| Name          | Type   | Description                            |
| ------------- | ------ | -------------------------------------- |
| Authorization | string | authorization token. Basic Auth or JWT |

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

```
{
   ...
}
```

{% endtab %}
{% endtabs %}

## Get a event by id

<mark style="color:blue;">`GET`</mark> `https://api.tiledesk.com/v3/:project_id/events/:id`

#### Path Parameters

| Name        | Type   | Description                                                                              |
| ----------- | ------ | ---------------------------------------------------------------------------------------- |
| id          | string | the event identifier                                                                     |
| project\_id | string | The project\_id is a unique code assigned to your project when you create it in Tiledesk |

#### Headers

| Name          | Type   | Description                            |
| ------------- | ------ | -------------------------------------- |
| Authorization | string | authorization token. Basic Auth or JWT |
| Content-Type  | string | use "application/json" value           |

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

```
{  
        ..
}
```

{% endtab %}
{% endtabs %}

## Fire a new custom event and save it

<mark style="color:green;">`POST`</mark> `https://api.tiledesk.com/v3/:project_id/events`

With this endpoint you can fire a custom event. You event name should be

`event.emit.EVENT_NAME`

to correctly identify your custom event. You can find the standard Tiledesk events here

#### Path Parameters

| Name        | Type   | Description                                                                              |
| ----------- | ------ | ---------------------------------------------------------------------------------------- |
| project\_id | string | The project\_id is a unique code assigned to your project when you create it in Tiledesk |

#### Headers

| Name          | Type   | Description                            |
| ------------- | ------ | -------------------------------------- |
| Authorization | string | authorization token. Basic Auth or JWT |
| Content-Type  | string | use "application/json" value           |

#### Request Body

| Name       | Type   | Description                 |
| ---------- | ------ | --------------------------- |
| name       | string | the event name              |
| attributes | object | The event custom attributes |

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

```
{  
        ..
}
```

{% endtab %}
{% endtabs %}
