Trash
The Trash API lets you list, restore, and permanently delete files and folders from your Egnyte domain's trash. Only administrators and power users with trash management privileges can access trash contents.
Note: The v1 Trash Contents endpoint is deprecated. Use the v2 endpoint for new integrations.
Base URL
https://{domain}.egnyte.com/pubapi/v1/fs/trash
https://{domain}.egnyte.com/pubapi/v2/fs/trash
Authentication
All requests require an OAuth 2.0 Bearer token in the Authorization header:
Authorization: Bearer {access_token}
See Authentication for details on obtaining a token.
List Trash Contents (v1)
Deprecated: This endpoint will be removed in a future release. Use List Trash Contents (v2) instead.
Retrieve a paginated list of all items in the trash.
Request
GET /pubapi/v1/fs/trash
Query Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
sort_by | string | No | date_deleted | Field to sort by. Options: date_deleted, name, deleted_by, purge_date |
sort_direction | string | No | desc | Sort order. Options: asc, desc |
count | integer | No | 50 | Number of entries per page |
offset | integer | No | 0 | Zero-based index of the first entry to return |
Example Request
curl -i -X GET "https://{domain}.egnyte.com/pubapi/v1/fs/trash?count=10&offset=0" \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN"
Response
200 OK
| Field | Type | Description |
|---|---|---|
count | integer | Number of items returned in this response |
offset | integer | Zero-based offset of the first item |
total_count | integer | Total number of items in trash |
items | array | Array of trash item objects |
items[].id | string | Unique identifier for the trash item |
items[].type | string | Item type: folder, file or version |
items[].path | string | Original path before deletion |
items[].name | string | Item name |
items[].size | integer | File size in bytes (files only) |
items[].deleted_by | string | Full name of user who deleted the item |
items[].delete_date | string | ISO-8601 timestamp when item was deleted |
items[].purge_date | string | ISO-8601 timestamp when item will be permanently deleted |
items[].last_modified | string | ISO-8601 timestamp of last modification before deletion |
items[].owner | object | Owner information (files only) |
items[].data_retention_info | object | Data retention information, if domain has data retention enabled |
items[].data_retention_info.retention | string | Reason for retention: RETENTION_POLICY, GRACE_PERIOD, or DEFAULT_RETENTION_PERIOD |
items[].data_retention_info.earliest_expiry | string | Unix timestamp of when item's retention will expire |
items[].data_retention_info.is_retained | boolean | Whether item is retained |
Example Response
{
"count": 2,
"offset": 0,
"items": [
{
"id": "NWM5ZTViMWMtOWMxNS00MDM3LWE5NjgtYTkzYzlhNTgzZjg4fDE0NjA5OTU4OTgwOTh8ZmlsZQ",
"type": "file",
"path": "/Private/asmith/2013-06-22 12.36.20.jpg",
"size": 1733,
"owner": {
"_self": {
"url": "/rest/public/1.0/users/1"
},
"id": 1,
"username": "asmith",
"firstName": "Ashley",
"lastName": "Smith",
"email": "asmith@abccompany.com",
"typeName": "admin"
},
"name": "2013-06-22 12.36.20.jpg",
"deleted_by": "Ashley Smith",
"delete_date": "2016-04-18T16:11:38Z",
"purge_date": "2016-05-19T00:00:00Z",
"last_modified": "2016-04-18T16:11:09Z"
},
{
"id": "Y2U3MDVlNmItOWJhYS00ZjA2LTk5Y2EtNTZlMzA4YjFmNTkzfDE0NjA5OTU4OTc4OTZ8ZmlsZQ",
"type": "folder",
"path": "/Shared/test1/sampleFolder",
"deleted_by": "Cara de Freitas Bart",
"delete_date": "2016-04-18T16:11:37Z",
"purge_date": "2016-05-19T00:00:00Z",
"name": "sampleFolder"
}
],
"total_count": 2
}
List Trash Contents (v2)
Retrieve a paginated list of all items in the trash with optional filtering by user and date range.
Request
GET /pubapi/v2/fs/trash
Query Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
sort_by | string | No | date_deleted | Field to sort by. Options: date_deleted, name, deleted_by, purge_date, orig_location, owner, type |
sort_direction | string | No | desc | Sort order. Options: asc, desc |
count | integer | No | 50 | Number of entries per page |
offset | integer | No | 0 | Zero-based index of the first entry to return |
deletedBy | string | No | — | Filter by user's first and/or last name (URL-encoded) |
startDate | string | No | — | Start of date range in ISO-8601 format (e.g., 2016-04-18T16:11:38Z). Required if deletedBy or endDate is used |
endDate | string | No | — | End of date range in ISO-8601 format. Required if deletedBy or startDate is used |
Example Request
curl -i -X GET "https://{domain}.egnyte.com/pubapi/v2/fs/trash?count=10&offset=0&startDate=2016-04-01T00:00:00Z&endDate=2016-04-30T23:59:59Z" \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN"
Response
200 OK
| Field | Type | Description |
|---|---|---|
count | integer | Number of items returned in this response |
offset | integer | Zero-based offset of the first item |
has_more | boolean | Whether additional pages are available |
items | array | Array of trash item objects (same structure as v1) |
Example Response
{
"count": 2,
"offset": 0,
"items": [
{
"id": "NWM5ZTViMWMtOWMxNS00MDM3LWE5NjgtYTkzYzlhNTgzZjg4fDE0NjA5OTU4OTgwOTh8ZmlsZQ",
"type": "file",
"path": "/Private/asmith/2013-06-22 12.36.20.jpg",
"size": 1733,
"owner": {
"_self": {
"url": "/rest/public/1.0/users/1"
},
"id": 1,
"username": "asmith",
"firstName": "Ashley",
"lastName": "Smith",
"email": "asmith@abccompany.com",
"typeName": "admin"
},
"name": "2013-06-22 12.36.20.jpg",
"deleted_by": "Ashley Smith",
"delete_date": "2016-04-18T16:11:38Z",
"purge_date": "2016-05-19T00:00:00Z",
"last_modified": "2016-04-18T16:11:09Z"
},
{
"id": "Y2U3MDVlNmItOWJhYS00ZjA2LTk5Y2EtNTZlMzA4YjFmNTkzfDE0NjA5OTU4OTc4OTZ8ZmlsZQ",
"type": "folder",
"path": "/Shared/test1/sampleFolder",
"deleted_by": "Cara de Freitas Bart",
"delete_date": "2016-04-18T16:11:37Z",
"purge_date": "2016-05-19T00:00:00Z",
"name": "sampleFolder"
}
],
"has_more": false
}
Get Trash Total Count
Retrieve the total count of items in the trash without fetching the full list. Use this endpoint before paginating with the v2 list endpoint.
Request
GET /pubapi/v2/fs/trash/totalcount
Example Request
curl -i -X GET "https://{domain}.egnyte.com/pubapi/v2/fs/trash/totalcount" \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN"
Response
200 OK
| Field | Type | Description |
|---|---|---|
totalCount | integer | Total number of items in trash |
Example Response
{
"totalCount": 2
}
Restore Items from Trash
Restore up to 10 files, folders, or versions from the trash to their original locations.
Request
POST /pubapi/v1/fs/trash
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
action | string | Yes | Must be RESTORE |
ids | array | Yes | Array of trash item IDs to restore (max 10) |
Example Request
curl -i -X POST "https://{domain}.egnyte.com/pubapi/v1/fs/trash" \ -H "Content-Type: application/json" \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \ -d '{ "action": "RESTORE", "ids": [ "NWM5ZTViMWMtOWMxNS00MDM3LWE5NjgtYTkzYzlhNTgzZjg4fDE0NjA5OTU4OTgwOTh8ZmlsZQ", "Y2U3MDVlNmItOWJhYS00ZjA2LTk5Y2EtNTZlMzA4YjFmNTkzfDE0NjA5OTU4OTc4OTZ8ZmlsZQ" ] }'
Response
200 OK
All items were successfully restored. No response body.
207 Multi-Status
Some items were restored successfully, others failed.
| Field | Type | Description |
|---|---|---|
resources | array | Array of result objects |
resources[].id | string | Trash item ID |
resources[].code | string | HTTP status code for this item |
resources[].descriptions | string | Error description (only present if code is not 200) |
Example Response (207)
{
"resources": [
{
"id": "NWM5ZTViMWMtOWMxNS00MDM3LWE5NjgtYTkzYzlhNTgzZjg4fDE0NjA5OTU4OTgwOTh8ZmlsZQ",
"code": "200"
},
{
"id": "Y2U3MDVlNmItOWJhYS00ZjA2LTk5Y2EtNTZlMzA4YjFmNTkzfDE0NjA5OTU4OTc4OTZ8ZmlsZQ",
"code": "404",
"descriptions": "Item is not in the trash"
}
]
}
Permanently Delete Items from Trash
Permanently delete up to 10 files, folders, or versions from the trash. This action cannot be undone.
Warning: Purged items cannot be recovered. Ensure you have the correct IDs before executing this request.
Request
POST /pubapi/v1/fs/trash
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
action | string | Yes | Must be PURGE |
ids | array | Yes | Array of trash item IDs to permanently delete (max 10) |
Example Request
curl -i -X POST "https://{domain}.egnyte.com/pubapi/v1/fs/trash" \ -H "Content-Type: application/json" \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \ -d '{ "action": "PURGE", "ids": [ "NWM5ZTViMWMtOWMxNS00MDM3LWE5NjgtYTkzYzlhNTgzZjg4fDE0NjA5OTU4OTgwOTh8ZmlsZQ", "Y2U3MDVlNmItOWJhYS00ZjA2LTk5Y2EtNTZlMzA4YjFmNTkzfDE0NjA5OTU4OTc4OTZ8ZmlsZQ" ] }'
Response
200 OK
All items were successfully purged. No response body.
207 Multi-Status
Some items were purged successfully, others failed.
| Field | Type | Description |
|---|---|---|
resources | array | Array of result objects |
resources[].id | string | Trash item ID |
resources[].code | string | HTTP status code for this item |
resources[].descriptions | string | Error description (only present if code is not 200) |
Example Response (207)
{
"resources": [
{
"id": "NWM5ZTViMWMtOWMxNS00MDM3LWE5NjgtYTkzYzlhNTgzZjg4fDE0NjA5OTU4OTgwOTh8ZmlsZQ",
"code": "200"
},
{
"id": "Y2U3MDVlNmItOWJhYS00ZjA2LTk5Y2EtNTZlMzA4YjFmNTkzfDE0NjA5OTU4OTc4OTZ8ZmlsZQ",
"code": "404",
"descriptions": "Item is not in the trash"
}
]
}
Error Codes
| Status | Error | Description | Resolution |
|---|---|---|---|
| 401 | Unauthorized | Invalid or expired token | Refresh your OAuth token |
| 403 | Forbidden | User is not authorized to manage trash | Ensure the authenticated user is an administrator or power user with trash management privileges |
| 404 | Not Found | Item is not in the trash | Verify the item ID is correct and the item is in the trash |
| 429 | Rate Limited | Too many requests | Implement exponential backoff; check Retry-After header |
Code Examples
GET /pubapi/v2/fs/trash?count=10&offset=0
curl -i -X GET "https://{domain}.egnyte.com/pubapi/v2/fs/trash?count=10&offset=0" \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN"
POST /pubapi/v1/fs/trash
curl -i -X POST "https://{domain}.egnyte.com/pubapi/v1/fs/trash" \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \ -d '{"action":"RESTORE","ids":["NWM5ZTViMWMtOWMxNS00MDM3LWE5NjgtYTkzYzlhNTgzZjg4fDE0NjA5OTU4OTgwOTh8ZmlsZQ"]}'
Related Resources
- File System API — Create, read, update, and delete files and folders
- Authentication — How to obtain and refresh OAuth tokens
- Best Practices — Rate limiting, pagination, and error handling
