# Kiteworks API — dli Operations

**19 endpoints** | [Browse interactive reference](https://developer.kiteworks.com/api-reference/dli.html) | [Download spec slice](https://developer.kiteworks.com/assets/specs/dli.json)

> **Authentication required.** All requests must include a Bearer access token in the
> `Authorization` header. See [Authentication](https://developer.kiteworks.com/authentication.md) for how to
> obtain a token using OAuth 2.0 Authorization Code (PKCE) or JWT Bearer flow.

---

## GET /rest/dli/exports

**Summary:** Return the list of all exports for all users

Returns a paginated list of all data exports across all users, including each export's status, type, date range, and download URL. Requires admin privileges.

**Parameters:**

| Name | In | Required | Description |
|------|----|----------|-------------|
| `user_id` | query | no | Unique identifier of user |
| `user_id:in` | query | no | Unique identifier of user. Search for results that match any of the specified values for this parameter. |
| `status` | query | no | Status of the generated report |
| `status:contains` | query | no | Status of the generated report. Search for results that contain the specified characters in this parameter. |
| `offset` | query | no | Offset |
| `limit` | query | no | Limit |
| `with` | query | no | With parameters |
| `mode` | query | no | Determines the detail level of the response body. |

**Responses:**

| Code | Description |
|------|-------------|
| 200 | List of exports retrieved successfully. |
| 403 | Forbidden  <i>Possible error codes: </i>ERR_LICENSE_DLI |
| 490 | Request blocked by WAF |

**Response Examples:**

**200 (ExportList):**

```json
{
  "data": [
    {
      "id": "exp-guid-001",
      "status": "completed",
      "type": "files",
      "startDate": "2024-01-01",
      "endDate": "2024-01-31",
      "userId": "u1a2b3c4-d5e6-7890-abcd-ef1234567890",
      "generatedDate": "2024-02-01T08:00:00Z",
      "fileName": "export_files_jan2024.zip",
      "downloadURL": "https://example.com/exports/exp-guid-001"
    }
  ],
  "metadata": {
    "total": 1,
    "limit": 50,
    "offset": 0
  }
}
```

**403 (ERR_LICENSE_DLI):**

```json
{
  "errors": {
    "code": "ERR_LICENSE_DLI",
    "message": "Feature DLI is not enabled by license"
  }
}
```

**Code Samples:**

**cURL:**

```shell
curl -X GET \
  "https://{instance}.kiteworks.com/rest/dli/exports" \
  -H "Authorization: Bearer YOUR_TOKEN"
```

**Python:**

```python
import requests

url = "https://{instance}.kiteworks.com/rest/dli/exports"
headers = {
    "Authorization": "Bearer YOUR_TOKEN",
}
response = requests.get(url, headers=headers)
print(response.json())
```

---

## POST /rest/dli/exports/users/{id}

**Summary:** Start generating export for the specified user

Initiates one or more data export jobs for the specified user based on the requested report types and date range. Returns the newly created export record(s) in a pending state. Requires admin privileges.

**Parameters:**

| Name | In | Required | Description |
|------|----|----------|-------------|
| `id` | path | yes | ID of the user |
| `returnEntity` | query | no | If set to `true`, returns information about the newly created entity. |
| `mode` | query | no | Determines the detail level of the response body. |

**Request Body:**

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `startDate` | string | yes | Export start date |
| `endDate` | string | yes | Export end date |
| `types` | string[] | yes | Export type. Accepted values: `activities`, `files`, `emails` |
| `addLinks` | boolean | no | Indicates whether HATEOAS links should be included in the response |

**Responses:**

| Code | Description |
|------|-------------|
| 200 | Export job(s) created successfully. |
| 403 | Forbidden  <i>Possible error codes: </i>ERR_LICENSE_DLI, ERR_ACCESS_USER |
| 422 | Unprocessable Content  <i>Possible error codes: </i>ERR_INPUT_INVALID_DATE, ERR_INPUT_DATE_NOT_BEFORE, ERR_INPUT_REQUIRED, ERR_INPUT_DATE_NOT_AFTER, ERR_INPUT_NOT_ARRAY, ERR_INPUT_NOT_IN_LIST |
| 490 | Request blocked by WAF |

**Response Examples:**

**200 (ExportCreated):**

```json
{
  "data": [
    {
      "id": "exp-guid-002",
      "status": "pending",
      "type": "activities",
      "startDate": "2024-03-01",
      "endDate": "2024-03-31",
      "userId": "u1a2b3c4-d5e6-7890-abcd-ef1234567890",
      "generatedDate": null,
      "fileName": null,
      "downloadURL": null
    }
  ],
  "metadata": {
    "total": 1,
    "limit": 50,
    "offset": 0
  }
}
```

**403 (ERR_LICENSE_DLI):**

```json
{
  "errors": {
    "code": "ERR_LICENSE_DLI",
    "message": "Feature DLI is not enabled by license"
  }
}
```

**403 (ERR_ACCESS_USER):**

```json
{
  "errors": {
    "code": "ERR_ACCESS_USER",
    "message": "Insufficient access permissions"
  }
}
```

**422 (ERR_INPUT_REQUIRED):**

```json
{
  "errors": {
    "code": "ERR_INPUT_REQUIRED",
    "message": "Field is required"
  }
}
```

**Code Samples:**

**cURL:**

```shell
curl -X POST \
  "https://{instance}.kiteworks.com/rest/dli/exports/users/:id" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
         "startDate": "2024-01-15",
         "endDate": "2024-01-15",
         "types": [
         "string"
       ],
         "addLinks": true
       }'
```

**Python:**

```python
import requests

id = "VALUE"  # ID of the user

url = f"https://{{instance}}.kiteworks.com/rest/dli/exports/users/{id}"
headers = {
    "Authorization": "Bearer YOUR_TOKEN",
    "Content-Type": "application/json",
}
payload = {
  "startDate": "2024-01-15",
  "endDate": "2024-01-15",
  "types": [
  "string"
],
  "addLinks": true
}
response = requests.post(url, headers=headers, json=payload)
print(response.json())
```

---

## GET /rest/dli/exports/{id}

**Summary:** Return information of an export such as status, download url, user ID, etc.

Returns the details of a specific export job, including its status, type, date range, the user it belongs to, and the download URL when the export is complete. Requires admin privileges.

**Parameters:**

| Name | In | Required | Description |
|------|----|----------|-------------|
| `id` | path | yes | ID of the export |

**Responses:**

| Code | Description |
|------|-------------|
| 200 | Export details retrieved successfully. |
| 403 | Forbidden  <i>Possible error codes: </i>ERR_LICENSE_DLI, ERR_ACCESS_USER |
| 490 | Request blocked by WAF |

**Response Examples:**

**200 (ExportCompleted):**

```json
{
  "id": "exp-guid-001",
  "status": "completed",
  "type": "files",
  "startDate": "2024-01-01",
  "endDate": "2024-01-31",
  "userId": "u1a2b3c4-d5e6-7890-abcd-ef1234567890",
  "generatedDate": "2024-02-01T08:00:00Z",
  "fileName": "export_files_jan2024.zip",
  "downloadURL": "https://example.com/exports/exp-guid-001"
}
```

**200 (ExportPending):**

```json
{
  "id": "exp-guid-002",
  "status": "pending",
  "type": "activities",
  "startDate": "2024-03-01",
  "endDate": "2024-03-31",
  "userId": "u1a2b3c4-d5e6-7890-abcd-ef1234567890",
  "generatedDate": null,
  "fileName": null,
  "downloadURL": null
}
```

**403 (ERR_LICENSE_DLI):**

```json
{
  "errors": {
    "code": "ERR_LICENSE_DLI",
    "message": "Feature DLI is not enabled by license"
  }
}
```

**403 (ERR_ACCESS_USER):**

```json
{
  "errors": {
    "code": "ERR_ACCESS_USER",
    "message": "Insufficient access permissions"
  }
}
```

**Code Samples:**

**cURL:**

```shell
curl -X GET \
  "https://{instance}.kiteworks.com/rest/dli/exports/:id" \
  -H "Authorization: Bearer YOUR_TOKEN"
```

**Python:**

```python
import requests

id = "VALUE"  # ID of the export

url = f"https://{{instance}}.kiteworks.com/rest/dli/exports/{id}"
headers = {
    "Authorization": "Bearer YOUR_TOKEN",
}
response = requests.get(url, headers=headers)
print(response.json())
```

---

## DELETE /rest/dli/exports/{id}

**Summary:** Delete the specified export.

Permanently deletes the specified export record and its associated data. Requires admin privileges.

**Parameters:**

| Name | In | Required | Description |
|------|----|----------|-------------|
| `id` | path | yes | ID of the export |

**Responses:**

| Code | Description |
|------|-------------|
| 204 | Export deleted successfully. |
| 403 | Forbidden  <i>Possible error codes: </i>ERR_LICENSE_DLI, ERR_ACCESS_USER |
| 490 | Request blocked by WAF |

**Response Examples:**

**403 (ERR_LICENSE_DLI):**

```json
{
  "errors": {
    "code": "ERR_LICENSE_DLI",
    "message": "Feature DLI is not enabled by license"
  }
}
```

**403 (ERR_ACCESS_USER):**

```json
{
  "errors": {
    "code": "ERR_ACCESS_USER",
    "message": "Insufficient access permissions"
  }
}
```

**Code Samples:**

**cURL:**

```shell
curl -X DELETE \
  "https://{instance}.kiteworks.com/rest/dli/exports/:id" \
  -H "Authorization: Bearer YOUR_TOKEN"
```

**Python:**

```python
import requests

id = "VALUE"  # ID of the export

url = f"https://{{instance}}.kiteworks.com/rest/dli/exports/{id}"
headers = {
    "Authorization": "Bearer YOUR_TOKEN",
}
response = requests.delete(url, headers=headers)
print(response.json())
```

---

## GET /rest/dli/exports/{id}/content

**Summary:** Download the generated export.

Downloads the generated export file as a binary stream. The export must be in a completed state before it can be downloaded. Requires admin privileges.

**Parameters:**

| Name | In | Required | Description |
|------|----|----------|-------------|
| `id` | path | yes | ID of the export |

**Responses:**

| Code | Description |
|------|-------------|
| 200 | Export file returned as a binary stream. |
| 403 | Forbidden  <i>Possible error codes: </i>ERR_LICENSE_DLI, ERR_ACCESS_USER |
| 490 | Request blocked by WAF |

**Response Examples:**

**403 (ERR_LICENSE_DLI):**

```json
{
  "errors": {
    "code": "ERR_LICENSE_DLI",
    "message": "Feature DLI is not enabled by license"
  }
}
```

**403 (ERR_ACCESS_USER):**

```json
{
  "errors": {
    "code": "ERR_ACCESS_USER",
    "message": "Insufficient access permissions"
  }
}
```

**Code Samples:**

**cURL:**

```shell
curl -X GET \
  "https://{instance}.kiteworks.com/rest/dli/exports/:id/content" \
  -H "Authorization: Bearer YOUR_TOKEN"
```

**Python:**

```python
import requests

id = "VALUE"  # ID of the export

url = f"https://{{instance}}.kiteworks.com/rest/dli/exports/{id}/content"
headers = {
    "Authorization": "Bearer YOUR_TOKEN",
}
response = requests.get(url, headers=headers)
print(response.json())
```

---

## GET /rest/dli/files/{fileId}/users/{userId}/activities

**Summary:** Return the list of Activities for this file

Returns all activities performed by the specified user on the specified file. Each activity includes the affected object, a human-readable message, the acting user, and whether the action was successful. Requires admin privileges.

**Parameters:**

| Name | In | Required | Description |
|------|----|----------|-------------|
| `fileId` | path | yes | ID of the file |
| `userId` | path | yes | The unique identifier of the user. |
| `noDayBack` | query | no | Number of days back to search |
| `startDate` | query | no | Start date |
| `endDate` | query | no | End date |
| `filter` | query | no | Filter activities by scope. Accepted values: `all`, `my`. |
| `search` | query | no | Search by mail body, subject and sender/recipients |
| `type` | query | no | Filter activities by type. Accepted values: `all`, `folder_changes`, `file_changes`, `user_preferences`, `mail`, `tasks`, `comments`, `kitepoint`. |
| `transactionId` | query | no | Transaction ID associated with the activities |
| `orderBy` | query | no | Sorting options |
| `offset` | query | no | Offset |
| `limit` | query | no | Limit |
| `with` | query | no | With parameters |
| `mode` | query | no | Determines the detail level of the response body. |

**Responses:**

| Code | Description |
|------|-------------|
| 200 | List of file activities for the user retrieved successfully. |
| 403 | Forbidden  <i>Possible error codes: </i>ERR_LICENSE_DLI, ERR_ACCESS_USER |
| 490 | Request blocked by WAF |

**Response Examples:**

**200 (FileActivities):**

```json
{
  "data": [
    {
      "object": {
        "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
        "name": "contract.pdf",
        "type": "file"
      },
      "message": "User downloaded file contract.pdf",
      "directUser": {
        "id": "u1a2b3c4-d5e6-7890-abcd-ef1234567890",
        "name": "Alice Smith",
        "email": "alice@example.com"
      },
      "successful": 1
    }
  ]
}
```

**403 (ERR_LICENSE_DLI):**

```json
{
  "errors": {
    "code": "ERR_LICENSE_DLI",
    "message": "Feature DLI is not enabled by license"
  }
}
```

**403 (ERR_ACCESS_USER):**

```json
{
  "errors": {
    "code": "ERR_ACCESS_USER",
    "message": "Insufficient access permissions"
  }
}
```

**Code Samples:**

**cURL:**

```shell
curl -X GET \
  "https://{instance}.kiteworks.com/rest/dli/files/:fileId/users/:userId/activities" \
  -H "Authorization: Bearer YOUR_TOKEN"
```

**Python:**

```python
import requests

fileId = "VALUE"  # ID of the file
userId = "VALUE"  # The unique identifier of the user.

url = f"https://{{instance}}.kiteworks.com/rest/dli/files/{fileId}/users/{userId}/activities"
headers = {
    "Authorization": "Bearer YOUR_TOKEN",
}
response = requests.get(url, headers=headers)
print(response.json())
```

---

## GET /rest/dli/files/{id}

**Summary:** Retrieve information about the file specified.

Returns metadata for the specified file, including its name, size, MIME type, content fingerprint, creation and modification dates, deletion status, and lock state.

**Parameters:**

| Name | In | Required | Description |
|------|----|----------|-------------|
| `id` | path | yes | ID of the file |
| `with` | query | no | With parameters |
| `mode` | query | no | Determines the detail level of the response body. |

**Responses:**

| Code | Description |
|------|-------------|
| 200 | File metadata retrieved successfully. |
| 403 | Forbidden  <i>Possible error codes: </i>ERR_LICENSE_DLI, ERR_ACCESS_USER |
| 490 | Request blocked by WAF |

**Response Examples:**

**200 (FileInfo):**

```json
{
  "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "name": "contract.pdf",
  "size": 204800,
  "mime": "application/pdf",
  "fingerprint": "d41d8cd98f00b204e9800998ecf8427e",
  "created": "2024-01-15T10:30:00Z",
  "modified": "2024-03-20T14:45:00Z",
  "deleted": false,
  "locked": 0,
  "parentId": "f0e1d2c3-b4a5-6789-0fed-cba987654321"
}
```

**403 (ERR_LICENSE_DLI):**

```json
{
  "errors": {
    "code": "ERR_LICENSE_DLI",
    "message": "Feature DLI is not enabled by license"
  }
}
```

**403 (ERR_ACCESS_USER):**

```json
{
  "errors": {
    "code": "ERR_ACCESS_USER",
    "message": "Insufficient access permissions"
  }
}
```

**Code Samples:**

**cURL:**

```shell
curl -X GET \
  "https://{instance}.kiteworks.com/rest/dli/files/:id" \
  -H "Authorization: Bearer YOUR_TOKEN"
```

**Python:**

```python
import requests

id = "VALUE"  # ID of the file

url = f"https://{{instance}}.kiteworks.com/rest/dli/files/{id}"
headers = {
    "Authorization": "Bearer YOUR_TOKEN",
}
response = requests.get(url, headers=headers)
print(response.json())
```

---

## GET /rest/dli/files/{id}/content

**Summary:** Read file content

Downloads the binary content of the specified file. Supports partial downloads via the Range header.

**Parameters:**

| Name | In | Required | Description |
|------|----|----------|-------------|
| `id` | path | yes | ID of the file |
| `Range` | header | no | Range of bytes to download. e.g. `bytes=0-1024` |

**Responses:**

| Code | Description |
|------|-------------|
| 200 | File content returned as a binary stream. |
| 403 | Forbidden  <i>Possible error codes: </i>ERR_LICENSE_DLI, ERR_ACCESS_USER |
| 490 | Request blocked by WAF |

**Response Examples:**

**403 (ERR_LICENSE_DLI):**

```json
{
  "errors": {
    "code": "ERR_LICENSE_DLI",
    "message": "Feature DLI is not enabled by license"
  }
}
```

**403 (ERR_ACCESS_USER):**

```json
{
  "errors": {
    "code": "ERR_ACCESS_USER",
    "message": "Insufficient access permissions"
  }
}
```

**Code Samples:**

**cURL:**

```shell
curl -X GET \
  "https://{instance}.kiteworks.com/rest/dli/files/:id/content" \
  -H "Authorization: Bearer YOUR_TOKEN"
```

**Python:**

```python
import requests

id = "VALUE"  # ID of the file

url = f"https://{{instance}}.kiteworks.com/rest/dli/files/{id}/content"
headers = {
    "Authorization": "Bearer YOUR_TOKEN",
}
response = requests.get(url, headers=headers)
print(response.json())
```

---

## GET /rest/dli/files/{id}/path

**Summary:** Get file path

Returns the full ancestor path of the specified file as an ordered list of folder nodes, from the workspace root down to the file's parent folder.

**Parameters:**

| Name | In | Required | Description |
|------|----|----------|-------------|
| `id` | path | yes | ID of the file |
| `mode` | query | no | Determines the detail level of the response body. |

**Responses:**

| Code | Description |
|------|-------------|
| 200 | File path retrieved successfully. |
| 403 | Forbidden  <i>Possible error codes: </i>ERR_LICENSE_DLI, ERR_ACCESS_USER |
| 490 | Request blocked by WAF |

**Response Examples:**

**200 (FilePath):**

```json
{
  "data": [
    {
      "id": "root-folder-guid",
      "name": "Workspace"
    },
    {
      "id": "sub-folder-guid",
      "name": "Projects"
    },
    {
      "id": "parent-folder-guid",
      "name": "Q1 Reports"
    }
  ],
  "links": [
    {
      "rel": "self",
      "href": "https://example.com/api/rest/1/dli/files/a1b2c3d4/path"
    }
  ]
}
```

**403 (ERR_LICENSE_DLI):**

```json
{
  "errors": {
    "code": "ERR_LICENSE_DLI",
    "message": "Feature DLI is not enabled by license"
  }
}
```

**403 (ERR_ACCESS_USER):**

```json
{
  "errors": {
    "code": "ERR_ACCESS_USER",
    "message": "Insufficient access permissions"
  }
}
```

**Code Samples:**

**cURL:**

```shell
curl -X GET \
  "https://{instance}.kiteworks.com/rest/dli/files/:id/path" \
  -H "Authorization: Bearer YOUR_TOKEN"
```

**Python:**

```python
import requests

id = "VALUE"  # ID of the file

url = f"https://{{instance}}.kiteworks.com/rest/dli/files/{id}/path"
headers = {
    "Authorization": "Bearer YOUR_TOKEN",
}
response = requests.get(url, headers=headers)
print(response.json())
```

---

## GET /rest/dli/files/{id}/preview

**Summary:** Retrieve information about the file preview.

Returns preview access links and processing status for the specified file.

**Parameters:**

| Name | In | Required | Description |
|------|----|----------|-------------|
| `id` | path | yes | ID of the file |

**Responses:**

| Code | Description |
|------|-------------|
| 200 | Preview metadata retrieved successfully. |
| 403 | Forbidden  <i>Possible error codes: </i>ERR_LICENSE_DLI, ERR_ACCESS_USER |
| 490 | Request blocked by WAF |

**Response Examples:**

**200 (PreviewReady):**

```json
{
  "link": "https://example.com/preview/abc123/dli/1",
  "pdf": "https://example.com/preview/abc123/pdf/dli/1",
  "viewUrl": "https://example.com/preview/abc123/view/dli/1",
  "status": "Preview",
  "watermark": "CONFIDENTIAL",
  "tdfOriginalExtension": null
}
```

**200 (PreviewProcessing):**

```json
{
  "link": "https://example.com/preview/abc123/dli/1",
  "pdf": "https://example.com/preview/abc123/pdf/dli/1",
  "viewUrl": "https://example.com/preview/abc123/view/dli/1",
  "status": "Processing",
  "watermark": null,
  "tdfOriginalExtension": null
}
```

**403 (ERR_LICENSE_DLI):**

```json
{
  "errors": {
    "code": "ERR_LICENSE_DLI",
    "message": "Feature DLI is not enabled by license"
  }
}
```

**403 (ERR_ACCESS_USER):**

```json
{
  "errors": {
    "code": "ERR_ACCESS_USER",
    "message": "Insufficient access permissions"
  }
}
```

**Code Samples:**

**cURL:**

```shell
curl -X GET \
  "https://{instance}.kiteworks.com/rest/dli/files/:id/preview" \
  -H "Authorization: Bearer YOUR_TOKEN"
```

**Python:**

```python
import requests

id = "VALUE"  # ID of the file

url = f"https://{{instance}}.kiteworks.com/rest/dli/files/{id}/preview"
headers = {
    "Authorization": "Bearer YOUR_TOKEN",
}
response = requests.get(url, headers=headers)
print(response.json())
```

---

## GET /rest/dli/files/{id}/versions

**Summary:** List versions

Returns a paginated list of all versions for the specified file. Each version includes its name, size, MIME type, creation date, creator, and content fingerprint.

**Parameters:**

| Name | In | Required | Description |
|------|----|----------|-------------|
| `id` | path | yes | Object id of file to retrieve versions for |
| `created` | query | no | File Version creation date |
| `created:gt` | query | no | File Version creation date. Search for results where this parameter value is greater than the specified value. |
| `created:gte` | query | no | File Version creation date. Search for results where this parameter value is greater than or equal to the specified value. |
| `created:lt` | query | no | File Version creation date. Search for results where this parameter value is less than the specified value. |
| `created:lte` | query | no | File Version creation date. Search for results where this parameter value is less than or equal to the specified value. |
| `orderBy` | query | no | Sorting options |
| `offset` | query | no | Offset |
| `limit` | query | no | Limit |
| `locate_id` | query | no | If specified, "offset" parameter will be ignored                                             and the page containing entity with this Id will be returned. |
| `with` | query | no | With parameters |
| `mode` | query | no | Determines the detail level of the response body. |

**Responses:**

| Code | Description |
|------|-------------|
| 200 | List of file versions retrieved successfully. |
| 403 | Forbidden  <i>Possible error codes: </i>ERR_LICENSE_DLI, ERR_ACCESS_USER |
| 490 | Request blocked by WAF |

**Response Examples:**

**200 (VersionList):**

```json
{
  "data": [
    {
      "id": "v1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "name": "report_v2.pdf",
      "versionNumber": 2,
      "size": 102400,
      "mime": "application/pdf",
      "fingerprint": "abc123def456",
      "created": "2024-03-20T14:45:00Z",
      "deleted": false,
      "objectId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
    }
  ],
  "metadata": {
    "total": 1,
    "limit": 50,
    "offset": 0
  }
}
```

**403 (ERR_LICENSE_DLI):**

```json
{
  "errors": {
    "code": "ERR_LICENSE_DLI",
    "message": "Feature DLI is not enabled by license"
  }
}
```

**403 (ERR_ACCESS_USER):**

```json
{
  "errors": {
    "code": "ERR_ACCESS_USER",
    "message": "Insufficient access permissions"
  }
}
```

**Code Samples:**

**cURL:**

```shell
curl -X GET \
  "https://{instance}.kiteworks.com/rest/dli/files/:id/versions" \
  -H "Authorization: Bearer YOUR_TOKEN"
```

**Python:**

```python
import requests

id = "VALUE"  # Object id of file to retrieve versions for

url = f"https://{{instance}}.kiteworks.com/rest/dli/files/{id}/versions"
headers = {
    "Authorization": "Bearer YOUR_TOKEN",
}
response = requests.get(url, headers=headers)
print(response.json())
```

---

## GET /rest/dli/files/{id}/versions/{version_id}

**Summary:** Allow DLI admin to get specified version

Returns the metadata for a specific version of a file, including its name, size, MIME type, creation date, creator, and content fingerprint.

**Parameters:**

| Name | In | Required | Description |
|------|----|----------|-------------|
| `id` | path | yes | Object id of file to retrieve versions for |
| `version_id` | path | yes | version ID |

**Responses:**

| Code | Description |
|------|-------------|
| 200 | Version metadata retrieved successfully. |
| 403 | Forbidden  <i>Possible error codes: </i>ERR_LICENSE_DLI, ERR_ACCESS_USER |
| 490 | Request blocked by WAF |

**Response Examples:**

**200 (VersionInfo):**

```json
{
  "id": "v1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "name": "report_v2.pdf",
  "versionNumber": 2,
  "size": 102400,
  "mime": "application/pdf",
  "fingerprint": "abc123def456",
  "created": "2024-03-20T14:45:00Z",
  "deleted": false,
  "objectId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
}
```

**403 (ERR_LICENSE_DLI):**

```json
{
  "errors": {
    "code": "ERR_LICENSE_DLI",
    "message": "Feature DLI is not enabled by license"
  }
}
```

**403 (ERR_ACCESS_USER):**

```json
{
  "errors": {
    "code": "ERR_ACCESS_USER",
    "message": "Insufficient access permissions"
  }
}
```

**Code Samples:**

**cURL:**

```shell
curl -X GET \
  "https://{instance}.kiteworks.com/rest/dli/files/:id/versions/:version_id" \
  -H "Authorization: Bearer YOUR_TOKEN"
```

**Python:**

```python
import requests

id = "VALUE"  # Object id of file to retrieve versions for
version_id = "VALUE"  # version ID

url = f"https://{{instance}}.kiteworks.com/rest/dli/files/{id}/versions/{version_id}"
headers = {
    "Authorization": "Bearer YOUR_TOKEN",
}
response = requests.get(url, headers=headers)
print(response.json())
```

---

## GET /rest/dli/files/{id}/versions/{version_id}/content

**Summary:** Download specified version

Downloads the binary content of the specified file version. Supports partial downloads via the Range header.

**Parameters:**

| Name | In | Required | Description |
|------|----|----------|-------------|
| `id` | path | yes | ID of the file |
| `version_id` | path | yes | version ID for which to retrieve content |
| `Range` | header | no | Range of bytes to download. e.g. `bytes=0-1024` |

**Responses:**

| Code | Description |
|------|-------------|
| 200 | Version content returned as a binary stream. |
| 403 | Forbidden  <i>Possible error codes: </i>ERR_LICENSE_DLI, ERR_ACCESS_USER |
| 490 | Request blocked by WAF |

**Response Examples:**

**403 (ERR_LICENSE_DLI):**

```json
{
  "errors": {
    "code": "ERR_LICENSE_DLI",
    "message": "Feature DLI is not enabled by license"
  }
}
```

**403 (ERR_ACCESS_USER):**

```json
{
  "errors": {
    "code": "ERR_ACCESS_USER",
    "message": "Insufficient access permissions"
  }
}
```

**Code Samples:**

**cURL:**

```shell
curl -X GET \
  "https://{instance}.kiteworks.com/rest/dli/files/:id/versions/:version_id/content" \
  -H "Authorization: Bearer YOUR_TOKEN"
```

**Python:**

```python
import requests

id = "VALUE"  # ID of the file
version_id = "VALUE"  # version ID for which to retrieve content

url = f"https://{{instance}}.kiteworks.com/rest/dli/files/{id}/versions/{version_id}/content"
headers = {
    "Authorization": "Bearer YOUR_TOKEN",
}
response = requests.get(url, headers=headers)
print(response.json())
```

---

## GET /rest/dli/folders/{folderId}/users/{userId}/activities

**Summary:** Return the list of activities for this folder of the specified user

Returns all activities performed by the specified user on the specified folder. Each activity includes the affected object, a human-readable message, the acting user, and whether the action was successful. Requires admin privileges.

**Parameters:**

| Name | In | Required | Description |
|------|----|----------|-------------|
| `folderId` | path | yes | The unique identifier of the folder. |
| `userId` | path | yes | The unique identifier of the user. |
| `noDayBack` | query | no | Number of days back to search |
| `startDate` | query | no | Start date |
| `endDate` | query | no | End date |
| `filter` | query | no | Filter activities by scope. Accepted values: `all`, `my`. |
| `search` | query | no | Search by mail body, subject and sender/recipients |
| `type` | query | no | Filter activities by type. Accepted values: `all`, `folder_changes`, `file_changes`, `user_preferences`, `mail`, `tasks`, `comments`, `kitepoint`. |
| `transactionId` | query | no | Transaction ID associated with the activities |
| `orderBy` | query | no | Sorting options |
| `offset` | query | no | Offset |
| `limit` | query | no | Limit |
| `with` | query | no | With parameters |
| `mode` | query | no | Determines the detail level of the response body. |

**Responses:**

| Code | Description |
|------|-------------|
| 200 | List of folder activities for the user retrieved successfully. |
| 403 | Forbidden  <i>Possible error codes: </i>ERR_LICENSE_DLI, ERR_ACCESS_USER |
| 490 | Request blocked by WAF |

**Response Examples:**

**200 (FolderActivities):**

```json
{
  "data": [
    {
      "object": {
        "id": "f0e1d2c3-b4a5-6789-0fed-cba987654321",
        "name": "Q1 Reports",
        "type": "folder"
      },
      "message": "User uploaded file to Q1 Reports",
      "directUser": {
        "id": "u1a2b3c4-d5e6-7890-abcd-ef1234567890",
        "name": "Alice Smith",
        "email": "alice@example.com"
      },
      "successful": 1
    }
  ]
}
```

**403 (ERR_LICENSE_DLI):**

```json
{
  "errors": {
    "code": "ERR_LICENSE_DLI",
    "message": "Feature DLI is not enabled by license"
  }
}
```

**403 (ERR_ACCESS_USER):**

```json
{
  "errors": {
    "code": "ERR_ACCESS_USER",
    "message": "Insufficient access permissions"
  }
}
```

**Code Samples:**

**cURL:**

```shell
curl -X GET \
  "https://{instance}.kiteworks.com/rest/dli/folders/:folderId/users/:userId/activities" \
  -H "Authorization: Bearer YOUR_TOKEN"
```

**Python:**

```python
import requests

folderId = "VALUE"  # The unique identifier of the folder.
userId = "VALUE"  # The unique identifier of the user.

url = f"https://{{instance}}.kiteworks.com/rest/dli/folders/{folderId}/users/{userId}/activities"
headers = {
    "Authorization": "Bearer YOUR_TOKEN",
}
response = requests.get(url, headers=headers)
print(response.json())
```

---

## GET /rest/dli/folders/{id}

**Summary:** Retrieve folder information.

Returns metadata for the specified folder, including its name, creation date, deletion status, and permalink.

**Parameters:**

| Name | In | Required | Description |
|------|----|----------|-------------|
| `id` | path | yes | The unique identifier of the folder. |
| `with` | query | no | With parameters |
| `mode` | query | no | Determines the detail level of the response body. |

**Responses:**

| Code | Description |
|------|-------------|
| 200 | Folder metadata retrieved successfully. |
| 403 | Forbidden  <i>Possible error codes: </i>ERR_LICENSE_DLI, ERR_ACCESS_USER |
| 490 | Request blocked by WAF |

**Response Examples:**

**200 (FolderInfo):**

```json
{
  "id": "f0e1d2c3-b4a5-6789-0fed-cba987654321",
  "name": "Q1 Reports",
  "created": "2023-11-01T08:00:00Z",
  "modified": "2024-02-14T12:30:00Z",
  "deleted": false,
  "parentId": "root-folder-guid",
  "permalink": "https://example.com/w/f0e1d2c3"
}
```

**403 (ERR_LICENSE_DLI):**

```json
{
  "errors": {
    "code": "ERR_LICENSE_DLI",
    "message": "Feature DLI is not enabled by license"
  }
}
```

**403 (ERR_ACCESS_USER):**

```json
{
  "errors": {
    "code": "ERR_ACCESS_USER",
    "message": "Insufficient access permissions"
  }
}
```

**Code Samples:**

**cURL:**

```shell
curl -X GET \
  "https://{instance}.kiteworks.com/rest/dli/folders/:id" \
  -H "Authorization: Bearer YOUR_TOKEN"
```

**Python:**

```python
import requests

id = "VALUE"  # The unique identifier of the folder.

url = f"https://{{instance}}.kiteworks.com/rest/dli/folders/{id}"
headers = {
    "Authorization": "Bearer YOUR_TOKEN",
}
response = requests.get(url, headers=headers)
print(response.json())
```

---

## GET /rest/dli/mail/{id}/attachments

**Summary:** List email attachments

Returns a paginated list of all attachments for the specified email, including each attachment's ID, name, size, MIME type, and content fingerprint.

**Parameters:**

| Name | In | Required | Description |
|------|----|----------|-------------|
| `id` | path | yes | The unique identifier of the email containing the attachment. |
| `ref` | query | no | The reference code for the email. Required if the email can be accessed without authentication. |
| `offset` | query | no | Offset |
| `limit` | query | no | Limit |
| `locate_id` | query | no | If specified, "offset" parameter will be ignored                                             and the page containing entity with this Id will be returned. |
| `with` | query | no | With parameters |
| `mode` | query | no | Determines the detail level of the response body. |

**Responses:**

| Code | Description |
|------|-------------|
| 200 | List of email attachments retrieved successfully. |
| 403 | Forbidden  <i>Possible error codes: </i>ERR_LICENSE_DLI, ERR_ACCESS_USER |
| 490 | Request blocked by WAF |

**Response Examples:**

**200 (AttachmentList):**

```json
{
  "data": [
    {
      "attachmentId": "att-guid-001",
      "name": "invoice.pdf",
      "size": 51200,
      "mime": "application/pdf",
      "fingerprint": "abc123def456",
      "created": "2024-03-15T09:00:00Z",
      "deleted": false,
      "emailPackageId": "p1a2b3c4-d5e6-7890-abcd-ef1234567890"
    }
  ],
  "metadata": {
    "total": 1,
    "limit": 50,
    "offset": 0
  }
}
```

**403 (ERR_LICENSE_DLI):**

```json
{
  "errors": {
    "code": "ERR_LICENSE_DLI",
    "message": "Feature DLI is not enabled by license"
  }
}
```

**403 (ERR_ACCESS_USER):**

```json
{
  "errors": {
    "code": "ERR_ACCESS_USER",
    "message": "Insufficient access permissions"
  }
}
```

**Code Samples:**

**cURL:**

```shell
curl -X GET \
  "https://{instance}.kiteworks.com/rest/dli/mail/:id/attachments" \
  -H "Authorization: Bearer YOUR_TOKEN"
```

**Python:**

```python
import requests

id = "VALUE"  # The unique identifier of the email containing the attachment.

url = f"https://{{instance}}.kiteworks.com/rest/dli/mail/{id}/attachments"
headers = {
    "Authorization": "Bearer YOUR_TOKEN",
}
response = requests.get(url, headers=headers)
print(response.json())
```

---

## GET /rest/dli/mail/{id}/recipients

**Summary:** List Recipients

Returns a paginated list of all recipients (To, CC, and BCC) for the specified email, including each recipient's user ID, email address, and recipient type.

**Parameters:**

| Name | In | Required | Description |
|------|----|----------|-------------|
| `id` | path | yes | ID of the email |
| `type` | query | no | Filter recipients by type. Accepted values: `0`, `1`, `2`. |
| `ref` | query | no | The reference ID of the email (Mandatory if the email can be accessed without authentication). |
| `orderBy` | query | no | Sorting options |
| `offset` | query | no | Offset |
| `limit` | query | no | Limit |
| `locate_id` | query | no | If specified, "offset" parameter will be ignored                                             and the page containing entity with this Id will be returned. |
| `with` | query | no | With parameters |
| `mode` | query | no | Determines the detail level of the response body. |

**Responses:**

| Code | Description |
|------|-------------|
| 200 | List of email recipients retrieved successfully. |
| 403 | Forbidden  <i>Possible error codes: </i>ERR_LICENSE_DLI, ERR_ACCESS_USER |
| 490 | Request blocked by WAF |

**Response Examples:**

**200 (RecipientList):**

```json
{
  "data": [
    {
      "userId": "u1a2b3c4-d5e6-7890-abcd-ef1234567890",
      "email": "alice@example.com",
      "type": 1
    },
    {
      "userId": "u2b3c4d5-e6f7-8901-bcde-f12345678901",
      "email": "bob@example.com",
      "type": 2
    }
  ],
  "metadata": {
    "total": 2,
    "limit": 50,
    "offset": 0
  }
}
```

**403 (ERR_LICENSE_DLI):**

```json
{
  "errors": {
    "code": "ERR_LICENSE_DLI",
    "message": "Feature DLI is not enabled by license"
  }
}
```

**403 (ERR_ACCESS_USER):**

```json
{
  "errors": {
    "code": "ERR_ACCESS_USER",
    "message": "Insufficient access permissions"
  }
}
```

**Code Samples:**

**cURL:**

```shell
curl -X GET \
  "https://{instance}.kiteworks.com/rest/dli/mail/:id/recipients" \
  -H "Authorization: Bearer YOUR_TOKEN"
```

**Python:**

```python
import requests

id = "VALUE"  # ID of the email

url = f"https://{{instance}}.kiteworks.com/rest/dli/mail/{id}/recipients"
headers = {
    "Authorization": "Bearer YOUR_TOKEN",
}
response = requests.get(url, headers=headers)
print(response.json())
```

---

## GET /rest/dli/users/{id}/activities

**Summary:** Return the list of all activities of the specified user

Returns all activities performed by or on behalf of the specified user. Each activity includes the affected object, a human-readable message, the acting user, and whether the action was successful. Requires admin privileges.

**Parameters:**

| Name | In | Required | Description |
|------|----|----------|-------------|
| `id` | path | yes | ID of the user |
| `noDayBack` | query | no | Number of days back to search |
| `startDate` | query | no | Start date |
| `endDate` | query | no | End date |
| `filter` | query | no | Filter activities by scope. Accepted values: `all`, `my`. |
| `search` | query | no | Search by mail body, subject and sender/recipients |
| `type` | query | no | Filter activities by type. Accepted values: `all`, `folder_changes`, `file_changes`, `user_preferences`, `mail`, `tasks`, `comments`, `kitepoint`. |
| `transactionId` | query | no | Transaction ID associated with the activities |
| `orderBy` | query | no | Sorting options |
| `offset` | query | no | Offset |
| `limit` | query | no | Limit |
| `with` | query | no | With parameters |
| `mode` | query | no | Determines the detail level of the response body. |

**Responses:**

| Code | Description |
|------|-------------|
| 200 | List of user activities retrieved successfully. |
| 403 | Forbidden  <i>Possible error codes: </i>ERR_LICENSE_DLI, ERR_ACCESS_USER |
| 490 | Request blocked by WAF |

**Response Examples:**

**200 (UserActivities):**

```json
{
  "data": [
    {
      "object": {
        "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
        "name": "contract.pdf",
        "type": "file"
      },
      "message": "User downloaded file contract.pdf",
      "directUser": {
        "id": "u1a2b3c4-d5e6-7890-abcd-ef1234567890",
        "name": "Alice Smith",
        "email": "alice@example.com"
      },
      "successful": 1
    }
  ]
}
```

**403 (ERR_LICENSE_DLI):**

```json
{
  "errors": {
    "code": "ERR_LICENSE_DLI",
    "message": "Feature DLI is not enabled by license"
  }
}
```

**403 (ERR_ACCESS_USER):**

```json
{
  "errors": {
    "code": "ERR_ACCESS_USER",
    "message": "Insufficient access permissions"
  }
}
```

**Code Samples:**

**cURL:**

```shell
curl -X GET \
  "https://{instance}.kiteworks.com/rest/dli/users/:id/activities" \
  -H "Authorization: Bearer YOUR_TOKEN"
```

**Python:**

```python
import requests

id = "VALUE"  # ID of the user

url = f"https://{{instance}}.kiteworks.com/rest/dli/users/{id}/activities"
headers = {
    "Authorization": "Bearer YOUR_TOKEN",
}
response = requests.get(url, headers=headers)
print(response.json())
```

---

## GET /rest/dli/users/{id}/mail

**Summary:** Retrieve information about the mail specified be a user

Returns a paginated list of all emails sent or received by the specified user, including emails where the user is the sender and emails where the user appears as a recipient.

**Parameters:**

| Name | In | Required | Description |
|------|----|----------|-------------|
| `id` | path | yes | ID of the user |
| `senderId` | query | no | Unique identifier of User who sent Email |
| `senderId:in` | query | no | Unique identifier of User who sent Email. Search for results that match any of the specified values for this parameter. |
| `isRecipient` | query | no | Filter emails where the current user is a recipient. |
| `read` | query | no | Whether the email is read or not by the current user. |
| `date` | query | no | Email creation date |
| `date:gt` | query | no | Email creation date. Search for results where this parameter value is greater than the specified value. |
| `date:gte` | query | no | Email creation date. Search for results where this parameter value is greater than or equal to the specified value. |
| `date:lt` | query | no | Email creation date. Search for results where this parameter value is less than the specified value. |
| `date:lte` | query | no | Email creation date. Search for results where this parameter value is less than or equal to the specified value. |
| `modified_date` | query | no | Email modification date |
| `modified_date:gt` | query | no | Email modification date. Search for results where this parameter value is greater than the specified value. |
| `modified_date:gte` | query | no | Email modification date. Search for results where this parameter value is greater than or equal to the specified value. |
| `modified_date:lt` | query | no | Email modification date. Search for results where this parameter value is less than the specified value. |
| `modified_date:lte` | query | no | Email modification date. Search for results where this parameter value is less than or equal to the specified value. |
| `deleted` | query | no | Filter emails based on whether they have been deleted. |
| `emailPackageId` | query | no | Email Package unique identifier |
| `emailPackageId:in` | query | no | Email Package unique identifier. Search for results that match any of the specified values for this parameter. |
| `templateId` | query | no | Email Template unique identifier |
| `templateId:in` | query | no | Email Template unique identifier. Search for results that match any of the specified values for this parameter. |
| `status` | query | no | Filter emails by status. Accepted values: `sent`, `draft`, `queued`, `error`, `self_send`, `transferring`. |
| `isPreview` | query | no | Whether the email is a preview email |
| `isUserSent` | query | no | Whether the email was sent by some user |
| `bucket` | query | no | Filter emails by bucket. Accepted values: `draft`, `inbox`, `outgoing`, `sent`, `trash`. |
| `returnCustomWebForm` | query | no | Return all emails including those with the custom web form. |
| `customWebFormOnly` | query | no | Return only emails with the custom web form |
| `webFormId` | query | no | Email web form ID |
| `webFormId:contains` | query | no | Email web form ID. Search for results that contain the specified characters in this parameter. |
| `orderBy` | query | no | Sorting options |
| `offset` | query | no | Offset |
| `limit` | query | no | Limit |
| `locate_id` | query | no | If specified, "offset" parameter will be ignored                                             and the page containing entity with this Id will be returned. |
| `with` | query | no | With parameters |
| `mode` | query | no | Determines the detail level of the response body. |

**Responses:**

| Code | Description |
|------|-------------|
| 200 | List of emails retrieved successfully. |
| 403 | Forbidden  <i>Possible error codes: </i>ERR_LICENSE_DLI, ERR_ACCESS_USER |
| 490 | Request blocked by WAF |

**Response Examples:**

**200 (EmailList):**

```json
{
  "data": [
    {
      "id": "e1a2b3c4-d5e6-7890-abcd-ef1234567890",
      "senderId": "u1a2b3c4-d5e6-7890-abcd-ef1234567890",
      "subject": "Q1 Report",
      "status": "sent",
      "type": "standard",
      "date": "2024-03-15",
      "deleted": false,
      "emailPackageId": "p1a2b3c4-d5e6-7890-abcd-ef1234567890"
    }
  ],
  "metadata": {
    "total": 1,
    "limit": 50,
    "offset": 0
  }
}
```

**403 (ERR_LICENSE_DLI):**

```json
{
  "errors": {
    "code": "ERR_LICENSE_DLI",
    "message": "Feature DLI is not enabled by license"
  }
}
```

**403 (ERR_ACCESS_USER):**

```json
{
  "errors": {
    "code": "ERR_ACCESS_USER",
    "message": "Insufficient access permissions"
  }
}
```

**Code Samples:**

**cURL:**

```shell
curl -X GET \
  "https://{instance}.kiteworks.com/rest/dli/users/:id/mail" \
  -H "Authorization: Bearer YOUR_TOKEN"
```

**Python:**

```python
import requests

id = "VALUE"  # ID of the user

url = f"https://{{instance}}.kiteworks.com/rest/dli/users/{id}/mail"
headers = {
    "Authorization": "Bearer YOUR_TOKEN",
}
response = requests.get(url, headers=headers)
print(response.json())
```

---
