Skip to content
DunSocial Docs

Chat and generate

AI Studio chat, platform generation, and speech-to-text.

AI routes need a session bearer (PATs cannot call AI). Most also need X-Workspace-Id. Extra rate limit: about 20 requests per minute.

Chat (streaming)

POST /api/ai/chat

{
"messages": [
  { "role": "user", "content": "Draft a LinkedIn post about our launch" }
],
"sessionId": "optional-session-id",
"connectedPlatforms": { "linkedin": true, "x": false },
"selectedCollectionIds": ["COLLECTION_ID"]
}

Returns a streaming UI message response. History is auto-saved for the workspace.

Generate for a platform

POST /api/ai/generate/:type

:type is one of: x-tweet, x-thread, linkedin, bluesky, threads, youtube-shorts, reddit.

Body: most types need { "topic": "..." }. LinkedIn needs { "content": "..." } (source text to rewrite). Optional fields include subreddit, count.

Response: { type, items: [{ id, text }] }.

Transcribe audio

POST /api/ai/transcribeBearer only (no workspace header).

Send either:

  • JSON { audioBase64, filename?, mimeType?, language? }, or
  • multipart form with audio / file

Returns { transcript, metadata }. 503 if speech-to-text is not configured. 413 if the file is too large.

Daily ideas

Needs enough memory in the workspace (about 5+ memories).

Method Path
GET /api/ai/daily-ideas?count=
GET /api/ai/daily-ideas/all
GET /api/ai/daily-ideas/eligibility{ hasEnough }

Chat history

Method Path
GET /api/ai/history?limit=&offset=
POST /api/ai/history{ title, messages, sessionId? }
POST /api/ai/history/auto-save
GET / PATCH / DELETE /api/ai/history/:id

Extract facts and grounding

Method Path Notes
POST /api/ai/extract-facts/text { text }
POST /api/ai/extract-facts/url { urls[], additionalText? } — daily quota
POST /api/ai/grounding/url-analysis { urls[], question }
POST /api/ai/grounding/google-search { query }
POST /api/ai/generate-voice-preset { description }
POST /api/documents/extract-facts/pdf { fileBase64, filename } — needs Bearer + X-Workspace-Id
POST /api/documents/extract-facts/text docx / txt / md — needs Bearer + X-Workspace-Id

Feedback

POST /api/feedback with { content, pageRoute, userAgent? }. Optional X-Workspace-Id.