Recycle bin#

Plone's recycle bin functionality is managed through the @recyclebin endpoint.

Reading or writing recycle bin data requires the cmf.ManagePortal permission.

List recycle bin contents#

A list of all items in the recycle bin can be retrieved by sending a GET request to the @recyclebin endpoint:

http

GET /plone/@recyclebin HTTP/1.1
Accept: application/json
Authorization: Basic YWRtaW46c2VjcmV0

curl

curl -i -X GET http://nohost/plone/@recyclebin -H "Accept: application/json" --user admin:secret

httpie

http http://nohost/plone/@recyclebin Accept:application/json -a admin:secret

python-requests

requests.get('http://nohost/plone/@recyclebin', headers={'Accept': 'application/json'}, auth=('admin', 'secret'))
HTTP/1.1 200 OK
Content-Type: application/json

{
    "@id": "http://localhost:55001/plone/@recyclebin",
    "items": [
        {
            "@id": "http://localhost:55001/plone/@recyclebin/64120e33-5de0-5e85-69d3-a24678a065dc",
            "@type": "Folder",
            "actions": {
                "purge": "http://localhost:55001/plone/@recyclebin/64120e33-5de0-5e85-69d3-a24678a065dc",
                "restore": "http://localhost:55001/plone/@recyclebin/64120e33-5de0-5e85-69d3-a24678a065dc/restore"
            },
            "deleted_by": "test_user_1_",
            "deletion_date": "1995-07-31T17:30:00+00:00",
            "has_children": true,
            "id": "folder1",
            "language": "",
            "parent_path": "/plone",
            "path": "/plone/folder1",
            "recycle_id": "64120e33-5de0-5e85-69d3-a24678a065dc",
            "review_state": "private",
            "title": "My Folder"
        },
        {
            "@id": "http://localhost:55001/plone/@recyclebin/639aeb4c-1991-7494-a9d1-f9b2657fe36d",
            "@type": "Document",
            "actions": {
                "purge": "http://localhost:55001/plone/@recyclebin/639aeb4c-1991-7494-a9d1-f9b2657fe36d",
                "restore": "http://localhost:55001/plone/@recyclebin/639aeb4c-1991-7494-a9d1-f9b2657fe36d/restore"
            },
            "deleted_by": "test_user_1_",
            "deletion_date": "1995-07-31T17:30:00+00:00",
            "has_children": false,
            "id": "document1",
            "language": "",
            "parent_path": "/plone",
            "path": "/plone/document1",
            "recycle_id": "639aeb4c-1991-7494-a9d1-f9b2657fe36d",
            "review_state": "private",
            "title": "My Document"
        }
    ],
    "items_total": 2
}

Filtering and Sorting Parameters#

The listing supports various query parameters for filtering and sorting:

Parameter

Description

Example

title

Filter by title (case-insensitive substring match)

title=my doc

path

Filter by path (case-insensitive substring match)

path=/plone/news

portal_type

Filter by content type

portal_type=Document

date_from

Filter by deletion date from (YYYY-MM-DD)

date_from=2024-01-01

date_to

Filter by deletion date to (YYYY-MM-DD)

date_to=2024-12-31

deleted_by

Filter by the user ID who deleted the item

deleted_by=admin

has_subitems

Filter items with (true) or without (false) children

has_subitems=true

language

Filter by language code

language=it

review_state

Filter by workflow state

review_state=published

sort_on

Sort field: title, portal_type, path, deletion_date, review_state

sort_on=title

sort_order

Sort direction: ascending or descending (default)

sort_order=ascending

Batching#

The API supports standard Plone REST API batching parameters (b_start, b_size).

Example with filtering and sorting#

http

GET /plone/@recyclebin?portal_type=Document&sort_on=title&sort_order=ascending HTTP/1.1
Accept: application/json
Authorization: Basic YWRtaW46c2VjcmV0

curl

curl -i -X GET 'http://nohost/plone/@recyclebin?portal_type=Document&sort_on=title&sort_order=ascending' -H "Accept: application/json" --user admin:secret

httpie

http 'http://nohost/plone/@recyclebin?portal_type=Document&sort_on=title&sort_order=ascending' Accept:application/json -a admin:secret

python-requests

requests.get('http://nohost/plone/@recyclebin?portal_type=Document&sort_on=title&sort_order=ascending', headers={'Accept': 'application/json'}, auth=('admin', 'secret'))
HTTP/1.1 200 OK
Content-Type: application/json

{
    "@id": "http://localhost:55001/plone/@recyclebin?portal_type=Document",
    "items": [
        {
            "@id": "http://localhost:55001/plone/@recyclebin/8df93d6e-de82-2c67-2919-6e6fca9b0666",
            "@type": "Document",
            "actions": {
                "purge": "http://localhost:55001/plone/@recyclebin/8df93d6e-de82-2c67-2919-6e6fca9b0666",
                "restore": "http://localhost:55001/plone/@recyclebin/8df93d6e-de82-2c67-2919-6e6fca9b0666/restore"
            },
            "deleted_by": "test_user_1_",
            "deletion_date": "1995-07-31T17:30:00+00:00",
            "has_children": false,
            "id": "document1",
            "language": "",
            "parent_path": "/plone",
            "path": "/plone/document1",
            "recycle_id": "8df93d6e-de82-2c67-2919-6e6fca9b0666",
            "review_state": "private",
            "title": "My Document"
        },
        {
            "@id": "http://localhost:55001/plone/@recyclebin/d46174f6-045e-f661-eada-a2ce0d342a98",
            "@type": "Folder",
            "actions": {
                "purge": "http://localhost:55001/plone/@recyclebin/d46174f6-045e-f661-eada-a2ce0d342a98",
                "restore": "http://localhost:55001/plone/@recyclebin/d46174f6-045e-f661-eada-a2ce0d342a98/restore"
            },
            "deleted_by": "test_user_1_",
            "deletion_date": "1995-07-31T17:30:00+00:00",
            "has_children": true,
            "id": "folder1",
            "language": "",
            "parent_path": "/plone",
            "path": "/plone/folder1",
            "recycle_id": "d46174f6-045e-f661-eada-a2ce0d342a98",
            "review_state": "private",
            "title": "My Folder"
        }
    ],
    "items_total": 2
}

Get individual item from recycle bin#

To retrieve detailed information about a specific item in the recycle bin, including its sub-items, send a GET request to @recyclebin/{item_id}. The response includes a paginated items list with all flattened descendants. Standard batching parameters (b_start, b_size) are supported.

http

GET /plone/@recyclebin/ecf00e14-441d-4264-94de-6bbb9d0c66e7 HTTP/1.1
Accept: application/json
Authorization: Basic YWRtaW46c2VjcmV0

curl

curl -i -X GET http://nohost/plone/@recyclebin/ecf00e14-441d-4264-94de-6bbb9d0c66e7 -H "Accept: application/json" --user admin:secret

httpie

http http://nohost/plone/@recyclebin/ecf00e14-441d-4264-94de-6bbb9d0c66e7 Accept:application/json -a admin:secret

python-requests

requests.get('http://nohost/plone/@recyclebin/ecf00e14-441d-4264-94de-6bbb9d0c66e7', headers={'Accept': 'application/json'}, auth=('admin', 'secret'))
HTTP/1.1 200 OK
Content-Type: application/json

{
    "@id": "http://localhost:55001/plone/@recyclebin/ecf00e14-441d-4264-94de-6bbb9d0c66e7",
    "@type": "Document",
    "actions": {
        "purge": "http://localhost:55001/plone/@recyclebin/ecf00e14-441d-4264-94de-6bbb9d0c66e7",
        "restore": "http://localhost:55001/plone/@recyclebin/ecf00e14-441d-4264-94de-6bbb9d0c66e7/restore"
    },
    "deleted_by": "test_user_1_",
    "deletion_date": "1995-07-31T17:30:00+00:00",
    "has_children": false,
    "id": "document1",
    "items": [],
    "items_total": 0,
    "language": "",
    "parent_path": "/plone",
    "path": "/plone/document1",
    "recycle_id": "ecf00e14-441d-4264-94de-6bbb9d0c66e7",
    "review_state": "private",
    "title": "My Document"
}

Restore an item from the recycle bin#

An item can be restored to its original location by issuing a POST to @recyclebin/{item_id}/restore:

http

POST /plone/@recyclebin/b7323098-47c0-4e2f-1ef5-097bc92b8682/restore HTTP/1.1
Accept: application/json
Authorization: Basic YWRtaW46c2VjcmV0

curl

curl -i -X POST http://nohost/plone/@recyclebin/b7323098-47c0-4e2f-1ef5-097bc92b8682/restore -H "Accept: application/json" --user admin:secret

httpie

http POST http://nohost/plone/@recyclebin/b7323098-47c0-4e2f-1ef5-097bc92b8682/restore Accept:application/json -a admin:secret

python-requests

requests.post('http://nohost/plone/@recyclebin/b7323098-47c0-4e2f-1ef5-097bc92b8682/restore', headers={'Accept': 'application/json'}, auth=('admin', 'secret'))
HTTP/1.1 200 OK
Content-Type: application/json

{
    "message": "Item folder1 restored successfully",
    "restored_item": {
        "@id": "http://localhost:55001/plone/folder1",
        "@type": "Folder",
        "id": "folder1",
        "title": "My Folder"
    },
    "status": "success"
}

Restore to a specific location#

Pass a target_path in the request body to restore the item to a different folder:

http

POST /plone/@recyclebin/7cda273b-9e6a-3b17-3b2f-00ac6fd2e766/restore HTTP/1.1
Accept: application/json
Authorization: Basic YWRtaW46c2VjcmV0
Content-Type: application/json

{
    "target_path": "/plone/target_folder"
}

curl

curl -i -X POST http://nohost/plone/@recyclebin/7cda273b-9e6a-3b17-3b2f-00ac6fd2e766/restore -H "Accept: application/json" -H "Content-Type: application/json" --data-raw '{"target_path": "/plone/target_folder"}' --user admin:secret

httpie

echo '{
  "target_path": "/plone/target_folder"
}' | http POST http://nohost/plone/@recyclebin/7cda273b-9e6a-3b17-3b2f-00ac6fd2e766/restore Accept:application/json Content-Type:application/json -a admin:secret

python-requests

requests.post('http://nohost/plone/@recyclebin/7cda273b-9e6a-3b17-3b2f-00ac6fd2e766/restore', headers={'Accept': 'application/json', 'Content-Type': 'application/json'}, json={'target_path': '/plone/target_folder'}, auth=('admin', 'secret'))
HTTP/1.1 200 OK
Content-Type: application/json

{
    "message": "Item document1 restored successfully",
    "restored_item": {
        "@id": "http://localhost:55001/plone/target_folder/document1",
        "@type": "Document",
        "id": "document1",
        "title": "My Document"
    },
    "status": "success"
}

Purge a specific item from the recycle bin#

To permanently delete a specific item, send a DELETE request to @recyclebin/{item_id}:

http

DELETE /plone/@recyclebin/7b2a4872-a94e-2372-34c2-7fb8f1e38ed1 HTTP/1.1
Accept: application/json
Authorization: Basic YWRtaW46c2VjcmV0

curl

curl -i -X DELETE http://nohost/plone/@recyclebin/7b2a4872-a94e-2372-34c2-7fb8f1e38ed1 -H "Accept: application/json" --user admin:secret

httpie

http DELETE http://nohost/plone/@recyclebin/7b2a4872-a94e-2372-34c2-7fb8f1e38ed1 Accept:application/json -a admin:secret

python-requests

requests.delete('http://nohost/plone/@recyclebin/7b2a4872-a94e-2372-34c2-7fb8f1e38ed1', headers={'Accept': 'application/json'}, auth=('admin', 'secret'))
HTTP/1.1 204 No Content

Empty the entire recycle bin#

To permanently delete all items, send a DELETE request to @recyclebin:

http

DELETE /plone/@recyclebin HTTP/1.1
Accept: application/json
Authorization: Basic YWRtaW46c2VjcmV0

curl

curl -i -X DELETE http://nohost/plone/@recyclebin -H "Accept: application/json" --user admin:secret

httpie

http DELETE http://nohost/plone/@recyclebin Accept:application/json -a admin:secret

python-requests

requests.delete('http://nohost/plone/@recyclebin', headers={'Accept': 'application/json'}, auth=('admin', 'secret'))
HTTP/1.1 204 No Content