Generate, edit, preview, and publish content drafts.
Generate a draft of changes to existing content
/drafts/generate/editGenerates a reviewable edit draft for an EXISTING resource. The AI analyzes the current content, determines what to keep/modify/add/remove, and stages the edited version as a copy — the live content only changes when the draft is accepted. For brand-new content, use generateNewDraft.
curl -X POST "https://api.giantcontext.com/drafts/generate/edit" \ -H "Authorization: Bearer $API_KEY" \ -H "Content-Type: application/json" \ -d '{ "prompt": "prompt_value", "projectId": "projectId_uuid", "resourceId": "resourceId_uuid", "organizationId": "organizationId_uuid"}'Generate a draft of new content
/drafts/generate/newGenerates NEW content as a reviewable draft from a natural language prompt. The draft is a proposal — nothing publishes until it is accepted. For changes to existing content, use generateEditDraft.
curl -X POST "https://api.giantcontext.com/drafts/generate/new" \ -H "Authorization: Bearer $API_KEY" \ -H "Content-Type: application/json" \ -d '{ "prompt": "prompt_value", "projectId": "projectId_uuid", "organizationId": "organizationId_uuid"}'Create an edit draft
/drafts/editCreates a draft copy of existing content for non-destructive editing. The original stays untouched until the draft is accepted. On accept, the copy's content replaces the original. On reject, the copy is deleted.
import { createGiantContext } from "@giantcontext/sdk-typescript";
const gc = createGiantContext({ apiKey: process.env.GIANTCONTEXT_API_KEY! });
const data = {};const { data: draft } = await gc.drafts.editDraft(data);Unarchive a draft
/organizations/{id}/projects/{projectId}/mind/drafts/{draftId}/unarchiveRestores a previously archived draft to the default list.
import { createGiantContext } from "@giantcontext/sdk-typescript";
const gc = createGiantContext({ apiKey: process.env.GIANTCONTEXT_API_KEY! });
const { data: draft } = await gc.drafts.unarchiveDraft({ id: "id-123", projectId: "proj-123", draftId: "draft-123"});Archive a draft
/organizations/{id}/projects/{projectId}/mind/drafts/{draftId}/archiveHides an accepted draft from the default list without deleting it. Archived drafts are preserved as a paper trail and for AI training data. Only accepted or partially_accepted drafts can be archived.
import { createGiantContext } from "@giantcontext/sdk-typescript";
const gc = createGiantContext({ apiKey: process.env.GIANTCONTEXT_API_KEY! });
const { data: draft } = await gc.drafts.archiveDraft({ id: "id-1", projectId: "proj-1", draftId: "draft-1"});Get a draft by ID
/organizations/{id}/projects/{projectId}/mind/drafts/{draftId}Retrieves the full details of a single AI-generated content draft including the prompt, generated content, tool calls, and sources.
import { createGiantContext } from "@giantcontext/sdk-typescript";
const gc = createGiantContext({ apiKey: process.env.GIANTCONTEXT_API_KEY! });
const { data: draft } = await gc.drafts.getDraft({ id: "id_123", projectId: "proj_123", draftId: "draft_123"});Delete a draft
/organizations/{id}/projects/{projectId}/mind/drafts/{draftId}Permanently deletes a draft. Only rejected, failed, or cancelled drafts can be deleted. Returns 409 if the draft is in any other status (pending, ready, accepted).
import { createGiantContext } from "@giantcontext/sdk-typescript";
const gc = createGiantContext({ apiKey: process.env.GIANTCONTEXT_API_KEY! });
const { data: result } = await gc.drafts.deleteDraft({ id: "example-id", projectId: "example-project-id", draftId: "example-draft-id"});List drafts for a project
/organizations/{id}/projects/{projectId}/mind/draftsReturns a paginated list of AI-generated content drafts for the specified project. By default archived drafts are hidden — pass includeArchived=true to include them.
import { createGiantContext } from "@giantcontext/sdk-typescript";
const gc = createGiantContext({ apiKey: process.env.GIANTCONTEXT_API_KEY! });
const { data: drafts } = await gc.drafts.listDrafts({ id: "YOUR_ID", projectId: "YOUR_PROJECT_ID"});