Skip to content

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"]
    }
]
category
Any of:
string

Filter by template category

Successful Response

Response Get Document Templates Api Writing Templates Get
Array<object>
DocumentTemplate

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
templateId
required
Templateid
string
name
required
Name
string
description
required
Description
string
category
required
Category
string
content
required
Content
string
variables
required
Variables
Array<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