AI create a document
POST /documents/ai-create
apiKey connector:writeAuthorizationBearer <token>ChatPRD API key from Settings → API Keys, sent as Authorization: Bearer <key>. Read-only keys carry the connector:read scope; read/write keys also carry connector:write. Requires a Pro, Team or Enterprise plan.
Scope: connector:write
application/json- body
prompt*stringWhat the AI should write.
1 <= length <= 20000context?stringNotes, research or requirements the AI should use.
length <= 100000templateId?stringTemplate ID from GET /templates, default for the ChatPRD PRD template, or none. Omit to use the user's default template.
projectId?stringProject to create the document in.
organizationId?stringOrganization workspace to create the document in.
stream?booleanReturn Server-Sent Events instead of 202.
falseServer-Sent Events stream (when stream: true). Each event's data is JSON.
text/event-stream- response
SSE events, in order: generation (id, kind, threadId, documentId, url) first; document.started (documentId, title) once a new document exists; content.delta (documentId, delta) with Markdown chunks while create/rewrite write the document; message.delta (delta) for the AI's short summary; then document.completed (generationId, summary, document) or error (generationId, code, message); finally done. Comment lines (: keep-alive) are sent every 15s.
event*string"generation""document.started""content.delta""message.delta""document.completed""error""done"data*curl -X POST 'https://app.chatprd.ai/api/connectors/v1/documents/ai-create' \ -H 'Content-Type: application/json' \ -d '{ "prompt": "PRD for SSO login for enterprise admins", "templateId": "default", "stream": true}'{ "event": "generation", "data": {}}