> 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/raw-data-bi.md).

# Raw data - BI

## Business Intelligence

{% hint style="info" %}
The primary purpose for our raw data endpoint is filling your data warehouse for analytics with Omnidesk data. This will enable integration with BI tools, like powerBI.
{% endhint %}

All these methods require the key-permission: `API_RAW_TABLE_READ`.

## Get available data and columns

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

The index lists all available data through the raw endpoint. See the response tab below for a sample response.

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

```
{
    "type": "item",
    "item": [
        {
            "name": "tickets",
            "availableColumns": [
                "id",
                "brand_id",
                "channel_id",
                "direction",
                "from",
                "to",
                "status",
                "priority",
                "assigned_user_id",
                "assigned_group_id",
                "title",
                "created_at",
                "last_update",
                "grade_by_customer",
                "solved_at",
                "customer_external_id",
                "summary"
            ],
            "availableFilters": [
                "time"
            ],
            "timeColumn": "created_at"
        },
        {
            "name": "messages",
            "availableColumns": [
                "id",
                "brand_id",
                "content",
                "type",
                "direction",
                "user_id_created",
                "customer_id",
                "channel_id",
                "ticket_id",
                "created_at",
                "updated_at",
                "address_from",
                "address_to"
            ],
            "availableFilters": [
                "time"
            ],
            "timeColumn": "created_at"
        },
        {
            "name": "form_field_to_ticket",
            "availableColumns": [
                "id",
                "ticket_id",
                "form_field_id",
                "form_field_value",
                "created_at",
                "form_field_value_text"
            ],
            "availableFilters": [
                "time"
            ],
            "timeColumn": "created_at"
        },
        {
            "name": "user_ticket_opened_history",
            "availableColumns": [
                "id",
                "ticket_id",
                "user_id",
                "opened_at",
                "closed_at"
            ],
            "availableFilters": [
                "time"
            ],
            "timeColumn": "opened_at"
        },
        {
            "name": "ticket_history",
            "availableColumns": [
                "id",
                "ticket_id",
                "item_type",
                "message",
                "by_user_id",
                "item_type_id_before",
                "item_type_id",
                "created_at",
                "by_system_module"
            ],
            "availableFilters": [
                "time"
            ],
            "timeColumn": "created_at"
        },
        {
            "name": "telephone_calls_inbound",
            "availableColumns": [
                "id",
                "brand_id",
                "ticket_id",
                "a_number",
                "b_number",
                "assigned_to_user",
                "time_created",
                "time_wait_start",
                "time_assigned",
                "time_ended",
                "time_wrapup_complete",
                "external_id"
            ],
            "availableFilters": [
                "time_created"
            ],
            "timeColumn": "time_created"
        },
        {
            "name": "telephone_calls",
            "availableColumns": [
                "id",
                "brand_id",
                "ticket_id",
                "a_number",
                "b_number",
                "assigned_to_user",
                "time_created",
                "time_wait_start",
                "time_assigned",
                "time_ended",
                "time_wrapup_complete",
                "external_id",
                "direction"
            ],
            "availableFilters": [
                "time_created",
                "direction"
            ],
            "timeColumn": "time_created"
        },
        {
            "name": "user_status",
            "availableColumns": [
                "id",
                "user_id",
                "session_id",
                "status_id",
                "status_from",
                "status_to",
                "session_last_seen"
            ],
            "availableFilters": [
                "time"
            ],
            "timeColumn": "status_from"
        },
        {
            "name": "chat_sessions",
            "availableColumns": [
                "brand_id",
                "campaign",
                "assigned_to_user",
                "ticket_id",
                "direction",
                "status",
                "time_created",
                "time_wait_start",
                "time_assigned",
                "time_ended",
                "last_url_visited"
            ],
            "availableFilters": [
                "time"
            ],
            "timeColumn": "created_at"
        },
        {
            "name": "survey_data",
            "availableColumns": [
                "id",
                "survey_id",
                "survey_field_id",
                "ticket_id",
                "data_value",
                "created_at"
            ],
            "availableFilters": [
                "time"
            ],
            "timeColumn": "created_at"
        },
        {
            "name": "triggers_requests",
            "availableColumns": [
                "id",
                "ticket_id",
                "trigger_id",
                "processed_at",
                "request_status_code",
                "request_response"
            ],
            "availableFilters": [
                "time",
                "ticket_id",
                "trigger_id",
                "request_status_code"
            ],
            "timeColumn": "processed_at"
        }
    ]
}
```

{% endtab %}
{% endtabs %}

The following raw data is available:

| Available table               |
| ----------------------------- |
| tickets                       |
| messages                      |
| ticket\_history               |
| form\_field\_to\_ticket       |
| user\_ticket\_opened\_history |
| telephone\_calls\_inbound     |
| telephone\_calls              |
| user\_status                  |
| chat\_sessions                |
| survey\_data                  |
| triggers\_requests            |

## Requesting data for a given table

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

The actual data can be fetched with this endpoint. Use the data of the method above to generate a valid URL with valid columns and filters.

#### Path Parameters

| Name      | Type    | Description                                                             |
| --------- | ------- | ----------------------------------------------------------------------- |
| itemStart | integer | The record that should be started at, example: `0`                      |
| itemLimit | integer | Amount of records to return, default: `1000`, max: `5000`               |
| start     | string  | Timestamp of when the data should start, example: `2025-01-01 00:00:00` |
| end       | string  | Timestamp of when the data should end,  example: `2025-02-01 00:00:00`  |
| table     | string  | The table to get the data from, example: `telephone_calls_inbound`      |
| columns   | string  | comma separated list of the columns you want data from                  |

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

```
{
  "type": "itemList",
  "itemStart": 0,
  "itemTotal": 2,
  "itemLimit": 1000,
  "items": [
    {
      "id": 23444,
      "brand_id": 1,
      "ticket_id": 935491,
      "assigned_to_user": 299,
      "time_created": "2020-02-25 18:42:23",
      "time_wait_start": "2020-02-25 18:42:49",
      "time_assigned": "2020-02-25 18:49:56",
      "time_ended": "2020-02-25 18:55:35",
      "time_wrapup_complete": "2020-02-25 18:56:13"
    },
    {
      "id": 23445,
      "brand_id": 2,
      "ticket_id": 939492,
      "assigned_to_user": 0,
      "time_created": "2020-02-25 18:45:57",
      "time_wait_start": "2020-02-25 18:46:09",
      "time_assigned": null,
      "time_ended": "2020-02-25 18:47:16",
      "time_wrapup_complete": null
    }
  ]
}
```

{% endtab %}
{% endtabs %}

In the response tab above there is a result sample of this request for the following sample url: `https://account.omnidesk.com/api/v2/raw/tableData?table=telephone_calls_inbound&columns=id, brand_id,ticket_id,assigned_to_user,time_created,time_wait_start,time_assigned, time_ended,time_wrapup_complete&itemStart=0&start=2020-02-25 00:00:00&end=2020-02-26 00:00:00`
