Skip to main content

Linux File & Folder Monitoring APIs

# Linux File & Folder Monitoring APIs

Gain real-time visibility and control over your Linux filesystem with our powerful monitoring APIs. Track file/folder creation, modification, and deletion events instantly, and retrieve comprehensive permission details—including owner, group, ACL-like access information, and exact read/write/execute rights.

These APIs are perfect for audit logging, security monitoring, compliance tracking, automated backups, or building custom file-watching workflows.

### Authentication
All endpoints require a valid Bearer token obtained from the `/token` endpoint.

**Headers (required for all requests):**
```
Authorization: Bearer {{token}}
Content-Type: application/json
```

### Base URL
Replace `{{base_url}}` with your actual API base URL (provided upon account setup).

---

### 1. File Action Monitoring API  
**Capture real-time file and folder events (Create, Modify, Delete)**

**Endpoint:**  
`POST {{base_url}}/base/fileAction`

**Query Parameters:**
| Parameter | Type   | Required | Description                                      |
|-----------|--------|----------|--------------------------------------------------|
| path      | string | Yes      | Absolute path of the file or folder to monitor   |

**Example Request:**
```http
POST {{base_url}}/base/fileAction?path=/home/hiteshkumar/Documents/reports
Authorization: Bearer {{token}}
```

**Success Response (200 OK):**
```json
[
  {
    "time": "2025-11-24T18:04:31.933000",
    "action": "CREATE",
    "path": "/home/hiteshkumar/Documents/reports/budget.xlsx",
    "user": "hiteshkumar"
  },
  {
    "time": "2025-11-24T18:15:22.104000",
    "action": "MODIFY",
    "path": "/home/hiteshkumar/Documents/reports/budget.xlsx",
    "user": "hiteshkumar"
  },
  {
    "time": "2025-11-24T19:02:11.567000",
    "action": "DELETE",
    "path": "/home/hiteshkumar/Desktop/old_backup.zip",
    "user": "hiteshkumar"
  }
]
```

**Possible Action Values:**
- `CREATE` → New file or directory created
- `MODIFY` → File content or metadata changed
- `DELETE` → File or directory removed

**Error Response (404 Not Found):**
```json
{
  "detail": "No events found"
}
```

> **Use Case:** Ideal for building audit trails, triggering backups on file changes, or alerting on unauthorized deletions.

---

### 2. File & Folder Permissions API  
**Retrieve complete permission and ownership details**

**Endpoint:**  
`POST {{base_url}}/base/filePermissions`

**Query Parameters:**
| Parameter | Type   | Required | Description                                      |
|-----------|--------|----------|--------------------------------------------------|
| path      | string | Yes      | Absolute path of the file or folder to inspect   |

**Example Request:**
```http
POST {{base_url}}/base/filePermissions?path=/home/hiteshkumar/shared/project_data
Authorization: Bearer {{token}}
```

**Success Response (200 OK):**
```json
{
  "path": "/home/hiteshkumar/shared/project_data",
  "type": "directory",
  "owner": "hiteshkumar",
  "group": "developers",
  "permissions": {
    "owner": {
      "read": true,
      "write": true,
      "execute": true
    },
    "group": {
      "read": true,
      "write": true,
      "execute": false
    },
    "others": {
      "read": true,
      "write": false,
      "execute": false
    }
  },
  "users_with_access": [
    "hiteshkumar",
    "alice",
    "bob"
  ],
  "groups_with_access": {
    "developers": [
      "alice",
      "bob",
      "hiteshkumar"
    ]
  },
  "everyone_can_access": false
}
```

**Response Fields Explanation:**
| Field                  | Description                                                  |
|------------------------|--------------------------------------------------------------|
| type                   | `"file"` or `"directory"`                                    |
| owner / group          | System user and primary group owning the object              |
| permissions            | Boolean flags for read/write/execute per owner/group/others  |
| users_with_access      | List of individual users who have explicit access            |
| groups_with_access     | Groups and their members that grant access                   |
| everyone_can_access    | `true` if "others" have any permission (world-readable etc.)|

**Error Response (404 Not Found):**
```json
{
  "detail": "Path does not exist."
}
```

> **Use Case:** Perfect for compliance checks, security audits, access reviews, or automatically enforcing permission policies.

---

### Support & Questions
For Base URL, token issues, feature requests, or any questions about the Linux Monitoring APIs or SFTP APIs, contact our support team:

**Email:** support@bizdata360.com  
**Help Center:** https://help.bizdata360.com/link/142

We’re here to help you build secure, automated, and efficient file workflows!