Skip to Content
Endpoints

Trash

How to list and restore deleted folders, test cases, runs, plans and milestones using the public API

Deleting folders, test cases, test runs, test plans or milestones moves them to the project's trash. Each delete action is one trash entry, holding everything it deleted. Restoring an entry brings all of it back.

Only these deletions go to the trash. Shared steps, shared preconditions, tags, requirements and filled test cases removed from a template's parameterValues are deleted without a trash entry.

60-day retention

Trash entries are purged permanently 60 days after the deletion. After that they can no longer be restored.

Trash Entry Object

{
  id: string                       // Trash entry ID, used to restore it
  authorId: number                 // ID of the user who deleted it
  author: {                        // The user who deleted it
    id: number                     //   User ID
    name: string                   //   Name of the user
  }
  name: string                     // What was deleted, e.g. "Folder Login (3 test cases)"
  resourceType: string             // `test_case` (folders and test cases) | `test_run` | `test_plan` | `milestone`
  items: Array<{                   // The deletion's steps, in order
    seq: number                    //   Step number, from 1
    folderIds: number[] | null     //   Folders deleted in this step; null if none
    tcaseIds: string[] | null      //   Test cases deleted in this step; null if none
    runIds: number[] | null        //   Runs deleted in this step; null if none
    planIds: number[] | null       //   Test plans deleted in this step; null if none
    milestoneIds: number[] | null  //   Milestones deleted in this step; null if none
  }>
  createdAt: datetime              // Deletion time
}

A milestone entry also holds the plans and runs deleted with the milestone. A plan entry holds its runs.

List Trash

GET/api/public/v0/project/{project_id}/trash/paginated

/paginated endpoints are transitional. In API v1, the base paths will return paginated responses and the /paginated suffix will be removed.

Lists the project's trash entries, most recent first. Any project member can list it; viewers don't see milestone entries.

Query Parameters

ParameterTypeDescriptionDefaultExample
resourceTypesstringOnly entries of this type: test_case, test_run, test_plan or milestone. Repeat the parameter for multiple values.No filterresourceTypes=test_case
offsetnumberNumber of items to skip.0offset=10
limitnumberMaximum number of items to return. Accepted range: 0–1,000.100limit=10
sortFieldstringField to sort by: created_at only.created_atsortField=created_at
sortOrderstringSort direction for sortField: asc or desc.descsortOrder=asc

Response

Status: 200 OK

{
  total: number       // Number of matching entries across all pages
  offset: number      // Offset applied to this response
  limit: number       // Limit applied to this response
  data: TrashEntry[]  // Entries in this page (see Trash Entry Object)
}

Restore From Trash

POST/api/public/v0/project/{project_id}/trash/restore

Restores up to 100 trash entries. They are restored together: if one can't be, none is.

Request Body

{
  deleteLogIds: string[]  // Trash entry IDs (1 to 100)
}

Response

Status: 200 OK

{
  message: string
}

Permissions

  • Folders and test cases need role User or higher.
  • Runs, plans and milestones need role Test Runner or higher.

Behavior

  • A folder comes back at its old place. Its parent folder must exist, so restore parent folders first.
  • Restored test cases rejoin the open live runs they match, as open test cases. They don't come back to other runs.
  • A template's filled test cases are deleted with it, into the same entry, so they come back with it.
  • A restored run or plan whose milestone has been archived stays closed.
  • A restored run or plan is linked to its Jira or Linear issue again. If that's no longer possible, for example because the issue was deleted or the project is now linked to another Jira project or Linear team, it comes back without the link.

Errors

Status CodeDescription
403The caller's role can't restore one of the entries
409A parent folder must be restored first; the milestone is gone; a run, plan or milestone with the same title now exists