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

ParameterTypeRequiredDefaultDescription
sort_bystringNodate_deletedField to sort by. Options: date_deleted, name, deleted_by, purge_date
sort_directionstringNodescSort order. Options: asc, desc
countintegerNo50Number of entries per page
offsetintegerNo0Zero-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

FieldTypeDescription
countintegerNumber of items returned in this response
offsetintegerZero-based offset of the first item
total_countintegerTotal number of items in trash
itemsarrayArray of trash item objects
items[].idstringUnique identifier for the trash item
items[].typestringItem type: folder, file or version
items[].pathstringOriginal path before deletion
items[].namestringItem name
items[].sizeintegerFile size in bytes (files only)
items[].deleted_bystringFull name of user who deleted the item
items[].delete_datestringISO-8601 timestamp when item was deleted
items[].purge_datestringISO-8601 timestamp when item will be permanently deleted
items[].last_modifiedstringISO-8601 timestamp of last modification before deletion
items[].ownerobjectOwner information (files only)
items[].data_retention_infoobjectData retention information, if domain has data retention enabled
items[].data_retention_info.retentionstringReason for retention: RETENTION_POLICY, GRACE_PERIOD, or DEFAULT_RETENTION_PERIOD
items[].data_retention_info.earliest_expirystringUnix timestamp of when item's retention will expire
items[].data_retention_info.is_retainedbooleanWhether 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

ParameterTypeRequiredDefaultDescription
sort_bystringNodate_deletedField to sort by. Options: date_deleted, name, deleted_by, purge_date, orig_location, owner, type
sort_directionstringNodescSort order. Options: asc, desc
countintegerNo50Number of entries per page
offsetintegerNo0Zero-based index of the first entry to return
deletedBystringNo—Filter by user's first and/or last name (URL-encoded)
startDatestringNo—Start of date range in ISO-8601 format (e.g., 2016-04-18T16:11:38Z). Required if deletedBy or endDate is used
endDatestringNo—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

FieldTypeDescription
countintegerNumber of items returned in this response
offsetintegerZero-based offset of the first item
has_morebooleanWhether additional pages are available
itemsarrayArray 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

FieldTypeDescription
totalCountintegerTotal 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

FieldTypeRequiredDescription
actionstringYesMust be RESTORE
idsarrayYesArray 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.

FieldTypeDescription
resourcesarrayArray of result objects
resources[].idstringTrash item ID
resources[].codestringHTTP status code for this item
resources[].descriptionsstringError 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

FieldTypeRequiredDescription
actionstringYesMust be PURGE
idsarrayYesArray 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.

FieldTypeDescription
resourcesarrayArray of result objects
resources[].idstringTrash item ID
resources[].codestringHTTP status code for this item
resources[].descriptionsstringError 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

StatusErrorDescriptionResolution
401UnauthorizedInvalid or expired tokenRefresh your OAuth token
403ForbiddenUser is not authorized to manage trashEnsure the authenticated user is an administrator or power user with trash management privileges
404Not FoundItem is not in the trashVerify the item ID is correct and the item is in the trash
429Rate LimitedToo many requestsImplement 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"]}'
Reference →Browse all endpoints