# Trash

> List what the user moved to the trash and bring it back.

Source: https://workroad.app/docs/api/trash

## How the trash works

Deleting a note, note folder, study set, set folder, task, file, recording or copilot conversation moves it to the trash, where it stays for 30 days. `GET /trash` lists it as the trash page does, newest first, and `GET /trash/counts` gives the numbers on the page's tabs.

- A key reads each kind with that kind's view scope: notes, note folders and recordings need `notes:view`, sets and set folders `sets:view`, tasks `tasks:view`, files `files:view` and copilot conversations `copilot:use`. Without `kind`, `GET /trash` lists only the kinds the key can read; asking for a kind it can't read returns 403.
- Notes and sets that went to the trash with their folder, and subtasks that went with their task, are counted in the folder's or task's `contains` rather than listed. Restoring the folder or task brings them back too.
- Every item names the operation that restores it in `restoreOperation`, such as `restoreNote` or `restoreTask`. It takes the item's `id` and needs the scope that trashed it (`notes:delete` for a note, `tasks:delete` for a task).
- A conversation that read the user's settings, or ran an operation the key can't, is left out of the list and the count, as it is of `GET /copilot/conversations`.

## What the API can't do

The trash can't be emptied through the API, and nothing in it can be deleted for good: neither can be undone, so the user does them in the app.

## List the trash

`GET https://workroad.app/api/v1/trash`

What the user moved to the trash in the last 30 days, newest first, as the trash page shows it. Notes and sets that went with their folder, and subtasks that went with their task, are counted in the folder's or task's `contains` rather than listed. Each kind needs its own view scope: notes, note folders and recordings `notes:view`, sets and set folders `sets:view`, tasks `tasks:view`, files `files:view` and copilot conversations `copilot:use`. Without `kind`, only the kinds this key can read are listed. A file's `context` names its note only to a key that also has `notes:view`. Bring an item back with the operation in its `restoreOperation`. The trash can't be emptied through the API, and nothing in it can be deleted for good.

- MCP tool: `listTrash` on `https://workroad.app/api/mcp`
- Required scopes: notes:view or sets:view or tasks:view or files:view or copilot:use
- Test mode: `GET https://workroad.app/api/test/v1/trash` checks the request and returns the example response without changing anything.
- Next: Each item's `restoreOperation` brings it back, given its `id`.

### Query parameters

- `kind`: one of `"note"`, `"noteFolder"`, `"set"`, `"setFolder"`, `"task"`, `"file"`, `"recording"`, `"thread"`. Only items of this kind. Omit for every kind this key may read. A kind it can't read returns 403.

### Response

`200` OK

- `data`: object, required
  - `retentionDays`: integer, required. How long an item stays in the trash before it is deleted for good.
  - `items`: array of objects, required. Newest in the trash first.
    - `kind`: one of `"note"`, `"noteFolder"`, `"set"`, `"setFolder"`, `"task"`, `"file"`, `"recording"`, `"thread"`, required. `note`, `noteFolder`, `set`, `setFolder`, `task`, `file` (a note's file), `recording` (a note's recording) or `thread` (a copilot conversation).
    - `id`: string (uuid), required. The item's id, which its restore operation takes.
    - `title`: string or null, required. Its name or title, when it has one.
    - `context`: string or null, required. Where it lived: a note's or set's folder, a file's or recording's note, a subtask's task. A file's note is named only to a key with `notes:view`.
    - `contains`: integer or null, required. For a folder or a task, how many notes, sets or subtasks went to the trash with it and come back with it.
    - `deletedAt`: string (date-time), required. When it was moved to the trash.
    - `purgeAt`: string (date-time), required. When it is deleted for good unless restored.
    - `restoreOperation`: string, required. The operation that brings it back, such as `restoreNote`. It takes the item's `id` and needs the scope that trashed it.

#### Example

```json
{
  "data": {
    "retentionDays": 30,
    "items": [
      {
        "kind": "note",
        "id": "3c2b1a09-8f7e-4d6c-9b5a-4f3e2d1c0b9a",
        "title": "Photosynthesis",
        "context": "Biology",
        "contains": null,
        "deletedAt": "2026-01-15T09:30:00.000Z",
        "purgeAt": "2026-02-14T09:30:00.000Z",
        "restoreOperation": "restoreNote"
      }
    ]
  }
}
```

### Errors

Every error has the body `{ "error": { "code", "message", "details" } }`.

- `400`: Invalid request body or query
- `401`: Missing, invalid, disabled or expired API key
- `402`: `api_allowance_reached`: this month's API and AI app requests on the free plan are used up. `details` has `limit`, `used`, `resetsAt` and `upgradeUrl`. Nothing ran; WorkRoad Plus has no monthly limit.
- `403`: This key can't read the trashed items of that `kind`. `details.missingScopes` names the scope.
- `404`: No endpoint exists at this path.
- `405`: Method not allowed. Use a method from the Allow header.
- `429`: Rate limit exceeded. Wait for Retry-After before retrying. The rate-limit headers are absent when the key's own limiter rejected the request before the per-endpoint bucket check ran.
- `500`: Internal server error

## Count what is in the trash

`GET https://workroad.app/api/v1/trash/counts`

How many items of each kind `GET /trash` lists, as the trash page's tabs show them. A kind this key can't read is null; see `GET /trash` for the scope each kind needs.

- MCP tool: `countTrash` on `https://workroad.app/api/mcp`
- Required scopes: notes:view or sets:view or tasks:view or files:view or copilot:use
- Test mode: `GET https://workroad.app/api/test/v1/trash/counts` checks the request and returns the example response without changing anything.

### Response

`200` OK

- `data`: object, required
  - `retentionDays`: integer, required. How long an item stays in the trash before it is deleted for good.
  - `counts`: object, required
    - `note`: integer or null, required. Trashed notes. Null when this key can't read them.
    - `noteFolder`: integer or null, required. Trashed note folders. Null when this key can't read them.
    - `set`: integer or null, required. Trashed study sets. Null when this key can't read them.
    - `setFolder`: integer or null, required. Trashed set folders. Null when this key can't read them.
    - `task`: integer or null, required. Trashed tasks. Null when this key can't read them.
    - `file`: integer or null, required. Trashed files. Null when this key can't read them.
    - `recording`: integer or null, required. Trashed recordings. Null when this key can't read them.
    - `thread`: integer or null, required. Trashed copilot conversations. Null when this key can't read them.

#### Example

```json
{
  "data": {
    "retentionDays": 30,
    "counts": {
      "note": 1,
      "noteFolder": 0,
      "set": 0,
      "setFolder": 0,
      "task": 2,
      "file": 0,
      "recording": null,
      "thread": null
    }
  }
}
```

### Errors

Every error has the body `{ "error": { "code", "message", "details" } }`.

- `400`: Invalid request body or query
- `401`: Missing, invalid, disabled or expired API key
- `402`: `api_allowance_reached`: this month's API and AI app requests on the free plan are used up. `details` has `limit`, `used`, `resetsAt` and `upgradeUrl`. Nothing ran; WorkRoad Plus has no monthly limit.
- `403`: The API key lacks the required scope
- `404`: No endpoint exists at this path.
- `405`: Method not allowed. Use a method from the Allow header.
- `429`: Rate limit exceeded. Wait for Retry-After before retrying. The rate-limit headers are absent when the key's own limiter rejected the request before the per-endpoint bucket check ran.
- `500`: Internal server error
