Upload, organize, search, and manage project files.
Get all places where a file is referenced
/organizations/{id}/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 { data: fileReferences } = await gc.projectFiles.getFileReferences({ id: "example-id", projectId: "example-project-id", fileId: "example-file-id"});Get a file folder
/organizations/{id}/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 { data: fileFolder } = await gc.projectFiles.getFileFolder({ id: "file-id", projectId: "project-id", folderId: "folder-id"});Replace file content
/organizations/{id}/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.
curl -X PUT "https://api.giantcontext.com/organizations/id_uuid/projects/projectId_uuid/files/fileId_uuid/content" \ -H "Authorization: Bearer $API_KEY" \ -H "Content-Type: application/json" \ -d '{ "content": "content_value"}'Read file content
/organizations/{id}/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.
curl -X GET "https://api.giantcontext.com/organizations/id_uuid/projects/projectId_uuid/files/fileId_uuid/open" \ -H "Authorization: Bearer $API_KEY"Get a file
/organizations/{id}/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 { data: file } = await gc.projectFiles.getFile({ id: "YOUR_ID", projectId: "YOUR_PROJECT_ID", fileId: "YOUR_FILE_ID"});Get file folders in a project
/organizations/{id}/projects/{projectId}/files/foldersReturns all folders in the project file manager. Optionally filter by parentId to list only child folders of a specific parent folder. Pass parentId='null' or omit it to list root-level folders. 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 { data: fileFolders } = await gc.projectFiles.getFileFolders({ id: "file-id", projectId: "project-id"});Search files by content
/organizations/{id}/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 { data: results } = await gc.projectFiles.searchProjectFiles({ id: "your-file-id", projectId: "your-project-id", query: "your-search-query"});Get items in trash
/organizations/{id}/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 { data: trash } = await gc.projectFiles.listFileTrash({ id: "file-id", projectId: "project-id"});Save a file from text or image content
/organizations/{id}/projects/{projectId}/files/saveSaves a file to the project from raw text content (Markdown, Mermaid, CSV, JSON, YAML, plain text, etc.) or base64-encoded image data (PNG, JPG, GIF, WebP, SVG). 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 { data: file } = await gc.projectFiles.saveFile({ id: "file_123", projectId: "proj_123", data: "file_content"});Get files in a project
/organizations/{id}/projects/{projectId}/filesReturns a paginated list of files (images, documents, media) uploaded to the project file manager. Supports full-text search by filename, filtering by folder ID and MIME type, and standard pagination and sorting options. Files at the root level can be retrieved by passing folderId as 'null'.
import { createGiantContext } from "@giantcontext/sdk-typescript";
const gc = createGiantContext({ apiKey: process.env.GIANTCONTEXT_API_KEY! });
const { data: files } = await gc.projectFiles.getFiles({ id: "file-id", projectId: "project-id"});