Contexte géant
Base de connaissancesDéveloppeurs
Le Sign Up Now

Drafts

Generate, edit, preview, and publish content drafts.


POST

Generate AI content draft

/drafts/generate

Generates an AI content draft from a natural language prompt. Creates a system service account if needed, mints an ephemeral JWT, and calls the AI service. The resulting draft can be reviewed and accepted or rejected via the drafts API.

BodyRequired
appId
string
items
array
promptRequired
string
draftId
string
projectIdRequired
string
resourceId
string
contentType
string
organizationIdRequired
string
SDK
import { createGiantContext } from "@giantcontext/sdk-typescript";
const gc = createGiantContext({ apiKey: process.env.GIANTCONTEXT_API_KEY! });
const data = {  prompt: "Example prompt"};
const { data: draft } = await gc.drafts.generateDraft(data);
POST

Create an edit draft

/drafts/edit

Creates 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.

BodyRequired
prompt
string
projectIdRequired
string
resourceIdRequired
string
contentTypeRequired
string
organizationIdRequired
string
SDK
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);
POST

Unarchive a draft

/organizations/{id}/projects/{projectId}/mind/drafts/{draftId}/unarchive

Restores a previously archived draft to the default list.

Parameters
idRequired
path · string
projectIdRequired
path · string
draftIdRequired
path · string
SDK
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"});
POST

Archive a draft

/organizations/{id}/projects/{projectId}/mind/drafts/{draftId}/archive

Hides 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.

Parameters
idRequired
path · string
projectIdRequired
path · string
draftIdRequired
path · string
SDK
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

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.

Parameters
idRequired
path · string
projectIdRequired
path · string
draftIdRequired
path · string
SDK
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

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).

Parameters
idRequired
path · string
projectIdRequired
path · string
draftIdRequired
path · string
SDK
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"});
GET

List drafts for a project

/organizations/{id}/projects/{projectId}/mind/drafts

Returns a paginated list of AI-generated content drafts for the specified project. By default archived drafts are hidden — pass includeArchived=true to include them.

Parameters
page
query · number
pageSize
query · number
lite
query · stringWhen 'true', return only essential fields (id, slug, title/name). Useful for context fetching, link resolution, and reducing payload size.
includeArchived
query · unionWhen true, archived drafts are included. Default: false.
idRequired
path · string
projectIdRequired
path · string
SDK
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"});

Built byHuman
This content was designed and written by a human.
[0]
Colonne
    Colonne 2
    • Discord
    • BlueSky

    © 2026 Giant Context
    ConfidentialitéConditions d'utilisationPolitique relative aux cookies
    Drafts