@@ -36,16 +36,11 @@ Check API availability, status, and running version.
3636* ** Method:** ` GET `
3737* ** Auth Required:** No
3838
39- #### Example Request
40- ``` bash
41- curl http://localhost:8550/api/v1/health
42- ```
43-
4439#### Response (200 OK)
4540``` json
4641{
4742 "status" : " ok" ,
48- "version" : " 1.8.4 "
43+ "version" : " 1.8.8 "
4944}
5045```
5146
@@ -68,19 +63,10 @@ Retrieve metadata for files stored in Telegram Drive.
6863| ` search ` | String | Filter files by matching search term in filename |
6964| ` offset_id ` | Integer | Message ID offset for pagination |
7065| ` sort ` | String | Field to sort by: ` name ` , ` size ` , or ` created_at ` |
71- | ` order ` | String | Sort order: ` asc ` (ascending) or ` desc ` (descending) |
66+ | ` order ` | String | Sort order: ` asc ` or ` desc ` |
7267| ` mime_type ` | String | Filter files by a specific MIME type |
73- | ` created_after ` | String | Filter files created after date (ISO format) |
74- | ` created_before ` | String | Filter files created before date (ISO format) |
7568| ` size_min ` | Integer | Minimum file size in bytes |
7669| ` size_max ` | Integer | Maximum file size in bytes |
77- | ` fields ` | String | Comma-separated list of fields to include in response |
78-
79- #### Example Request
80- ``` bash
81- curl -H " X-API-Key: YOUR_API_KEY" \
82- " http://localhost:8550/api/v1/files?page=1&limit=20"
83- ```
8470
8571#### Response (200 OK)
8672``` json
@@ -102,12 +88,6 @@ Retrieve detailed metadata for a specific file.
10288* ** Method:** ` GET `
10389* ** Auth Required:** Yes
10490
105- #### Example Request
106- ``` bash
107- curl -H " X-API-Key: YOUR_API_KEY" \
108- http://localhost:8550/api/v1/files/123
109- ```
110-
11191#### Response (200 OK)
11292``` json
11393{
@@ -129,18 +109,6 @@ Stream or download a file directly from Telegram Drive.
129109* ** Method:** ` GET `
130110* ** Auth Required:** Yes
131111
132- #### Features Supported
133- * ** HTTP Range Requests** (e.g., seeking in videos/audios)
134- * ** Resumable Downloads**
135- * ** Direct Content Streaming**
136-
137- #### Example Request
138- ``` bash
139- curl -H " X-API-Key: YOUR_API_KEY" \
140- -o file.bin \
141- http://localhost:8550/api/v1/files/123/download
142- ```
143-
144112---
145113
146114### 5. Search Files
@@ -155,127 +123,202 @@ Search files by filename with optional filtering.
155123| Parameter | Type | Description |
156124| :--- | :--- | :--- |
157125| ` q ` | String | ** Required.** Search query string |
158- | ` folder_id ` | Integer | Optional folder ID filter |
159- | ` recursive ` | Boolean | Perform recursive search across folders |
160126
161- #### Example Request
162- ``` bash
163- curl -H " X-API-Key: YOUR_API_KEY" \
164- " http://localhost:8550/api/v1/files/search?q=python"
165- ```
127+ ---
128+
129+ ### 6. Upload File
130+ Upload a file to Telegram Drive.
131+
132+ * ** URL:** ` /files `
133+ * ** Method:** ` POST `
134+ * ** Auth Required:** Yes
135+ * ** Content-Type:** ` multipart/form-data `
136+
137+ #### Form Fields
138+ * ` file ` : Binary file content
139+ * ` folder_id ` (Optional): ID of target folder/channel
166140
167141#### Response (200 OK)
168142``` json
169- [
170- {
171- "id" : 123 ,
172- "name" : " python-guide.pdf" ,
173- "size" : 204800
174- }
175- ]
143+ {
144+ "id" : 123 ,
145+ "folder_id" : 456 ,
146+ "name" : " uploaded_file.txt" ,
147+ "size" : 1024 ,
148+ "mime_type" : " text/plain" ,
149+ "created_at" : " 2026-06-16T01:00:00Z"
150+ }
176151```
177152
178153---
179154
180- ### 6. Bulk Operations
181- Perform action operations (such as move or delete) across multiple files .
155+ ### 7. Delete File
156+ Delete a specific file .
182157
183- * ** URL:** ` /files/bulk `
158+ * ** URL:** ` /files/{message_id} `
159+ * ** Method:** ` DELETE `
160+ * ** Auth Required:** Yes
161+
162+ #### Query Parameters
163+ * ` folder_id ` (Optional): ID of folder containing the file
164+
165+ ---
166+
167+ ### 8. Copy File
168+ Forward a file/message to another folder.
169+
170+ * ** URL:** ` /files/{message_id}/copy `
184171* ** Method:** ` POST `
185172* ** Auth Required:** Yes
186173
187- #### Bulk Delete Request Body
174+ #### Request Body
188175``` json
189176{
190- "action " : " delete " ,
191- "file_ids " : [ 123 , 124 , 125 ]
177+ "folder_id " : 789 ,
178+ "source_folder_id " : 456
192179}
193180```
194181
195- #### Example Delete Request
196- ``` bash
197- curl -X POST \
198- -H " Content-Type: application/json " \
199- -H " X-API-Key: YOUR_API_KEY " \
200- -d ' {"action":"delete","file_ids":[123,124]} ' \
201- http://localhost:8550/api/v1/files/bulk
202- ```
182+ ---
183+
184+ ### 9. Update File (Rename / Move)
185+ Rename (edit description) or move a file.
186+
187+ * ** URL: ** ` /files/{message_id} `
188+ * ** Method: ** ` PATCH `
189+ * ** Auth Required: ** Yes
203190
204- #### Bulk Move Request Body
191+ #### Request Body (All fields optional)
205192``` json
206193{
207- "action" : " move" ,
208- "file_ids" : [123 ],
209- "folder_id" : 111 ,
210- "payload" : {
211- "folder_id" : 222
212- }
194+ "name" : " new_name.txt" ,
195+ "folder_id" : 789 ,
196+ "source_folder_id" : 456
213197}
214198```
215199
216- #### Example Move Request
217- ``` bash
218- curl -X POST \
219- -H " Content-Type: application/json" \
220- -H " X-API-Key: YOUR_API_KEY" \
221- -d ' {"action":"move","file_ids":[123],"folder_id":111,"payload":{"folder_id":222}}' \
222- http://localhost:8550/api/v1/files/bulk
223- ```
200+ ---
201+
202+ ### 10. Folder Management
203+
204+ #### List Folders
205+ * ** URL:** ` /folders `
206+ * ** Method:** ` GET `
207+
208+ #### Create Folder
209+ * ** URL:** ` /folders `
210+ * ** Method:** ` POST `
211+ * Request Body: ` {"name": "New Folder"} `
212+
213+ #### Rename Folder
214+ * ** URL:** ` /folders/{folder_id} `
215+ * ** Method:** ` PATCH `
216+ * Request Body: ` {"name": "New Folder Name"} `
217+
218+ #### Delete Folder
219+ * ** URL:** ` /folders/{folder_id} `
220+ * ** Method:** ` DELETE `
221+
222+ ---
223+
224+ ### 11. Storage Stats & Analytics
225+
226+ #### Storage Stats
227+ Retrieve total storage consumed, file counts, and breakdown by folders and MIME types.
228+ * ** URL:** ` /storage/stats `
229+ * ** Method:** ` GET `
224230
225231#### Response (200 OK)
226232``` json
227233{
228- "success" : true ,
229- "count" : 1
234+ "total_storage_used_bytes" : 10485760 ,
235+ "total_file_count" : 12 ,
236+ "folders" : [
237+ { "id" : 456 , "name" : " Documents" , "file_count" : 5 , "size_bytes" : 5242880 }
238+ ],
239+ "mime_types" : [
240+ { "mime_type" : " application/pdf" , "file_count" : 5 , "size_bytes" : 5242880 }
241+ ]
230242}
231243```
232244
245+ #### Duplicate Files Finder
246+ List groups of files with identical filenames and sizes.
247+ * ** URL:** ` /storage/duplicates `
248+ * ** Method:** ` GET `
249+
250+ #### Empty Folders
251+ List folders that do not contain any files.
252+ * ** URL:** ` /folders/empty `
253+ * ** Method:** ` GET `
254+
233255---
234256
235- ## Error Responses
257+ ### 12. File Media & Thumbnails
236258
237- The API returns standardized JSON error formats on failure:
259+ #### Get File Thumbnail
260+ Return the raw binary image data for a file's thumbnail.
261+ * ** URL:** ` /files/{message_id}/thumbnail `
262+ * ** Method:** ` GET `
263+ * Query Param: ` folder_id ` (Optional)
264+
265+ #### Get Extended Media Info
266+ Return video duration, resolution, audio title, or audio performer metadata.
267+ * ** URL:** ` /files/{message_id}/media-info `
268+ * ** Method:** ` GET `
269+ * Query Param: ` folder_id ` (Optional)
270+
271+ ---
272+
273+ ### 13. Bulk Operations
274+ Perform action operations (such as move, delete, or archive) across multiple files.
238275
239- ### Unauthorized (Invalid API Key)
240- * ** Status:** ` 401 Unauthorized `
276+ * ** URL:** ` /files/bulk `
277+ * ** Method:** ` POST `
278+ * ** Auth Required:** Yes
279+
280+ #### Bulk Archive (Zip Download)
281+ Download selected files as a zip archive stream.
241282``` json
242283{
243- "error" : {
244- "code" : " UNAUTHORIZED" ,
245- "message" : " Invalid API key"
246- }
284+ "action" : " archive" ,
285+ "file_ids" : [123 , 124 , 125 ],
286+ "folder_id" : 456
247287}
248288```
249289
250- ### Missing API Key
251- * ** Status:** ` 401 Unauthorized `
290+ #### Bulk Delete
252291``` json
253292{
254- "error" : {
255- "code" : " UNAUTHORIZED" ,
256- "message" : " Missing X-API-Key header"
257- }
293+ "action" : " delete" ,
294+ "file_ids" : [123 , 124 , 125 ],
295+ "folder_id" : 456
258296}
259297```
260298
261- ### File Not Found
262- * ** Status:** ` 404 Not Found `
299+ #### Bulk Move
263300``` json
264301{
265- "error" : {
266- "code" : " NOT_FOUND" ,
267- "message" : " File not found"
302+ "action" : " move" ,
303+ "file_ids" : [123 ],
304+ "folder_id" : 111 ,
305+ "payload" : {
306+ "folder_id" : 222
268307 }
269308}
270309```
271310
272- ### Invalid Request Action
273- * ** Status:** ` 400 Bad Request `
311+ ---
312+
313+ ## Error Responses
314+
315+ The API returns standardized JSON error formats on failure:
316+
274317``` json
275318{
276319 "error" : {
277- "code" : " INVALID_ACTION " ,
278- "message" : " Unsupported bulk action "
320+ "code" : " UNAUTHORIZED " ,
321+ "message" : " Invalid API key "
279322 }
280323}
281324```
0 commit comments