Skip to content

Create Writing Document

POST
/api/writing/documents

📝 Create a new writing document

Creates a new document in the writing module with full metadata support. Automatically generates unique ID, calculates word count, and stores in ChromaDB for semantic search. Supports custom fields and tagging.

Form Parameters:

  • title: Document title (required)
  • content: Document content (required)
  • document_type: Type of document (default: “general”)
  • tags: Comma-separated tags (optional)
  • custom_fields: JSON string of custom metadata fields (optional)

Dependencies:

  • writing_service: Injected IshvanaWritingModule instance

Returns:

  • message: Success confirmation message
  • document_id: Generated document ID for reference

Raises:

  • HTTPException 500: If document creation fails

Example Response:

{
    "message": "Document created successfully",
    "document_id": "doc_1703001234.567"
}
Body_create_writing_document_api_writing_documents_post
object
title
required
Title
string
content
Content
string
""
document_type
Document Type
string
default: general
tags
Tags
string
""
custom_fields
Any of:
string
project_id
Any of:
string

Successful Response

Response Create Writing Document Api Writing Documents Post
object
key
additional properties
string

Validation Error

HTTPValidationError
object
detail
Detail
Array<object>
ValidationError
object
loc
required
Location
Array
msg
required
Message
string
type
required
Error Type
string
input
Input
ctx
Context
object