Get Document Templates
GET /api/writing/templates
📚 Get available document templates
Retrieves all available document templates with optional category filtering. Templates include structure, variables, and usage metadata for quick document creation from predefined formats.
Query Parameters:
category: Filter templates by category (optional)
Dependencies:
writing_service: Injected IshvanaWritingModule instance
Returns:
- List of DocumentTemplate objects with full template data
Raises:
HTTPException 500: If template retrieval fails
Example Response:
[
{
"template_id": "template_123",
"name": "Character Profile",
"category": "character",
"content": "Name: {{name}}...",
"variables": ["name", "age"]
}
]Parameters
Section titled “ Parameters ”Query Parameters
Section titled “Query Parameters ”Responses
Section titled “ Responses ”Successful Response
Document template model with variable substitution.
Represents a reusable document template with placeholders for variable substitution, enabling rapid document creation with consistent structure.
Fields: template_id: Unique template identifier name: Template name description: Template purpose and usage description category: Template category for organization content: Template content with variable placeholders variables: List of variable names for substitution
Variable Format: Content: “The {{character_name}} wielded the {{weapon_name}}” Variables: [“character_name”, “weapon_name”]
Used By: - TemplateResponse for template retrieval - DocumentFromTemplateRequest for instantiation - Template browser and selection UI - Rapid document creation workflows
object
Validation Error