# 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"
      ],
      "availableFilters": [
        "time"
      ],
      "timeColumn": "created_at"
    },
    {
      "name": "messages",
      "availableColumns": [
        "id",
        "brand_id",
        "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"
      ],
      "availableFilters": [
        "time"
      ],
      "timeColumn": "created_at"
    },
    {
      "name": "telephone_calls_inbound",
      "availableColumns": [
        "id",
        "brand_id",
        "ticket_id",
        "assigned_to_user",
        "time_created",
        "time_wait_start",
        "time_assigned",
        "time_ended",
        "time_wrapup_complete"
      ],
      "availableFilters": [
        "time_created"
      ],
      "timeColumn": "time_created"
    }
  ]
}
```

{% 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     |

## 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`


---

# Agent Instructions: 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:

```
GET https://docs.omnidesk.io/omnidesk/raw-data-bi.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
