# AI Work Assistant

## 1. Preparation

**Base URL**: `https://api.rokid.com`

**Before you start**:
- Prepare a valid API key (`API_KEY`) for authentication.
- Make sure your enterprise already has AI Work Assistant task records and generated work documents for query and download testing.

## 2. Overview

The AI Work Assistant module currently provides paginated work task record querying. Developers can query work records by user, task name, and execution time range.

### 2.1 Query AI work task records with pagination

**Endpoint**: `https://api.rokid.com/ar/flow/openapi/record/page?uid={$uid}&pageNum={$pageNum}&pageSize={$pageSize}&taskName={$taskName}&gmtStart={$gmtStart}&gmtEnd={$gmtEnd}`

**Method**: `GET`

**Request Content-Type**: `application/x-www-form-urlencoded`

**Response Content-Type**: `*/*`

**Description**: Query AI work task records by user ID, task name, and execution time range.

**Request parameters**:

| **Name** | **Description** | **Required** | **Type** |
| --- | --- | --- | --- |
| uid | User ID | true | string |
| pageNum | Page number, default `1` | false | int |
| pageSize | Page size, default `10` | false | int |
| taskName | Task name, fuzzy match | false | string |
| gmtStart | Execution start time, format `yyyy-MM-dd HH:mm:ss` | false | string |
| gmtEnd | Execution end time, format `yyyy-MM-dd HH:mm:ss` | false | string |

**Response fields**:

| **Name** | **Description** | **Required** | **Type** |
| --- | --- | --- | --- |
| pageNum | Current page number | true | int |
| pageSize | Page size | true | int |
| total | Total count | true | long |
| list | Work record list | true | array |
| taskId | Work task ID | true | string |
| taskName | Task name | false | string |
| sessionId | Session ID | false | string |
| planId | Plan ID | false | string |
| ticketId | Ticket ID | false | string |
| ticketFlowType | Ticket flow type | false | string |
| companyId | Company ID | false | string |
| uid | User ID | false | string |
| userName | User name | false | string |
| chatContent | Chat content | false | string |
| result | Task result | false | string |
| taskProgress | Task progress: `0` not started, `1` in progress, `2` report generating, `3` task exception, `4` completed, `5` pending signature | false | int |
| videoUrl | Video URL | false | string |
| uploadTime | Upload time | false | string |
| gmtCreated | Created time | false | string |
| gmtModified | Modified time | false | string |
| gmtCreatedStart | Start time | false | string |
| gmtCreatedEnd | End time | false | string |
| deleted | Delete flag: `0` not deleted, `1` deleted | false | int |
| signUrl | Signature URL | false | string |
| flowType | Flow type | false | string |
| reportUrl | Work document URL | false | string |

**Request example**:

```bash
curl -X GET "https://api.rokid.com/ar/flow/openapi/record/page?uid=E9985178CD6C4207BDB30608FF90B909&pageNum=1&pageSize=10&taskName=inspection&gmtStart=2026-06-01%2000:00:00&gmtEnd=2026-06-17%2023:59:59" \
-H "Authorization: Bearer $API_KEY"
```

**Response example**:

```json
{
  "code": 0,
  "message": "OK",
  "data": {
    "pageNum": 1,
    "pageSize": 10,
    "total": 1,
    "list": [
      {
        "taskId": "0c0d7fc3f4a04b9caf2f4a534c6b5b10",
        "taskName": "Daily Inspection",
        "sessionId": "conversation_001",
        "planId": "plan_001",
        "ticketId": "ticket_001",
        "ticketFlowType": "custom",
        "companyId": "7A15F74ED76542678825CA7DE5F18E03",
        "uid": "E9985178CD6C4207BDB30608FF90B909",
        "userName": "Zhang San",
        "chatContent": "Today's inspection task is complete",
        "result": "{}",
        "taskProgress": 4,
        "videoUrl": "",
        "uploadTime": "",
        "gmtCreated": "2026-06-17T10:00:00.000+08:00",
        "gmtModified": "2026-06-17T10:30:00.000+08:00",
        "gmtCreatedStart": "2026-06-17T10:00:00.000+08:00",
        "gmtCreatedEnd": "2026-06-17T10:30:00.000+08:00",
        "deleted": 0,
        "signUrl": "",
        "flowType": "custom",
        "reportUrl": "https://cdn.rokid.com/reports/work-record-001.docx"
      }
    ]
  },
  "success": true
}
```
