Project Trash
Review and restore trashed project resources.
Restore a trash batch
/organizations/{organizationId}/projects/{projectId}/trash/batches/{batchId}/restoreRestores every trash entry that shares a batch id back to its original location. Batches are created when a single user action trashed multiple rows — for example, deleting a folder places the folder, its files, and its subfolders into the same batch. Folders are restored before files so parent-child foreign keys hold.
import { createGiantContext } from "@giantcontext/sdk-typescript";
const gc = createGiantContext({ apiKey: process.env.GIANTCONTEXT_API_KEY! });
const org = await gc.organizations.getOrganizationBySlug({ slug: "my-org" });const { projects } = await gc.projects.listProjects({ organizationId: org.id });
const result = await gc.projectTrash.restoreProjectTrashBatch({ organizationId: org.id, projectId: projects[0].id, batchId: "batch-123",});
Restore an item from trash
/organizations/{organizationId}/projects/{projectId}/trash/{trashId}/restoreRestores a soft-deleted entity from the project trash back to its original location. Dynamically rebuilds the database INSERT from the stored JSONB entity snapshot. Returns the restored entity type, entity ID, and associated app ID.
import { createGiantContext } from "@giantcontext/sdk-typescript";
const gc = createGiantContext({ apiKey: process.env.GIANTCONTEXT_API_KEY! });
const org = await gc.organizations.getOrganizationBySlug({ slug: "my-org" });const { projects } = await gc.projects.listProjects({ organizationId: org.id });
const result = await gc.projectTrash.restoreProjectTrashItem({ organizationId: org.id, projectId: projects[0].id, trashId: "trash-123",});
Get one trashed item's entity type, deletion metadata and stored data snapshot
/organizations/{organizationId}/projects/{projectId}/trash/{trashId}Retrieves the full details of a single item in the project trash by its trash record ID. Includes the original entity type, entity ID, name, deletion timestamp, and the stored entity data snapshot.
import { createGiantContext } from "@giantcontext/sdk-typescript";
const gc = createGiantContext({ apiKey: process.env.GIANTCONTEXT_API_KEY! });
const org = await gc.organizations.getOrganizationBySlug({ slug: "my-org" });const { projects } = await gc.projects.listProjects({ organizationId: org.id });
const trashItem = await gc.projectTrash.getProjectTrashItem({ organizationId: org.id, projectId: projects[0].id, trashId: "trash-123",});
Permanently delete an item from trash
/organizations/{organizationId}/projects/{projectId}/trash/{trashId}Permanently and irreversibly removes an item from the project trash. For media/file items, also deletes the associated file from cloud storage. This operation cannot be undone. The item will no longer be recoverable after this action.
import { createGiantContext } from "@giantcontext/sdk-typescript";
const gc = createGiantContext({ apiKey: process.env.GIANTCONTEXT_API_KEY! });
const org = await gc.organizations.getOrganizationBySlug({ slug: "my-org" });const { projects } = await gc.projects.listProjects({ organizationId: org.id });
const result = await gc.projectTrash.permanentDeleteProjectTrashItem({ organizationId: org.id, projectId: projects[0].id, trashId: "trash-123",});
List soft-deleted items across a whole project, filterable by entity type
/organizations/{organizationId}/projects/{projectId}/trashReturns a paginated list of all soft-deleted resources across the entire project, including pages, posts, files, forms, and other entities. Supports filtering by entity type to narrow results. Each trash item includes the original entity metadata, deletion timestamp, and the user who deleted it.
import { createGiantContext } from "@giantcontext/sdk-typescript";
const gc = createGiantContext({ apiKey: process.env.GIANTCONTEXT_API_KEY! });
const org = await gc.organizations.getOrganizationBySlug({ slug: "my-org" });const { projects } = await gc.projects.listProjects({ organizationId: org.id });
const { trash } = await gc.projectTrash.listProjectTrash({ organizationId: org.id, projectId: projects[0].id,});
Empty all items from trash
/organizations/{organizationId}/projects/{projectId}/trashPermanently and irreversibly deletes all items currently in the project trash. For media/file items, also removes the associated files from cloud storage. This operation cannot be undone. Returns the count of permanently deleted items.
import { createGiantContext } from "@giantcontext/sdk-typescript";
const gc = createGiantContext({ apiKey: process.env.GIANTCONTEXT_API_KEY! });
const org = await gc.organizations.getOrganizationBySlug({ slug: "my-org" });const { projects } = await gc.projects.listProjects({ organizationId: org.id });
const result = await gc.projectTrash.emptyProjectTrash({ organizationId: org.id, projectId: projects[0].id,});