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

# v2

## Danh sách

<mark style="color:blue;">`POST`</mark>`[URL]`/api/v2/callTransaction/search

Lấy danh sách lịch sử cuộc gọi

<mark style="color:$primary;">\*</mark> <mark style="color:$primary;">Tạm dừng cập nhật từ ngày 01/04/2026, vui lòng sử dụng</mark> [<mark style="color:$primary;">API v3</mark>](https://api.omicall.com/omicall-api/call-transaction/v2#danh-sach-v3)

#### Path Parameters

| Name | Type    | Description                                              |
| ---- | ------- | -------------------------------------------------------- |
| page | integer | Thứ tự phân trang, bắt đầu bằng 1                        |
| size | int     | Giới hạn số lượng phân tử của danh sách trả về, max = 50 |

#### Request Body

| Name                  | Type    | Description                                                  |
| --------------------- | ------- | ------------------------------------------------------------ |
| fromDate              | long    | Thời gian bắt đầu                                            |
| toDate                | long    | Thời gian kết thúc                                           |
| directions            | array   | Hướng cuộc gọi gồm: outbound, inbound, local                 |
| tagIds                | array   | Danh sách ID của tag cần lọc                                 |
| sipNumbers            | array   | Danh sách đầu số                                             |
| sipUsers              | array   | Danh sách số nội bộ của nhân viên                            |
| phoneNumbers          | array   | Danh sách số điện thoại khách hàng                           |
| transactionIds        | array   | Danh sách call UUID của cuộc gọi                             |
| agentEmails           | array   | Danh sách email của nhân viên thực hiện cuộc gọi             |
| agentUuids            | array   | Danh sách UUID nhân viên, không kết hợp lọc cùng agentEmails |
| isAutoCall            | Boolean | Lọc cuộc gọi tự động                                         |
| isCallBot             | Boolean | Lọc cuộc gọi voiceBot                                        |
| autoCallIds           | array   | Danh sách ID phiên gọi tự động thường hoặc voiceBot          |
| isAnswer              | Boolean | Lọc cuộc gọi có trả lời                                      |
| queueDestinations     | array   | Danh sách nhóm nội bộ                                        |
| outerGroups           | array   | Danh sách nhóm ngoài                                         |
| keyInteractiveScripts | array   | Danh sách số nội bộ của kịch bản tương tác phím              |
| keyword               | String  | Từ khóa tìm kiếm lớn hơn 3 ký tự                             |
| sortField             | String  | Field cần sort                                               |
| sortAsc               | Boolean | Thứ tự sort                                                  |

#### Headers

| Name          | Type   | Description                  |
| ------------- | ------ | ---------------------------- |
| Content-type  | string | application/json             |
| Authorization | string | Access Token: Bearer 'token' |

{% tabs %}
{% tab title="200 Danh sách cuộc gọi" %}

```

{
    "instance_id": "stg",
    "payload": {
        "items": [
            {
                "transaction_id": "", //Call UUID cuộc gọi
                "tenant_id": "", //ID của DN
                "direction": "outbound", //Hướng gọi
                "source_number": "xxx", //Số nguồn
                "destination_number": "xxx", //Số đích
                "bill_sec": 5, //Thời lượng cuộc gọi
                "record_seconds": 3, //Thời lượng file ghi âm
                "time_start_call": 1776849067, // Thời gian bắt đầu cuộc gọi
                "time_answer_start": 1776849073, // Thời gian bắt đầu trả lời
                "time_end_call": 1776849079, // Thời gian kết thúc cuộc gọi
                "time_ringing_start": 1776849073, // Thời gian bắt đầu đổ chuông cho nhân viên
                "recording_file": "",
                "recording_file_url": "", //Link file ghi âm
                "recording_data": null,
                "sip_user": "999", //Số nội bộ nhân viên thực hiện
                "created_date": 1729870397069, //Ngày tạo
                "last_updated_date": 1730788680689, //Ngày cập nhật
                "is_auto_call": false, //Cờ đánh dấu cuộc gọi tự động
                "ivr": "none",
                "provider": "viettel", //Nhà mạng số điện thoại KH
                "duration": 10, //Tổng thời gian
                "user": [ //Thông tin nhân viên liên quan đến cuộc gọi
                    {
                        "full_name": "DEV ZONE",
                        "full_name_unsigned": "DEV ZONE",
                        "note": null,
                        "tag": null
                    },
                    {
                        "full_name": "DEV ZONE",
                        "full_name_unsigned": "dev zone",
                        "note": "OMIDEV",
                        "tag": [
                            {
                                "name": "ATC_01"
                            }
                        ]
                    }
                ],
                "customer": {//Thông tin khách hàng
                    "full_name": "Trần Đình Tâm",
                    "full_name_unsigned": "tran dinh tam"
                },
                "state": null,
                "call_uuid": null,
                "from_number": null,
                "to_number": null,
                "hotline": null,
                "is_have_forward_out": false,
                "bill_sec_forward_out": 0,
                "call_out_price": 66.000, //Cước gọi
                "note": null, //Thông tin ghi chú cuộc gọi
                "tag": [ //Danh sách ID tag cuộc gọi
                    "63c0bb010748c865ba321c53"
                ],
                "invite_failure_status": null,
                "answer_sec": 3, //Thời gian trả lời
                "autocall_uuid": null, //Mã UUID mapping thông tin chi tiết cuộc gọi auto call
                "autocall_id": null, //ID phiên gọi auto call
                "sip_number": "842499950291", //Đầu số
                "phone_number": "0983223566", //Số điện thoại khách hàng
                "create_by": { //Nhân viên thực hiện cuộc gọi
                    "id": "60e79bd864b64271a923affe",
                    "name": "DEV ZONE",
                    "contact_id": "60e79beb1b20043c4e7a68af",
                    "avatar": null,
                    "gender": null,
                    "uuid": null,
                    "type": "agent"
                },
                "transfer_histories": [], //Danh sách luồng cuộc gọi
                "user_data_str": null,
                "user_ref_code": null,
                "endby_name": "end_call_by_customer", //Nguyên nhân tắt máy
                "hangup_cause": "NORMAL_CLEARING",
                "sip_hangup_disposition": "send_bye",
                "hangup_cause_q850": 16,
                "is_voicemail": false, //Cờ đánh dấu cuộc gọi vào hộp thư thoại
                "recording_file_voicemail": null,
                "domain_fusion": "omicalltest1",
                "send_num_retry": 0,
                "out_of_working_time": true,
                "sip_number_tags": [],
                "evaluations": null,
                "total_evaluate": null,
                "internal_destination": null,
                "classifies": null,
                "collect_info_variables": null //Danh sách kết quả thu thập cuộc gọi voice bot
            }
        ],
        "page_number": 1,
        "page_size": 50,
        "total_items": 1,
        "total_pages": 1,
        "has_next": false,
        "next_page": 1,
        "has_previous": false,
        "previous_page": 1,
        "extension": null
    },
    "instance_version": "1.2.164",
    "key_enabled": false,
    "status_code": 9999
}

```

{% endtab %}
{% endtabs %}

<table data-header-hidden><thead><tr><th width="229">Mã Lỗi</th><th>Mô tả</th></tr></thead><tbody><tr><td>Mã Lỗi</td><td>Mô tả</td></tr><tr><td><em>missing_time_query</em></td><td>Thiếu bộ lọc thời gian</td></tr><tr><td><em>date_is_too_long</em></td><td>Khoảng cách thời gian quá lớn, giới hạn trong 3 tháng gần nhất</td></tr><tr><td><em>email_agent_not_found</em></td><td>Bộ lọc email nhân viên không đúng hoặc không có giữ liệu nhân viên</td></tr><tr><td><em>uuid_agent_not_found</em></td><td>Bộ lọc agentUuids không đúng hoặc không có giữ liệu nhân viên </td></tr></tbody></table>

## Danh sách (v3)

<mark style="color:blue;">`POST`</mark>`[URL]/api/v3/call-transaction/search?page=1&size=50`

Lấy danh sách lịch sửa cuộc gọi

#### Request Parameters

| Name | Type    | Description                                              |
| ---- | ------- | -------------------------------------------------------- |
| page | Integer | Thứ tự phân trang, bắt đầu bằng 1                        |
| size | Integer | Giới hạn số lượng phân tử của danh sách trả về, max = 50 |

#### Request Body

| Name                                              | Type    | Description                                         |
| ------------------------------------------------- | ------- | --------------------------------------------------- |
| filter.fromDate<mark style="color:red;">\*</mark> | Long    | Thời gian bắt đầu                                   |
| filter.toDate<mark style="color:red;">\*</mark>   | Long    | Thời gian kết thúc                                  |
| filter.directions                                 | Array   | Hướng cuộc gọi gồm: outbound, inbound, local        |
| filter.tagIds                                     | Array   | Danh sách ID của tag cần lọc                        |
| filter.sipNumbers                                 | Array   | Danh sách đầu số                                    |
| filter.sipUsers                                   | Array   | Danh sách số nội bộ của nhân viên                   |
| filter.phoneNumbers                               | Array   | Danh sách số điện thoại khách hàng                  |
| filter.transactionIds                             | Array   | Danh sách call UUID của cuộc gọi                    |
| filter.agentIds                                   | Array   | Danh sách id của nhân viên thực hiện cuộc gọi       |
| filter.isAutoCall                                 | Boolean | Lọc cuộc gọi tự động                                |
| filter.isCallBot                                  | Boolean | Lọc cuộc gọi voiceBot                               |
| filter.autoCallIds                                | Array   | Danh sách ID phiên gọi tự động thường hoặc voiceBot |
| filter.isAnswer                                   | Boolean | Lọc cuộc gọi có trả lời                             |
| filter.queueDestinations                          | Array   | Danh sách nhóm nội bộ                               |
| filter.outerGroups                                | Array   | Danh sách nhóm ngoài                                |
| filter.keyInteractiveScripts                      | Array   | Danh sách số nội bộ của kịch bản tương tác phím     |
| sort.field                                        | String  | Field cần sort                                      |
| sort.isAsc                                        | Boolean | Thứ tự sort                                         |

#### Headers

| Name                                        | Type   | Description      |
| ------------------------------------------- | ------ | ---------------- |
| Content-type                                | String | application/json |
| x-api-key<mark style="color:red;">\*</mark> | String | API Key          |

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

```json
{
    "items": [
      {
        "transaction_id": "13a09408-db5d-49a0-b262-4100b2718836", // unique id của cuộc gọi
        "tenant_id": "6487dbe6572b7b17fcc8e511",
        "direction": "outbound", // hướng cuộc gọi
        "source_number": "84123456778",  // đầu số gọi đi
        "destination_number": "0234567891", // đầu số nhận cuộc gọi
        "disposition": "answered", // trạng thái trả lời
        "bill_sec": 90,
        "time_start_call": 1776849067, // Thời gian bắt đầu cuộc gọi
        "time_answer_start": 1776849073, // Thời gian bắt đầu trả lời
        "time_end_call": 1776849079, // Thời gian kết thúc cuộc gọi
        "time_ringing_start": 1776849073, // Thời gian bắt đầu đổ chuông cho nhân viên
        "record_seconds": 88,
        "recording_file": "https://4100b2718836.mp3",
        "recording_file_url": "https://4100b2718836",
        "recording_data": null,
        "sip_user": "100",
        "created_date": 1773139222456,
        "last_updated_date": 1773139405421,
        "is_auto_call": false,
        "ivr": "none",
        "provider": "mobifone", // nhà mạng
        "duration": 97, // thời lượng cuộc gọi (second)
        "user": [
          {
            "full_name"         : "nhanvien1",
            "full_name_unsigned": "nhanvien1",
            "note"              : null,
            "tag"               : null
          }
        ],
        "customer": {
          "_id"               : "66602774ec7f2b235cad1a3d",
          "full_name"         : "Vihat",
          "full_name_unsigned": "vihat"
        },
        "state": null,
        "call_uuid": null,
        "from_number": null,
        "to_number": null,
        "hotline": null,
        "is_have_forward_out": false,
        "bill_sec_forward_out": 0,
        "call_out_price": 900.000,
        "note": null,
        "tag": [],
        "invite_failure_status": null,
        "answer_sec": 88,
        "autocall_uuid": null,
        "autocall_id": null,
        "sip_number": "84123456778", // đầu số
        "phone_number": "0234567891", // số điện thoại khách hàng
        "create_by": { // thông tin nhân viên thực hiện hoặc nhận cuộc gọi
          "id"        : "6487dbe7572b7b17fcc8e514",
          "name"      : "nhanvien1",
          "contact_id": "6487dbeb1a309849f72056ad", // id nhân viên
          "avatar"    : null,
          "gender"    : null,
          "uuid"      : null,
          "type"      : "agent"
        },
        "transfer_histories": [],
        "user_data_str": null,
        "user_ref_code": null,
        "endby_name": "end_call_by_customer",
        "hangup_cause": "NORMAL_CLEARING",
        "sip_hangup_disposition": "send_bye",
        "hangup_cause_q850": null,
        "is_voicemail": false,
        "recording_file_voicemail": null,
        "domain_fusion": "test",
        "send_num_retry": 0,
        "out_of_working_time": true,
        "sip_number_tags": [],
        "evaluations": null,
        "total_evaluate": null,
        "internal_destination": null,
        "classifies": null,
        "collect_info_variables": null,
        "sip_number_forward_out": null,
        "is_same_network": false,
        "is_same_network_forward_out": false,
        "provider_of_number": "itel",
        "provider_of_number_forward_out": null,
        "callbot_script_id": null,
        "criteria": null,
        "users_status": null,
        "call_stacks": [
          {
            "from": "100",
            "to": "0234567891",
            "sip_number": "84123456778",
            "phone_number": "0234567891",
            "type": "external",
            "at": 1773139126018,
            "bye_at": 1773139222118,
            "index": 1,
            "is_answer": false
          }
        ],
        "call_script": null,
        "hold_call_sec": 0
      }
    ],
    "page_number": 1,
    "page_size": 50,
    "total_items": 201,
    "total_pages": 5,
    "has_next": true,
    "next_page": 2,
    "has_previous": false,
    "previous_page": 1,
    "extension": null,
    "max_size": null
}
```

{% endtab %}

{% tab title="400 Bad Request" %}

```json
{
    "message": "missing_time_query", // mã lỗi
    "status_code": 400,
    "timestamp": 1773334799999
}
```

{% endtab %}

{% tab title="Sampe request body" %}

```json
{
    "filter": {
        "fromDate": 1772557200000,
        "toDate": 1773334799999
    },
    "sort": {
        "field": "created_date",
        "isAsc": false
    }
}
```

{% endtab %}
{% endtabs %}

<table data-header-hidden><thead><tr><th width="229">Mã Lỗi</th><th>Mô tả</th></tr></thead><tbody><tr><td>Mã Lỗi</td><td>Mô tả</td></tr><tr><td><em>missing_time_query</em></td><td>Thiếu bộ lọc thời gian</td></tr><tr><td><em>date_is_too_long</em></td><td>Khoảng cách thời gian quá lớn, giới hạn trong 3 tháng gần nhất</td></tr><tr><td><em>email_agent_not_found</em></td><td>Bộ lọc email nhân viên không đúng hoặc không có giữ liệu nhân viên</td></tr><tr><td><em>uuid_agent_not_found</em></td><td>Bộ lọc agentUuids không đúng hoặc không có giữ liệu nhân viên </td></tr><tr><td><em>internal_server_error</em></td><td>Lỗi hệ thống</td></tr></tbody></table>

## Chi tiết cuộc gọi

<mark style="color:blue;">`POST`</mark>`[URL]`/api/v2/callTransaction/getByTransactionId

Lấy thông tin chi tiết cuộc gọi

#### Request Body

| Name          | Type   | Description        |
| ------------- | ------ | ------------------ |
| transactionId | String | Call UUID cuộc gọi |

#### Headers

| Name          | Type   | Description                  |
| ------------- | ------ | ---------------------------- |
| Content-type  | string | application/json             |
| Authorization | string | Access token: Bearer 'token' |

{% tabs %}
{% tab title="200 Yêu cầu thành công" %}

```
{
    "instance_id": "stg",
    "payload": {
        "transaction_id": "", //Call UUID cuộc gọi
        "tenant_id": "", //ID của DN
        "direction": "outbound", //Hướng gọi
        "source_number": "xxx", //Số nguồn
        "destination_number": "xxx", //Số đích
        "bill_sec": 5, //Thời lượng cuộc gọi
        "time_start_call": 1776849067, // Thời gian bắt đầu cuộc gọi
        "time_answer_start": 1776849073, // Thời gian bắt đầu trả lời
        "time_end_call": 1776849079, // Thời gian kết thúc cuộc gọi
        "time_ringing_start": 1776849073, // Thời gian bắt đầu đổ chuông cho nhân viên
        "record_seconds": 3, //Thời lượng file ghi âm
        "recording_file": "",
        "recording_file_url": "", //Link file ghi âm
        "recording_data": null,
        "sip_user": "999", //Số nội bộ nhân viên thực hiện
        "created_date": 1729870397069, //Ngày tạo
        "last_updated_date": 1730788680689, //Ngày cập nhật
        "is_auto_call": false, //Cờ đánh dấu cuộc gọi tự động
        "ivr": "none",
        "provider": "viettel", //Nhà mạng số điện thoại KH
        "duration": 10, //Tổng thời gian
        "user": [ //Thông tin nhân viên liên quan đến cuộc gọi
            {
                "full_name": "DEV ZONE",
                "full_name_unsigned": "DEV ZONE",
                "note": null,
                "tag": null
            },
            {
                "full_name": "DEV ZONE",
                "full_name_unsigned": "dev zone",
                "note": "OMIDEV",
                "tag": [
                    {
                        "name": "ATC_01"
                    }
                ]
            }
        ],
        "customer": {//Thông tin khách hàng
            "full_name": "Trần Đình Tâm",
            "full_name_unsigned": "tran dinh tam"
        },
        "state": null,
        "call_uuid": null,
        "from_number": null,
        "to_number": null,
        "hotline": null,
        "is_have_forward_out": false,
        "bill_sec_forward_out": 0,
        "call_out_price": 66.000, //Cước gọi
        "note": null, //Thông tin ghi chú cuộc gọi
        "tag": [ //Danh sách ID tag cuộc gọi
            "63c0bb010748c865ba321c53"
        ],
        "invite_failure_status": null,
        "answer_sec": 3, //Thời gian trả lời
        "autocall_uuid": null, //Mã UUID mapping thông tin chi tiết cuộc gọi auto call
        "autocall_id": null, //ID phiên gọi auto call
        "sip_number": "842499950291", //Đầu số
        "phone_number": "0983223566", //Số điện thoại khách hàng
        "create_by": { //Nhân viên thực hiện cuộc gọi
            "id": "60e79bd864b64271a923affe",
            "name": "DEV ZONE",
            "contact_id": "60e79beb1b20043c4e7a68af",
            "avatar": null,
            "gender": null,
            "uuid": null,
            "type": "agent"
        },
        "transfer_histories": [], //Danh sách luồng cuộc gọi
        "user_data_str": null,
        "user_ref_code": null,
        "endby_name": "end_call_by_customer", //Nguyên nhân tắt máy
        "hangup_cause": "NORMAL_CLEARING",
        "sip_hangup_disposition": "send_bye",
        "hangup_cause_q850": 16,
        "is_voicemail": false, //Cờ đánh dấu cuộc gọi vào hộp thư thoại
        "recording_file_voicemail": null,
        "domain_fusion": "omicalltest1",
        "send_num_retry": 0,
        "out_of_working_time": true,
        "sip_number_tags": [],
        "evaluations": null,
        "total_evaluate": null,
        "internal_destination": null,
        "classifies": null,
        "collect_info_variables": null //Danh sách kết quả thu thập cuộc gọi voice bot
            },
        "call_stacks": [
             {
                "from": "0909689867", // Vị trí khởi tạo của leg call (stack)
                "to": "70759-118", //Nhân viên thuộc nhóm nội bộ
                "phone_number": "0909689867", //Số điện thoại khách hàng
                "type": "criteria-script", //Tiêu chí
                "at": 1757408394, //Thời điểm cuộc gọi đi vào nhánh
                "ringing_at": 1757408394, //Thời điểm cuộc gọi bắt đầu ring đến user
                "answer_at": 1757408400, //Thời điểm user bắt máy
                "bye_at": 1757408408, //Thời điểm kết thúc nhánh (stack)
                "index": 1,
                "is_answer": true, //Trạng thái trả lời
                "is_online": true, //Trạng thái trực tuyến
                "is_busy": false, //Trạng thái bận (user đang trong cuộc gọi khác)
                "is_dnd": false, //Trạng thái không làm phiền
                "timeout": 30
            },
    "instance_version": "1.2.164",
    "key_enabled": false,
    "status_code": 9999
}
```

{% endtab %}
{% endtabs %}

## Cập nhật thông tin cuộc gọi

<mark style="color:green;">`POST`</mark> `[URL]/api/call_transaction/change/:transaction_id`

\- Cập nhật các thông tin bổ sung cho lịch sử cuộc gọi

#### Path Parameters

| Name            | Type   | Description |
| --------------- | ------ | ----------- |
| transaction\_id | string | Id cuộc gọi |

#### Headers

| Name          | Type   | Description                  |
| ------------- | ------ | ---------------------------- |
| Content-type  | string | application/json             |
| Authorization | string | Access token: Bearer 'token' |

#### Request Body

| Name | Type   | Description                                                                                                |
| ---- | ------ | ---------------------------------------------------------------------------------------------------------- |
| tag  | array  | <p>Danh sách Tag được gán với lịch sử cuộc gọi <br>Ví dụ : <code>tag : \["hailong","goilaisau"]</code></p> |
| note | string | Ghi chú cuộc gọi                                                                                           |

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

```
{
    "status_code": 9999,
    "payload": {
        "transaction_id": "91d3e842-9da2-43ec-8bb1-979c17e817ad",
        "direction": "outbound",
        "source_number": "842727777787",
        "destination_number": "0979816773",
        "disposition": "answered",
        "bill_sec": 232,
        "record_seconds": 232,
        "time_start_to_answer": 1589015432,
        "recording_file": "https://drive.google.com/uc?id=1Jry_LGzQM....",
        "sip_user": "101",
        "created_date": 1589015675440,
        "last_updated_date": 1589015678726,
        "ivr": "none",
        "note": null,
        "provider": "viettel",
        "note": "Ghi chu cuoc goi",
        "tag":["hailong","dongy","vip"],
        "duration": 242,
        "user": [
            {
                "full_name": "TestBoss 123",
                "full_name_unsigned": "TestBoss 123",
                "note": "Ghi chu cuoc goi",
                "tag" :[ // Danh sách thẻ tag cuộc gọi
                    {"name": "hailong"},
                    {"name": "dongy"},
                    {"name": "vip"}
                ]
            }
        ],
        "customer": {
            "full_name": "Trần Văn Tiến 1",
            "full_name_unsigned": "Tran Van Tien 1"
        }
    }
}
```

{% endtab %}
{% endtabs %}

## Danh sách tiêu chí đánh giá cuộc gọi

<mark style="color:blue;">`GET`</mark> `[URL]/api/evaluation_criteria/call/list`

<mark style="color:$primary;">\*</mark> <mark style="color:$primary;">Tạm dừng cập nhật từ ngày 01/04/2026, vui lòng sử dụng</mark> [<mark style="color:$primary;">API v3</mark>](https://api.omicall.com/omicall-api/call-transaction/v2#danh-sach-tieu-chi-danh-gia-cuoc-goi-v3)

#### Headers

<table><thead><tr><th>Name</th><th>Type</th><th width="250">Description</th></tr></thead><tbody><tr><td>Authorization<mark style="color:red;">*</mark></td><td>String</td><td>Access token: Bearer 'token'</td></tr></tbody></table>

## Danh sách tiêu chí đánh giá cuộc gọi (v3)

<mark style="color:blue;">`GET`</mark> `[URL]/api/v3/call-transaction/evaluation-criteria/list`

Lấy danh sách tiêu chí đánh giá cuộc gọi

#### Headers

<table><thead><tr><th>Name</th><th>Type</th><th width="250">Description</th></tr></thead><tbody><tr><td>x-api-key<mark style="color:red;">*</mark></td><td>String</td><td>API Key</td></tr></tbody></table>

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

```json
[
        {
            "_id": "69b0f739ff79726b819d7915", // id tiêu chí
            "name": "Chất lượng cuộc gọi" // tên tiêu chí
        }
]
```

{% endtab %}
{% endtabs %}

## Lấy danh sách chi tiết lịch sử cuộc gọi

<mark style="color:green;">`POST`</mark> `https://public-v1-stg.omicall.com/api/call_transaction/search`

Danh sách chi tiết lịch sử cuộc gọi, lấy chi tiết rút gọn

<mark style="color:$primary;">\*</mark> <mark style="color:$primary;">Tạm dừng cập nhật từ ngày 01/04/2026, vui lòng sử dụng</mark> [<mark style="color:$primary;">API v3</mark>](https://api.omicall.com/omicall-api/call-transaction/v2#danh-sach-v3)

Dữ liệu Body truyền lên dưới định dạng JSON. Ví dụ:

{

&#x20; "from\_date" : 1693846799000,

&#x20; "to\_date" : 1696438799000,

&#x20; "user\_uuids" : \["0123456789"]

}

#### Path Parameters

| Name | Type | Description                          |
| ---- | ---- | ------------------------------------ |
| page | int  | Page cần get (= 1)                   |
| size | int  | Số phần tử trong trang (max 50 item) |

#### Headers

| Name                                           | Type   | Description      |
| ---------------------------------------------- | ------ | ---------------- |
| x-api-key<mark style="color:red;">\*</mark>    | String | API key          |
| Content-Type<mark style="color:red;">\*</mark> | String | application/json |

#### Request Body

| Name                                          | Type          | Description                                                |
| --------------------------------------------- | ------------- | ---------------------------------------------------------- |
| from\_date<mark style="color:red;">\*</mark>  | String        | Thời gian bắt đầu lấy log (milisecond)                     |
| to\_date<mark style="color:red;">\*</mark>    | String        | Thời gian kết thúc lấy log (milisecond)                    |
| user\_uuids<mark style="color:red;">\*</mark> | List\<String> | Danh sách user UUID                                        |
| direction                                     | List\<String> | Hướng gọi ("inbound", "outbound", "local")                 |
| disposition                                   | List\<String> | Trạng thái trả lời/không trả lời ("answered", "cancelled") |
| tags                                          | List\<String> | Danh sách ID tags                                          |
| numbers                                       | List\<String> | Danh sách đầu số                                           |

{% tabs %}
{% tab title="200: OK Dữ liệu trả về thành công (JSON format)" %}

```json
// sample data
{
  "instance_id": "stg",
  "payload": {
    "items": [
      {
        "_id": "123400000000000000000000",
        "created_date": 946659600000,
        "last_updated_date": 946659600000,
        "create_by": {
          "id": "123400000000000000000000",
          "name": "Lorem ipsum dolor sit amet.",
          "contact_id": "123400000000000000000000",
          "type": "agent",
          "extension": "0123456"
        },
        "tenant_id": "123400000000000000000000",
        "transaction_id": "7125081d-288a-4d35-8eb1-012345678912",
        "direction": "local",
        "source_number": "0123456",
        "destination_number": "0123456",
        "disposition": "cancelled",
        "duration": 28,
        "bill_sec": 0,
        "record_seconds": 0,
        "time_start_call": 1776849067, // Thời gian bắt đầu cuộc gọi
        "time_answer_start": 1776849073, // Thời gian bắt đầu trả lời
        "time_end_call": 1776849079, // Thời gian kết thúc cuộc gọi
        "time_ringing_start": 1776849073, // Thời gian bắt đầu đổ chuông cho nhân viên
        "time_start_media": 9466596000,
        "wait_sec": 0,
        "hold_call_sec": 0,
        "hangup_cause": "ORIGINATOR_CANCEL",
        "hangup_cause_q850": 16,
        "customer": {
          "_id": "649e981afd4c703b39692f5f",
          "full_name": "Lorem ipsum dolor sit amet.",
          "full_name_unsigned": "Lorem ipsum dolor sit amet.",
          "uuid": "0123456789",
          "type": "extension",
          "extension": "0123456"
        },
        "user": [
          {
            "_id": "123400000000000000000000",
            "full_name": "Lorem ipsum dolor sit amet.",
            "full_name_unsigned": "Lorem ipsum dolor sit amet.",
            "tags_view": [],
            "note_created_date": 1696421425598
          }
        ],
        "sip_user": "0123456",
        "is_stop_ivr": false,
        "ivr": "none",
        "is_have_forward_out": false,
        "is_auto_call": false,
        "is_deleted": false,
        "rtp_audio_in_mos": 4.5,
        "is_callbot": false,
        "dial_status": "CANCEL",
        "answer_sec": 0,
        "domain_fusion": "Lorem ipsum dolor sit amet.",
        "sip_from_user": "1000071",
        "nation": "vn",
        "is_ai": false,
        "domain": "Lorem ipsum dolor sit amet.",
        "playback_seconds": 0,
        "pbx_type": "",
        "is_trunk": false,
        "suspicious_checked": false,
        "is_missed_call": false,
        "is_analyzed": false,
        "internal_destination": {
          "id": "123400000000000000000000",
          "contact_id": "649e981afd4c703b39692f5f",
          "name": "Lorem ipsum dolor sit amet.",
          "uuid": "0123456789",
          "extension": "0123456",
          "type": "extension"
        }
      }
    ],
    "pageNumber": 1,
    "pageSize": 20,
    "totalItems": 1000,
    "totalPages": 100,
    "hasNext": true,
    "nextPage": 2,
    "hasPrevious": false,
    "previousPage": 1
  },
  "instance_version": "1.0.0",
  "key_enabled": false,
  "status_code": 9999
}
```

{% endtab %}
{% endtabs %}

## Đánh giá cuộc gọi theo tiêu chí&#x20;

<mark style="color:green;">`POST`</mark> `[URL]/api/call_transaction/add_evaluation/:transaction_id`

<mark style="color:$primary;">\*</mark> <mark style="color:$primary;">Tạm dừng cập nhật từ ngày 01/04/2026, vui lòng sử dụng</mark> [<mark style="color:$primary;">API v3</mark>](https://api.omicall.com/omicall-api/call-transaction/v2#danh-gia-cuoc-goi-theo-tieu-chi-v3)

#### Path Parameters

| Name                                              | Type   | Description             |
| ------------------------------------------------- | ------ | ----------------------- |
| transaction\_id<mark style="color:red;">\*</mark> | String | Transaction Id cuộc gọi |

#### Request Body

| Name                                         | Type   | Description                                                                                                              |
| -------------------------------------------- | ------ | ------------------------------------------------------------------------------------------------------------------------ |
| user\_uuid<mark style="color:red;">\*</mark> | String | Id của User bên thứ 3 hoặc Số máy lẻ trong hệ thống                                                                      |
| evaluation<mark style="color:red;">\*</mark> | Object | <p>Đối tượng chưa thông tin đánh giá, json format như sau</p><p><em><strong>(Format như ảnh bên dưới )</strong></em></p> |

{% tabs %}
{% tab title="200: OK Thông tin cuộc gọi + đánh giá" %}

{% endtab %}

{% tab title="201 " %}

{% endtab %}
{% endtabs %}

<figure><img src="/files/bR0aDnKeRhHYMuaPfHqv" alt=""><figcaption></figcaption></figure>

## Đánh giá cuộc gọi theo tiêu chí (v3)

<mark style="color:green;">`POST`</mark> `[URL]/api/v3/call-transaction/add-evaluation`

Tạo đánh giá cuộc gọi theo tiêu chí

#### Request Body

<table><thead><tr><th>Name</th><th>Type</th><th>Description</th></tr></thead><tbody><tr><td>transactionId<mark style="color:red;">*</mark></td><td>String</td><td>Transaction Id cuộc gọi</td></tr><tr><td>agentId<mark style="color:red;">*</mark></td><td>String</td><td>Id nhân viên trong hệ thống, có được thông qua API danh sách nhân viên hoặc danh sách lịch sử cuộc gọi</td></tr><tr><td>evaluation<mark style="color:red;">*</mark></td><td>Object</td><td><p>Đối tượng chưa thông tin đánh giá, json format như sau</p><pre class="language-json"><code class="lang-json">{
    "comment": "test",
    "values": [
        {
            "criteriaId": "648bcc156372f32909540b58", // id tiêu chí
            "name": "Đánh giá chất lượng", // tên tiêu chí
            "point": 3
        }
    ]
}
</code></pre></td></tr></tbody></table>

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

```json
{
        "transaction_id": "13a09408-db5d-49a0-b262-4100b2718836", // unique id của cuộc gọi
        "tenant_id": "6487dbe6572b7b17fcc8e511",
        "direction": "outbound", // hướng cuộc gọi
        "source_number": "84123456778",  // đầu số gọi đi
        "destination_number": "0234567891", // đầu số nhận cuộc gọi
        "disposition": "answered", // trạng thái trả lời
        "bill_sec": 90,
        "record_seconds": 88,
        "time_start_to_answer": 1773139125,
        "recording_file": "https://4100b2718836.mp3",
        "recording_file_url": "https://4100b2718836",
        "recording_data": null,
        "sip_user": "100",
        "created_date": 1773139222456,
        "last_updated_date": 1773139405421,
        "is_auto_call": false,
        "ivr": "none",
        "provider": "mobifone", // nhà mạng
        "duration": 97, // thời lượng cuộc gọi (second)
        "user": [
          {
            "full_name"         : "nhanvien1",
            "full_name_unsigned": "nhanvien1",
            "note"              : null,
            "tag"               : null
          }
        ],
        "customer": {
          "_id"               : "66602774ec7f2b235cad1a3d",
          "full_name"         : "Vihat",
          "full_name_unsigned": "vihat"
        },
        "state": null,
        "call_uuid": null,
        "from_number": null,
        "to_number": null,
        "hotline": null,
        "is_have_forward_out": false,
        "bill_sec_forward_out": 0,
        "call_out_price": 900.000,
        "note": null,
        "tag": [],
        "invite_failure_status": null,
        "answer_sec": 88,
        "autocall_uuid": null,
        "autocall_id": null,
        "sip_number": "84123456778", // đầu số
        "phone_number": "0234567891", // số điện thoại khách hàng
        "create_by": { // thông tin nhân viên thực hiện hoặc nhận cuộc gọi
          "id"        : "6487dbe7572b7b17fcc8e514",
          "name"      : "nhanvien1",
          "contact_id": "6487dbeb1a309849f72056ad", // id nhân viên
          "avatar"    : null,
          "gender"    : null,
          "uuid"      : null,
          "type"      : "agent"
        },
        "transfer_histories": [],
        "user_data_str": null,
        "user_ref_code": null,
        "endby_name": "end_call_by_customer",
        "hangup_cause": "NORMAL_CLEARING",
        "sip_hangup_disposition": "send_bye",
        "hangup_cause_q850": null,
        "is_voicemail": false,
        "recording_file_voicemail": null,
        "domain_fusion": "test",
        "send_num_retry": 0,
        "time_start_call": 1773139125,
        "time_end_call": 1773139222,
        "out_of_working_time": true,
        "sip_number_tags": [],
        "evaluations": [
            {
                "leg": null,
                "point": 3.0, // điểm số đánh giá
                "comment": "test", // bình luận
                "created_date": 1773205305532,
                "create_by": {
                    "id": "6487dbe7572b7b17fcc8e514",
                    "name": "nhanvien1",
                    "contact_id": "6487dbeb1a309849f72056ad", // id nhân viên
                    "avatar": null,
                    "gender": null,
                    "uuid": null,
                    "type": null,
                    "extension": null
                },
                "attribute_id": "ZMXQPJrQ2",
                "values": [
                    {
                        "criteria_id": "648bcc156372f32909540b58", // id tiêu chí
                        "name": "Đánh giá chất lượng", // tên tiêu chí
                        "point": 3.0 // điểm đánh giá
                    }
                ]
            }
        ],
        "total_evaluate": {
            "point": 3.0, // tổng điểm đánh giá trung bình
            "total": 1 // tổng số lượt đánh giá
        },
        "internal_destination": null,
        "classifies": null,
        "collect_info_variables": null,
        "sip_number_forward_out": null,
        "is_same_network": false,
        "is_same_network_forward_out": false,
        "provider_of_number": "itel",
        "provider_of_number_forward_out": null,
        "callbot_script_id": null,
        "criteria": null,
        "users_status": null,
        "call_stacks": [
          {
            "from": "100",
            "to": "0234567891",
            "sip_number": "84123456778",
            "phone_number": "0234567891",
            "type": "external",
            "at": 1773139126018,
            "bye_at": 1773139222118,
            "index": 1,
            "is_answer": false
          }
        ],
        "call_script": null,
        "hold_call_sec": 0
}
```

{% endtab %}

{% tab title="400 Bad Request" %}

```json
{
    "message": "invalid_param", // mã lỗi
    "status_code": 400,
    "timestamp": 1773334799999
}
```

{% endtab %}

{% tab title="204 No Content" %}
Không tìm thấy lịch sử cuộc gọi với transactionId
{% endtab %}
{% endtabs %}

<table><thead><tr><th>Mã Lỗi</th><th>Mô tả</th><th data-hidden></th></tr></thead><tbody><tr><td><em>invalid_param</em></td><td>Request Body thiếu hoặc sai format</td><td></td></tr><tr><td><em>agent_not_found</em></td><td>Không tìm thấy nhân viên với agentId trong hệ thống</td><td></td></tr><tr><td><em>internal_server_error</em></td><td>Lỗi hệ thống</td><td></td></tr></tbody></table>

## Báo cáo tổng quan cuộc gọi

<mark style="color:green;">`GET`</mark> `[URL]/api/v3/call-transaction/report`

Thống kê các thông số liên quan đến lịch sử cuộc gọi

#### Request param

| Name     | Type   | Description                                                          |
| -------- | ------ | -------------------------------------------------------------------- |
| fromDate | Number | Từ ngày (Epoch Time Milliseconds). VD: 1780246800000                 |
| toDate   | Number | Đến ngày (Epoch Time Milliseconds). Giới hạn 12 tháng kể từ fromDate |

#### Headers

| Name          | Type   | Description                  |
| ------------- | ------ | ---------------------------- |
| Content-type  | String | application/json             |
| Authorization | String | Access token: Bearer 'token' |

#### Request Body

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

```json
{
    "byDirections": { // Thông số cuộc gọi theo hướng gọi
        "outbound": { // Gọi ra
            "docCount": 69, // Tổng cuộc gọi
            "totalBillSec": 4808.0, // Tổng số giây tích cước
            "byDates": { // Thông số theo ngày
                "01-06-2026": {
                    "docCount": 46, // Tổng cuộc gọi
                    "totalAnswered": 39, // Tổng cuộc gọi có trả lời
                    "totalCancelled": 7, // Tổng cuộc gọi không trả lời
                    "totalBillSec": 2591.0, // Tổng số giây tính cước
                    "totalAnswerSec": 1507.0 // Tổng số giây trả lời
                },
                "02-06-2026": {
                    "docCount": 23,
                    "totalAnswered": 19,
                    "totalCancelled": 4,
                    "totalBillSec": 2217.0,
                    "totalAnswerSec": 2143.0
                }
            },
            "workingTimeResult": { // Thống kê theo khung giờ
                "totalInWorkingTime": 69, // Tổng cuộc gọi trong khung giờ
                "totalBillSecInWorkingTime": 4808.0, // Tổng số giây tính cước trong khung giờ
                "totalAnswerSecInWorkingTime": 3650.0, // Tổng số giây trả lời trong khung giờ
                "totalOutWorkingTime": 0, // Tổng cuộc gọi ngoài khung giờ
                "totalBillSecOutWorkingTime": 0.0, // Tổng số giây tính cước ngoài khung giờ
                "totalAnswerSecOutWorkingTime": 0.0 // Tổng số giây trả lời ngoài khung giờ
            }
        },
        "inbound": { // Gọi vào
            "docCount": 26,
            "totalBillSec": 803.0,
            "byDates": {
                "01-06-2026": {
                    "docCount": 11,
                    "totalAnswered": 8,
                    "totalCancelled": 3,
                    "totalBillSec": 614.0,
                    "totalAnswerSec": 597.0
                },
                "02-06-2026": {
                    "docCount": 1,
                    "totalAnswered": 0,
                    "totalCancelled": 1,
                    "totalBillSec": 60.0,
                    "totalAnswerSec": 0.0
                },
                "03-06-2026": {
                    "docCount": 10,
                    "totalAnswered": 1,
                    "totalCancelled": 9,
                    "totalBillSec": 65.0,
                    "totalAnswerSec": 1.0
                },
                "04-06-2026": {
                    "docCount": 4,
                    "totalAnswered": 0,
                    "totalCancelled": 4,
                    "totalBillSec": 64.0,
                    "totalAnswerSec": 0.0
                }
            },
            "workingTimeResult": {
                "totalInWorkingTime": 26,
                "totalBillSecInWorkingTime": 803.0,
                "totalAnswerSecInWorkingTime": 598.0,
                "totalOutWorkingTime": 0,
                "totalBillSecOutWorkingTime": 0.0,
                "totalAnswerSecOutWorkingTime": 0.0
            }
        }
    },
    "byDispositions": { // Thông số cuộc gọi theo trạng thái
        "true": { // Có trả lời
            "docCount": 67,
            "totalBillSec": 5424.0,
            "directionCount": {
                "outbound": 58,
                "inbound": 9
            },
            "byDates": {
                "01-06-2026": {
                    "docCount": 47,
                    "totalAnswered": 47,
                    "totalCancelled": 0,
                    "totalBillSec": 3205.0,
                    "totalAnswerSec": 2104.0
                },
                "02-06-2026": {
                    "docCount": 19,
                    "totalAnswered": 19,
                    "totalCancelled": 0,
                    "totalBillSec": 2217.0,
                    "totalAnswerSec": 2143.0
                },
                "03-06-2026": {
                    "docCount": 1,
                    "totalAnswered": 1,
                    "totalCancelled": 0,
                    "totalBillSec": 2.0,
                    "totalAnswerSec": 1.0
                }
            },
            "workingTimeResult": {
                "totalInWorkingTime": 67,
                "totalBillSecInWorkingTime": 5424.0,
                "totalAnswerSecInWorkingTime": 4248.0,
                "totalOutWorkingTime": 0,
                "totalBillSecOutWorkingTime": 0.0,
                "totalAnswerSecOutWorkingTime": 0.0
            }
        },
        "false": { // Không trả lời
            "docCount": 28,
            "totalBillSec": 187.0,
            "directionCount": {
                "inbound": 17,
                "outbound": 11
            },
            "byDates": {
                "01-06-2026": {
                    "docCount": 10,
                    "totalAnswered": 0,
                    "totalCancelled": 10,
                    "totalBillSec": 0.0,
                    "totalAnswerSec": 0.0
                },
                "02-06-2026": {
                    "docCount": 5,
                    "totalAnswered": 0,
                    "totalCancelled": 5,
                    "totalBillSec": 60.0,
                    "totalAnswerSec": 0.0
                },
                "03-06-2026": {
                    "docCount": 9,
                    "totalAnswered": 0,
                    "totalCancelled": 9,
                    "totalBillSec": 63.0,
                    "totalAnswerSec": 0.0
                },
                "04-06-2026": {
                    "docCount": 4,
                    "totalAnswered": 0,
                    "totalCancelled": 4,
                    "totalBillSec": 64.0,
                    "totalAnswerSec": 0.0
                }
            },
            "workingTimeResult": {
                "totalInWorkingTime": 28,
                "totalBillSecInWorkingTime": 187.0,
                "totalAnswerSecInWorkingTime": 0.0,
                "totalOutWorkingTime": 0,
                "totalBillSecOutWorkingTime": 0.0,
                "totalAnswerSecOutWorkingTime": 0.0
            }
        }
    },
    "totalAnswerCall": 67, // Tổng cuộc gọi trả lời
    "totalAnswerSec": 4248.0, // Tổng số giây trả lời
    "totalCallToQueue": 4, // Tổng cuộc gọi vào hàng đợi
    "totalHoldCall": 0, 
    "totalHoldSec": 0.0,
    "totalIvrTime": 6.0, // Tổng thời gian IVR
    "totalWaitCall": 9, // Tổng cuộc gọi chờ
    "totalWaitSec": 69.0 // Tổng số giây chờ
}
```

{% endtab %}

{% tab title="400 Bad Request" %}

```json
{
    "message": "invalid_param", // mã lỗi
    "status_code": 400,
    "timestamp": 1773334799999
}
```

{% endtab %}
{% endtabs %}

<table><thead><tr><th>Mã Lỗi</th><th>Mô tả</th><th data-hidden></th></tr></thead><tbody><tr><td><em>missing_time_query</em></td><td>Thiếu thời gian fromDate hoặc toDate</td><td></td></tr><tr><td>invalid_date_range</td><td>Khoảng thời gian không hợp lệ</td><td></td></tr><tr><td><em>date_range_exceed_12_months</em></td><td>Khoảng thời gian vượt quá giới hạn cho phép</td><td></td></tr></tbody></table>
