Trash (Recycle Bin)
The Trash API allows you to view deleted files, restore them to their original location, or permanently clear the recycle bin.
List Trash
Endpoint: GET /api/recycle/list
Retrieves a list of files currently in the recycle bin.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
page |
int | No | Page number. |
num |
int | No | Items per page. |
jsToken |
string | Yes | Session token. |
Code Examples
=== "cURL"
```bash
curl "https://1024terabox.com/api/recycle/list?page=1&num=100&jsToken=TOKEN" \
-H "Cookie: ndus=YOUR_COOKIE"
```
=== "Python"
```python
params = {'page': '1', 'num': '100', 'jsToken': js_token}
resp = session.get('https://1024terabox.com/api/recycle/list', params=params)
print(resp.json())
```
=== "Node.js"
```javascript
const resp = await client.get('/api/recycle/list', {
params: { page: 1, num: 100, jsToken: 'TOKEN' }
});
console.log(resp.data);
```
Restore Files
Endpoint: POST /api/recycle/restore
Restores files from the trash to their original location.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
jsToken |
string | Yes | Session token. |
bdstoken |
string | Yes | Required for write operation. |
Body Data:
* fidlist: JSON array of File IDs (fs_id) to restore.
Code Examples
=== "cURL"
```bash
curl -X POST "https://1024terabox.com/api/recycle/restore?jsToken=TOKEN&bdstoken=TOKEN" \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "fidlist=[12345]"
```
=== "Python"
```python
fs_ids = [12345]
params = {'jsToken': js_token, 'bdstoken': bdstoken}
data = {'fidlist': json.dumps(fs_ids)}
session.post('https://1024terabox.com/api/recycle/restore', params=params, data=data)
```
=== "Node.js"
```javascript
const qs = require('qs');
const data = qs.stringify({
fidlist: JSON.stringify([12345])
});
await client.post('/api/recycle/restore', data, {
params: { jsToken: 'TOKEN', bdstoken: 'TOKEN' }
});
```
Empty Trash
Endpoint: POST /api/recycle/clear
Permanently deletes all files in the recycle bin. This cannot be undone.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
async |
int | No | 1 to run asynchronously. Default 1. |
jsToken |
string | Yes | Session token. |
bdstoken |
string | Yes | Required for write operation. |
Code Examples
=== "cURL"
```bash
curl -X POST "https://1024terabox.com/api/recycle/clear?async=1&jsToken=TOKEN&bdstoken=TOKEN"
```
=== "Python"
```python
params = {'async': '1', 'jsToken': js_token, 'bdstoken': bdstoken}
session.post('https://1024terabox.com/api/recycle/clear', params=params)
```
=== "Node.js"
```javascript
await client.post('/api/recycle/clear', null, {
params: { async: 1, jsToken: 'TOKEN', bdstoken: 'TOKEN' }
});
```