---
title: "Extract Narratives"
method: POST
path: "/api/extract-narratives"
tags: ["extraction"]
---

# Extract Narratives

`POST /api/extract-narratives`

Extract narrative questions from uploaded XLSX or DOCX template.

Args:
    file: Template file (.xlsx or .docx)
    sheets: Optional JSON array of sheet names to process (XLSX only)
            Example: '["Sheet1", "Sheet2"]'

Returns:
    Extracted narrative questions with source locations

Raises:
    400: Unsupported file type or invalid sheets parameter
    413: File too large
    422: File parsing error
    500: LLM API error or missing configuration

## Response `200`

Successful Response

- ExtractionResponse — API response for narrative extraction.
  - `success` boolean, required
  - `file_name` string, required
  - `file_type` string, required
  - `question_count` integer, required
  - `questions` NarrativeQuestionResponse[], required
    - `narrative_question` string, required
    - `narrative_context` string[], required
    - `source_loc` string, nullable
    - `description` string, nullable
  - `api_calls_used` integer, required
  - `processing_time_seconds` number, required

## Other responses

- `422` — Validation Error

---

[API](https://skmtc.dev/verdantapp/apis/fastapi-backend.md) · [All operations](https://skmtc.dev/verdantapp/apis/fastapi-backend/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/verdantapp/fastapi-backend/revisions/c3e41fa00672/schema)
