# Kiteworks API — activities Operations

**2 endpoints** | [Browse interactive reference](https://developer.kiteworks.com/api-reference/activities.html) | [Download spec slice](https://developer.kiteworks.com/assets/specs/activities.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/activities

**Summary:** Get all activities

Returns the activity log for the authenticated user across all files and folders they have access to.

**Parameters:**

| Name | In | Required | Description |
|------|----|----------|-------------|
| `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 | Returns a list of activity records for the authenticated user. |
| 490 | Request blocked by WAF |

**Response Examples:**

**200 (User activity list):**

```json
[
  {
    "id": 1002,
    "event": "upload",
    "message": "User uploaded budget-2024.xlsx",
    "type": "f",
    "created": "2024-03-16T08:00:00+00:00",
    "successful": 1,
    "user": {
      "id": 5,
      "name": "Jane Smith"
    },
    "data": {
      "file": {
        "id": 8,
        "name": "budget-2024.xlsx"
      }
    }
  },
  {
    "id": 1001,
    "event": "download",
    "message": "User downloaded quarterly-report.pdf",
    "type": "f",
    "created": "2024-03-15T10:30:00+00:00",
    "successful": 1,
    "user": {
      "id": 5,
      "name": "Jane Smith"
    },
    "data": {
      "file": {
        "id": 7,
        "name": "quarterly-report.pdf"
      }
    }
  }
]
```

**Code Samples:**

**cURL:**

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

**Python:**

```python
import requests

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

---

## GET /rest/files/{file_id}/activities

**Summary:** Get file activities

Returns the activity log for the specified file, scoped to the authenticated user. **Requires `user_view` permission on the file.** For Repositories Gateway source files, `view` permission is required instead.

**Parameters:**

| Name | In | Required | Description |
|------|----|----------|-------------|
| `file_id` | path | yes | The unique identifier (UUID) of the file |
| `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 | Returns a list of activity records for the specified file. |
| 490 | Request blocked by WAF |

**Response Examples:**

**200 (File activity list):**

```json
[
  {
    "id": 1001,
    "event": "download",
    "message": "User downloaded quarterly-report.pdf",
    "type": "f",
    "created": "2024-03-15T10:30:00+00:00",
    "successful": 1,
    "user": {
      "id": 5,
      "name": "Jane Smith"
    },
    "data": {
      "file": {
        "id": 7,
        "name": "quarterly-report.pdf"
      }
    }
  },
  {
    "id": 1000,
    "event": "view",
    "message": "User viewed quarterly-report.pdf",
    "type": "f",
    "created": "2024-03-15T09:00:00+00:00",
    "successful": 1,
    "user": {
      "id": 5,
      "name": "Jane Smith"
    },
    "data": {
      "file": {
        "id": 7,
        "name": "quarterly-report.pdf"
      }
    }
  }
]
```

**Code Samples:**

**cURL:**

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

**Python:**

```python
import requests

file_id = "VALUE"  # The unique identifier (UUID) of the file

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

---
