Project Files
Upload, organize, search, and manage project files.
Restore an item from trash
/organizations/{organizationId}/projects/{projectId}/files/trash/{itemId}/restoreRestores a previously soft-deleted file or folder from the file trash back to the file manager. For folders, optionally restores all contained files and subfolders. Requires specifying the item type (file or folder) in the request body. Returns counts of restored files and folders for folder-type 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.projectFiles.restoreFileTrashItem({ organizationId: org.id, projectId: projects[0].id, itemId: "item-123", data: {}});
List places where a file is referenced
/organizations/{organizationId}/projects/{projectId}/files/{fileId}/referencesReturns a comprehensive list of all entities that reference this file across the project. This includes pages, headers, footers, blog posts, templates, sidebars, dialogs, forms, and branding settings. Useful for understanding the impact of deleting or replacing a file.
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 { references } = await gc.projectFiles.listFileReferences({ organizationId: org.id, projectId: projects[0].id, fileId: "your-file-id",});
Get one folder's name and parent; use listFiles with folderId to see its files
/organizations/{organizationId}/projects/{projectId}/files/folders/{folderId}Retrieves the details of a single folder in the project file manager, including its name, parent folder ID, and creation metadata.
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 folder = await gc.projectFiles.getFileFolder({ organizationId: org.id, projectId: projects[0].id, folderId: "folder-123",});
Delete a file folder (files are moved to root)
/organizations/{organizationId}/projects/{projectId}/files/folders/{folderId}Soft-deletes a folder and all its contents (files and subfolders) by moving them to the file trash. The folder and its contents can be restored from trash before permanent deletion. Returns a count of deleted folders and files.
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.projectFiles.deleteFileFolder({ organizationId: org.id, projectId: projects[0].id, folderId: "folder-123",});
Replace a text file's content in place; id, URL and references stay unchanged
/organizations/{organizationId}/projects/{projectId}/files/{fileId}/contentReplaces the content of an existing text file. The file must be a text-based type (Markdown, plain text, CSV, JSON, YAML, HTML, CSS, JS, XML, SVG). The file's storage object is overwritten, its size is updated, and AI embeddings are re-generated from the new content. The file ID, URL, metadata, and all references remain unchanged.
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.projectFiles.replaceFileContent({ organizationId: org.id, projectId: projects[0].id, fileId: "file-123", data: "new file content",});
Permanently delete an item from trash
/organizations/{organizationId}/projects/{projectId}/files/trash/{itemId}Permanently and irreversibly deletes a file or folder from the file trash. For files, also removes the file from cloud storage. For folders, recursively deletes all contained files and subfolders. Requires specifying the item type (file or folder) in the request body.
import { createGiantContext } from "@giantcontext/sdk-typescript";
const gc = createGiantContext({ apiKey: process.env.GIANTCONTEXT_API_KEY! });
const { id: organizationId } = await gc.organizations.getOrganizationBySlug({ slug: "my-org" });const { projects } = await gc.projects.listProjects({ organizationId });
const result = await gc.projectFiles.permanentDeleteFileTrashItem({ organizationId, projectId: projects[0].id, itemId: "item-123", data: {}});
Open a file's content inline: text as string, images as base64, 10 MB cap
/organizations/{organizationId}/projects/{projectId}/files/{fileId}/openReturns the actual content of a file inline — text as a string, images as base64. Use this when you need to read or analyze a file's content rather than just its metadata. Text files (Markdown, CSV, JSON, YAML, plain text, HTML, CSS, JS, XML, SVG) are returned in the 'content' field. Image files (PNG, JPG, GIF, WebP) are returned as base64 in the 'base64Content' field. Files over 10 MB or unsupported types return 404.
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 file = await gc.projectFiles.openFile({ organizationId: org.id, projectId: projects[0].id, fileId: "target-file-id",});
Empty trash (permanently delete old items)
/organizations/{organizationId}/projects/{projectId}/files/trash/emptyPermanently deletes all items from the file trash, optionally filtering to only delete items older than a specified number of days. Removes files from cloud storage and recursively deletes folder contents. Returns counts of deleted files and folders.
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.projectFiles.emptyFileTrash({ organizationId: org.id, projectId: projects[0].id, data: {}});
Get one file's metadata only (URL, type, size, folder); openFile returns the content
/organizations/{organizationId}/projects/{projectId}/files/{fileId}Retrieves the full details of a single file in the project file manager, including its filename, MIME type, size, dimensions, storage URL, alt text, caption, and folder assignment.
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 file = await gc.projectFiles.getFile({ organizationId: org.id, projectId: projects[0].id, fileId: "file-123",});
Delete a file
/organizations/{organizationId}/projects/{projectId}/files/{fileId}Soft-deletes a file from the project file manager by moving it to the file trash. The file can be restored from trash before it is permanently deleted. Also removes the file from cloud storage if permanently deleted later.
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.projectFiles.deleteFile({ organizationId: org.id, projectId: projects[0].id, fileId: "file-123",});
List file folders in a project
/organizations/{organizationId}/projects/{projectId}/files/foldersReturns all folders in the project file manager. Filter by parentId to list only the children of one folder, or parentId_isnull=true for the project root. Omit both to list every folder in the project. Folders are used to organize uploaded files (images, documents, media).
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 { folders } = await gc.projectFiles.listFileFolders({ organizationId: org.id, projectId: projects[0].id,});
Search file contents by meaning; returns matching snippet and relevance score per file
/organizations/{organizationId}/projects/{projectId}/files/searchSearches project files by their content using semantic/AI search. Returns files whose content matches the meaning of the query, along with the matching content snippet and a relevance score.
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 { files } = await gc.projectFiles.searchFiles({ organizationId: org.id, projectId: projects[0].id, query: "search term",});
List a project's trashed files and folders, restorable until permanently deleted
/organizations/{organizationId}/projects/{projectId}/files/trashReturns all soft-deleted files and folders currently in the project's file trash. Items remain in trash until they are restored or permanently deleted. Each item includes its original metadata and the date it was trashed.
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.projectFiles.listFileTrash({ organizationId: org.id, projectId: projects[0].id,});Save a file from text or image content
/organizations/{organizationId}/projects/{projectId}/files/saveSaves a file to the project from raw text content (Markdown, Mermaid, CSV, JSON, YAML, plain text, etc.) or base64-encoded binary data — images (PNG, JPG, GIF, WebP, SVG) and documents alike (PDF, Word, Excel), with document text extracted and embedded exactly as a console upload would. The file is stored in the project and processed for AI embeddings (text) or image classification (images). Use this to save documents, notes, diagrams, structured data, or screenshots into the project knowledge base.
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.projectFiles.saveFile({ organizationId: org.id, projectId: projects[0].id, data: { filename: "example.txt", content: "Hello World" }});
List a project's files, with search, filtering and sorting
/organizations/{organizationId}/projects/{projectId}/filesReturns a paginated list of files (images, documents, media) uploaded to the project file manager. Search matches filename, original filename, title and description. Filter with folderId (folderId_isnull=true for the project root), mimeType (mimeType_like=image/ for every image), isPublic and grounding.
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 { files } = await gc.projectFiles.listFiles({ organizationId: org.id, projectId: projects[0].id,});