> For the complete documentation index, see [llms.txt](https://en.help.firstline.cc/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://en.help.firstline.cc/developer/api/service-log.md).

# Service Record

## Search

```javascript
GET https://{API_DOMAIN}/api/v1/interact-collection
```

```javascript
curl -X GET
    -H "Content-Type: application/json"
    '{"handler_id": 3}'
    https://{API_HOST}/api/v1/interact-collection
```

### Form Data

The following table lists the available filter conditions

| PARAMETER                | REQUIRED | DEFAULT | TYPE     | DESCRIPTION                                                         |
| ------------------------ | -------- | ------- | -------- | ------------------------------------------------------------------- |
| **handler\_id**          | false    | NULL    | Number   | ID of the person in charge                                          |
| **handler\_group\_id**   | false    | NULL    | Number   | The employee group of the agent responsible for this service record |
| **contact\_id**          | false    | NULL    | Numbe    | Related customer ID                                                 |
| **created\_at\_\_start** | false    | NULL    | Datetime | Service record start time                                           |
| **created\_at\_\_end**   | false    | NULL    | Datetime | Service record end time                                             |
| **is\_acw\_completed**   | false    | NULL    | Boolean  | Whether the service is in a completed state                         |

### Response

| PROPERTY | TYPE             | DESCRIPTION                                                                          |
| -------- | ---------------- | ------------------------------------------------------------------------------------ |
| **data** | Array of objects | [Service records](/developer/api/response-object.md#interact-collection)Array object |
| **meta** | Object           | Tab data                                                                             |

```javascript
{
    "data": [
        {
            "id": 491,
            "is_acw_completed": false,
            "first_enter_queue_at": "2021-04-14 13:36:35",
            "first_start_service_at": "2021-05-06 12:23:25",
            "acw_at": null,
            "last_finished_at": null,
            "handler_id": 1,
            "handler": {
                "id": 1,
                "name": "alice chang",
                "first_name": "alice",
                "last_name": "chang",
                "employee_no": "alice",
                "photo_url": null,
                "identity_no": null,
                "job_title_id": -1,
                "department_id": -1,
                "extension_id": 25,
                "extension": {
                    "id": 25,
                    "type": 3,
                    "extension": "8002",
                    "webrtc_password": "540939228002",
                    "description": null,
                    "media_cluster_id": null
                },
                "profile_id": 2195673,
                "group_id": 1,
                "group": {
                    "id": 1,
                    "name": "Customer Service Team",
                    "description": null,
                    "supervisor_id": 4
                },
                "cti_agent_account": "ag8002",
                "cti_agent": {
                    "id": 6,
                    "account": "ag8002",
                    "group_id": null
                },
                "cti_agent_id": 6,
                "created_at": "2019-05-07 12:37:48",
                "updated_at": "2021-01-07 10:28:04"
            },
            "contact_id": null,
            "contact": null,
            "memo": null,
            "bound_type": 1,
            "logs": [
                {
                    "id": 522,
                    "enter_queue_at": "2021-04-14 13:36:35",
                    "service_start_at": "2021-05-06 12:23:25",
                    "service_end_at": null,
                    "service_time": null,
                    "status": 1,
                    "bound_type": 1,
                    "provider_type": "App\\LivechatContentProvider",
                    "provider": {
                        "id": 61,
                        "message": [
                            {
                                "id": 2675,
                                "type": "text",
                                "content": "Hello",
                                "is_contact": true,
                                "is_system": false,
                                "is_csat": false,
                                "is_kb": false,
                                "kb_id": null,
                                "sender_id": 5,
                                "question": null,
                                "at": "2021-04-14 13:36:35"
                            }
                        ],
                        "media_contact_id": 109,
                        "media_contact": {
                            "id": 109,
                            "name": "b97beb2d-bc60-4a14-86b1-31de6bfe928e",
                            "gender": null,
                            "state": 1,
                            "uuid": "b97beb2d-bc60-4a14-86b1-31de6bfe928e",
                            "token": "5f7916af6cdfba5efdddba0b981a84c4",
                            "is_visible": true,
                            "channel": "livechat.624de7dfabffd4875c0150ee03b65138.b97beb2d-bc60-4a14-86b1-31de6bfe928e"
                        }
                    },
                    "interact_collection_id": 491,
                    "can_listen": true
                }
            ],
            "sponsor_id": null,
            "sponsor": null,
            "campaign_queue": null,
            "campaign_queue_id": null,
            "reasons": [],
            "reason_ids": [],
            "result_id": null,
            "result": {
                "id": null,
                "name": null,
                "is_active": true,
                "description": null,
                "category_id": null,
                "priority": null,
                "created_at": null,
                "updated_at": null
            },
            "media_cluster_id": null,
            "employee_schedule": null,
            "transfer_logs": [],
            "created_at": "2021-05-06 12:23:25"
        },
    ]
```

## Get a single service record

```javascript
https://{API_DOMAIN}/api/v1/interact-collection/{interact-collection}
```

```javascript
curl -X GET
    -H "Content-Type: application/json"
    https://{API_HOST}/api/v1/interact-collection/245621
```

### URL Parameters

| PARAMETER | REQUIRED | DEFAULT | TYPE   | DESCRIPTION              |
| --------- | -------- | ------- | ------ | ------------------------ |
| **ID**    | true     | NULL    | Number | ID of the service record |

### Response

| PROPERTY | TYPE   | DESCRIPTION                                                              |
| -------- | ------ | ------------------------------------------------------------------------ |
| **data** | Object | [Service records](/developer/api/response-object.md#interact-collection) |

```javascript
{
    "id": 495,
    "is_acw_completed": false,
    "first_enter_queue_at": "2021-04-14 13:36:35",
    "first_start_service_at": "2021-04-15 12:23:25",
    "acw_at": null,
    "last_finished_at": null,
    "handler_id": 1,
    "handler": {
        "id": 1,
        "name": "alice chang",
        "first_name": "alice",
        "last_name": "chang",
        "employee_no": "alice",
        "photo_url": null,
        "identity_no": null,
        "job_title_id": -1,
        "department_id": -1,
        "extension_id": 25,
        "extension": {
            "id": 25,
            "type": 3,
            "extension": "8002",
            "webrtc_password": "540939228002",
            "description": null,
            "media_cluster_id": null
        },
        "profile_id": 2195673,
        "group_id": 1,
        "group": {
            "id": 1,
            "name": "Customer Service Team",
            "description": null,
            "supervisor_id": 4
        },
        "cti_agent_account": "ag8002",
        "cti_agent": {
            "id": 6,
            "account": "ag8002",
            "group_id": null
        },
        "cti_agent_id": 6,
        "created_at": "2019-05-07 12:37:48",
        "updated_at": "2021-01-07 10:28:04"
    },
    "contact_id": null,
    "contact": null,
    "memo": null,
    "bound_type": 1,
    "logs": [
        {
            "id": 522,
            "enter_queue_at": "2021-04-14 13:36:35",
            "service_start_at": "2021-05-06 12:23:25",
            "service_end_at": null,
            "service_time": null,
            "status": 1,
            "bound_type": 1,
            "provider_type": "App\\LivechatContentProvider",
            "interact_collection_id": 491,
            "can_listen": true
        }
    ],
    "sponsor_id": null,
    "sponsor": null,
    "campaign_queue": null,
    "campaign_queue_id": null,
    "reasons": [],
    "reason_ids": [],
    "result_id": null,
    "result": {
        "id": null,
        "name": null,
        "is_active": true,
        "description": null,
        "category_id": null,
        "priority": null,
        "created_at": null,
        "updated_at": null
    },
    "media_cluster_id": null,
    "fb_accounts": [
            {
                "id": 2,
                "name": "110906707118012",
                "media_cluster_id": 4,
                "skills": [
                    {
                        "id": 2,
                        "name": "Japanese",
                        "description": null,
                        "creater_id": 1
                    },
                ],
                "skill_ids": [
                    2,
                ]
            }
        ],
    "line_account_ids": [],
    "line_accounts": [],
    "employee_schedule": null,
    "transfer_logs": [],
    "created_at": "2021-05-06 12:23:25"
},   
```

### Update service record

{% hint style="success" %}
This API is **3.06.10** available in later versions.
{% endhint %}

Request method: `PUT`\
Endpoint: `/api/v1/interact-collection/{interact-collection}`\
Description: Update the data of the specified service record.

#### Restrictions

This API **only supports modifications**,**and does not support adding or deleting**.

There are also important restrictions:\
**Modification is allowed only when the service record is not yet completed.**\
If this service record already has `acw_at` a value, it means the service has been completed and the system will not allow any changes. The response fields in the existing service record documentation are already visible `acw_at`, and the incomplete case is `null`.

#### Curl example

```bash
curl -X PUT \
     -H "Content-Type: application/json" \
     -d '{
       "memo": "The customer said they have received the progress update and are waiting for a follow-up reply",
       "cz_cols": [
         {
           "id": 4,
           "value": "123456"
         },
         {
           "id": 7,
           "value": "apple"
         },
         {
           "id": 18,
           "value": ["A", "B", "C"]
         }
       ]
     }' \
     https://{API_HOST}/api/v1/interact-collection/245621
```

#### URL parameters

| Parameter name | Required | Default value | Type   | Description                             |
| -------------- | -------: | ------------- | ------ | --------------------------------------- |
| `id`           |      Yes | NULL          | Number | Unique identifier of the service record |

#### Form data

| Field name | Required | Default value | Type             | Description                         |
| ---------- | -------: | ------------- | ---------------- | ----------------------------------- |
| `memo`     |       No | NULL          | String           | Remark text, maximum 600 characters |
| `cz_cols`  |       No | NULL          | Array of objects | Array of custom field data          |

**`cz_cols` Object format**

| Field name | Required | Default value | Type           | Description                                                                                              |
| ---------- | -------: | ------------- | -------------- | -------------------------------------------------------------------------------------------------------- |
| `id`       |      Yes | NULL          | Number         | Custom field ID                                                                                          |
| `value`    |      Yes | NULL          | String / Array | Custom field value; the actual type depends on the field settings and can be a single string or an array |

#### `cz_cols` Example

```json
[
  {
    "id": 4,
    "value": "123456"
  },
  {
    "id": 7,
    "value": "apple"
  },
  {
    "id": 18,
    "value": ["A", "B", "C"]
  }
]
```

#### Response structure

| Field name | Type   | Description                             |
| ---------- | ------ | --------------------------------------- |
| `data`     | Object | Single service record data after update |

#### Response example

```json
{
  "data": {
    "id": 245621,
    "memo": "The customer said they have received the progress update and are waiting for a follow-up reply",
    "acw_at": null,
    "cz_cols": [
      {
        "id": 4,
        "value": "123456"
      },
      {
        "id": 7,
        "value": "apple"
      },
      {
        "id": 18,
        "value": ["A", "B", "C"]
      }
    ],
    "updated_at": "2026-03-20 14:30:00"
  }
}
```

#### Failure scenario description

**The service record has been completed and cannot be modified**

When the service record already has `acw_at` a value, it means the service has been completed and the system should reject the update request.

```json
{
  "message": "This interact-collection has already been ACWed and cannot be edited."
}
```
