Skip to main content

Chat & PRD Generation API

General AI Chat

POST /api/chat
Conversational AI endpoint that resolves the best available provider (BYOK → org key → platform key). Body:
FieldTypeRequiredDescription
messagesarrayYesArray of {role, content} message objects
providerstringNoForce a specific provider (openai, anthropic, gemini)
projectIdstringNoAssociate with a project for context
curl -X POST https://app.thig.ai/api/chat \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "messages": [
      {"role": "user", "content": "What sections should a good PRD include?"}
    ],
    "provider": "anthropic"
  }'
Response:
{
  "role": "assistant",
  "content": "Based on your requirements, I'd recommend..."
}

Project Chat

POST /api/projects/{projectId}/chat
Non-streaming chat within a project context. Saves QA pairs to the project. Body:
FieldTypeRequiredDescription
messagestringYesUser message
conversationHistoryarrayNoPrevious messages for context
curl -X POST https://app.thig.ai/api/projects/proj_123/chat \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"message": "The app should support offline mode and push notifications"}'
Response:
{
  "response": "Great, let me ask about your target users...",
  "qaPairId": "qa_123"
}

Streaming Conversation

POST /api/projects/{projectId}/conversation/stream
SSE streaming endpoint for the conversational PRD builder. Body: Same as Project Chat. SSE Events:
data: {"type": "progress", "phase": "Analyzing your requirements...", "percent": 15}
data: {"type": "content", "content": "Based on what you've described..."}
data: {"type": "done", "fullContent": "Complete response text..."}
curl -X POST https://app.thig.ai/api/projects/proj_123/conversation/stream \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Accept: text/event-stream" \
  -d '{"message": "Users need to collaborate in real-time"}'

Generate PRD (Non-Streaming)

POST /api/generate-prd
Generate a complete PRD from the project’s QA pairs. Body:
FieldTypeRequiredDescription
projectIdstringYesProject to generate PRD for
stylestringNoPRD style (comprehensive, technical, business, lean, agile)
regeneratebooleanNoForce regeneration
curl -X POST https://app.thig.ai/api/generate-prd \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"projectId": "proj_123", "style": "comprehensive"}'

Generate PRD (Streaming)

POST /api/generate-prd/stream
SSE streaming PRD generation. Same body as non-streaming. SSE Events:
data: {"type": "progress", "phase": "Generating Executive Summary...", "percent": 10}
data: {"type": "content", "content": "# Executive Summary\n\n..."}
data: {"type": "done", "fullContent": "Complete PRD content..."}
data: {"type": "error", "message": "Generation failed", "code": "GENERATION_ERROR"}
curl -N -X POST https://app.thig.ai/api/generate-prd/stream \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Accept: text/event-stream" \
  -d '{"projectId": "proj_123", "style": "technical"}'

Chat Export

GET /api/projects/{projectId}/chat-export
Export the conversation history. Query Parameters:
ParameterTypeDescription
formatstringpdf, csv, or json
curl -G https://app.thig.ai/api/projects/proj_123/chat-export \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d "format=json" \
  -o chat-history.json
Returns the file directly as a download.