---
title: "List a collection's recently deleted items"
method: GET
path: "/knowledgeBase/{kbId}/trash"
tags: ["Knowledge Base"]
---

# List a collection's recently deleted items

`GET /knowledgeBase/{kbId}/trash`

## Request

- Base URL: `https://app.pipeshub.com/api/v1`
- URL: `https://app.pipeshub.com/api/v1/knowledgeBase/{kbId}/trash`
- Auth: one of:
  - HTTP bearer
  - OAuth 2
    - Authorization code: `/api/v1/oauth2/authorize`
    - Client credentials
    - Token URL: `/api/v1/oauth2/token` scopes: `kb:delete`

One page of what was deleted from a collection and can still be restored,
newest first. Each item is what one delete removed, as a restore brings it back
whole: a folder deleted with its contents is one item, and so is a multi-select
delete (`rootCount` items selected, some named in `otherRootNames`). `itemCount`
says how many records it holds, the folder included.

A folder deleted with `DELETE /knowledgeBase/{kbId}/folder/{folderId}` takes its
contents along. A folder deleted with `DELETE /knowledgeBase/record/{recordId}`
goes to the trash alone (`itemCount` 1): the records inside it stay live.
Restore an item with `POST /knowledgeBase/record/{recordId}/restore`, using its `id`.

Needs "Move Deleted Records to the Trash" on in Labs.

**Who sees what:** the list holds what the caller may restore. OWNER and
WRITER see every item; FILEORGANIZER sees single files only; other roles are
refused. The workspace and user always come from the sign-in.

**Removed for good:** the scheduled cleanup may remove an item from
`removableAfterTimestamp` on (at least 14 days after it was deleted by
default; it runs every 14 days, so an item stays 14 to 28 days). It is
absent when the retention settings can't be read.

An item whose folder is also in the trash (`parentInTrash`) can only be
restored after that folder.

**Request:** query parameters other than `page` and `limit` are ignored. A page past
the last one is answered `200` with no items.

## Path parameters

- `kbId` string, required

## Query parameters

- `page` integer
- `limit` integer

## Response `200`

One page of recently deleted items

- ListTrashResponseSchema: Response returned by GET /knowledgeBase/{kbId}/trash.
  - `success` true, required
  - `items` TrashItemSchema[], required
    - `id` string, required: Record ID to restore
    - `name` string, nullable
    - `recordType` string, nullable
    - `isFolder` boolean, required: A folder, deleted with everything in it
    - `mimeType` string, nullable
    - `sizeInBytes` integer, nullable
    - `parentId` string, nullable: The folder it was in; null at the collection's top level
    - `parentName` string, nullable
    - `parentInTrash` boolean, required: That folder is in the trash too; restore it first
    - `itemCount` integer, required: Records this delete removed, all of which a restore brings back
    - `rootCount` integer: Items selected in the delete; more than one for a multi-select delete, which is one item here
    - `otherRootNames` string[]: Names of up to three of the other items selected with this one
    - `deletedAtTimestamp` integer, required
    - `deletedBy` object, nullable
      - `name` string, nullable
      - `email` string, nullable
    - `removableAfterTimestamp` integer, nullable: From when the scheduled cleanup may remove it for good; null when unknown
  - `pagination` object, required
    - `page` integer, required
    - `limit` integer, required
    - `totalCount` integer, required
    - `totalPages` integer, required
  - `retention` object, nullable
    - `minAgeMs` integer, required: Items stay at least this long before the cleanup may remove them

## Other responses

- `400`: page or limit is not a whole number in range, or is sent more than once (`VALIDATION_ERROR` naming `query.page` or `query.limit`, for example "Page must be 1 or more." or "Limit must be between 1 and 100."). Ask for a page from 1 up, with 1 to 100 items per page. Also returned, before authentication, when a query value, or any string in a JSON or form-encoded body, looks like markup to the app-wide XSS filter: an HTML tag, a script tag, `<iframe`, `<object`, `<embed` or `<svg` tag, a word starting with `on` followed by `=` (meant for inline event handlers such as `onerror=`, it also catches plain text such as `one=1`), a `javascript:` or `data:text/html` URL, an encoded script tag (`&lt;script`, `%3cscript`), or any string longer than 100,000 characters (`HTTP_BAD_REQUEST`, "HTML tags, scripts, and XSS content are not allowed in ...", naming the field or query parameter; a string over 100,000 characters is refused as too long instead). A JSON body that does not parse is refused the same way, also before authentication (`HTTP_BAD_REQUEST`, "The request body is not valid JSON.").
- `401`: Missing, invalid, expired, or revoked authentication
- `403`: Not allowed. The message says why and what to do: the trash is turned off in Labs (ask an admin to turn on "Move Deleted Records to the Trash"), the caller lacks edit access to the collection (ask its owner), or the OAuth token is missing the kb:delete scope.
- `404`: No such collection in this workspace, or the caller has no role on it
- `500`: Internal server error while listing deleted items. A JSON body larger than 10 MB, or a form-encoded body larger than 100 KB or with more than 1000 fields, is answered `413` by the app-wide body parsers instead, also before authentication.
- `503`: Connector service unavailable or connection refused

## Changes

- **2026-10-13** `bb0c59adf026`: 1 info
  - endpoint added
- **2026-10-08** `c462bea9ad26`: 1 breaking
  - api path removed without deprecation
- **2026-10-08** `bb0c59adf026`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/pipeshub-ai/apis/pipeshub-api/changes/knowledgeBase/:kbId/trash/get.md)

---

[API](https://skmtc.dev/pipeshub-ai/apis/pipeshub-api.md) - [All operations](https://skmtc.dev/pipeshub-ai/apis/pipeshub-api/llms.txt) - [OpenAPI document](https://skmtc.dev/pipeshub-ai/apis/pipeshub-api/revisions/dbb5e203b445?raw)
