APIAI documents
AI edit a document
POST /documents/{id}/ai-edit
AuthorizationBearer <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.
In: header
Scope: connector:write
Path Parameters
idstring
Document ID (UUID), as returned by GET /documents.
Format
uuidinstructionsstring
What to change.
Length
1 <= length <= 20000context?string
Notes or requirements the AI should use.
Length
length <= 100000organizationId?string
Organization the document belongs to, if any.
stream?boolean
Return Server-Sent Events instead of 202.
Default
falseResponse Body
curl -X POST "https://app.chatprd.ai/api/connectors/v1/documents/497f6eca-6276-4993-bfeb-53cbbbba6f08/ai-edit" \ -H "Content-Type: application/json" \ -d '{ "instructions": "Add a rollout plan section with a 10% beta first." }'{
"event": "generation",
"data": {}
}{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"kind": "create",
"status": "generating",
"threadId": "51f72284-0555-48fe-a20a-4369ee94dc3e",
"documentId": "4704590c-004e-410d-adf7-acb7ca0a7052",
"url": "http://example.com",
"pollUrl": "string"
}{
"error": {
"code": "unauthorized",
"message": "Invalid or missing API key."
}
}{
"error": {
"code": "unauthorized",
"message": "Invalid or missing API key."
}
}{
"error": {
"code": "unauthorized",
"message": "Invalid or missing API key."
}
}{
"error": {
"code": "unauthorized",
"message": "Invalid or missing API key."
}
}{
"error": {
"code": "unauthorized",
"message": "Invalid or missing API key."
}
}{
"error": {
"code": "unauthorized",
"message": "Invalid or missing API key."
}
}