---
name: metabase_create_document_comment
kind: function
lang: py
domain: infra
version: "1.0.0"
purity: impure
signature: "def metabase_create_document_comment(client: MetabaseClient, document_id: int, content: dict, *, child_target_id: str | None = None, parent_comment_id: int | None = None) -> dict"
description: "Crea un comentario en un document. Soporta anclaje a bloque concreto (via UUID de _id) y respuestas en thread (via parent_comment_id). Endpoint: POST /api/comment."
tags: [metabase, document, comments, create, api, python, pendiente-usar]
uses_functions: []
uses_types: []
returns: []
returns_optional: false
error_type: "error_go_core"
imports: [httpx]
params:
  - name: client
    desc: "instancia autenticada de MetabaseClient"
  - name: document_id
    desc: "ID del document donde crear el comentario"
  - name: content
    desc: "arbol ProseMirror del comentario: {type: doc, content: [...]}"
  - name: child_target_id
    desc: "UUID de bloque al que se ancla el comentario (matchea attrs._id de un parrafo). None = comentario a nivel doc"
  - name: parent_comment_id
    desc: "ID del comentario al que se responde. None = comentario top-level"
output: "dict: comentario creado con id, created_at, creator, reactions=[], is_resolved=False"
tested: false
tests: []
test_file_path: ""
file_path: "python/functions/metabase/documents.py"
---

## Ejemplo

```python
# Comentario top-level
metabase_create_document_comment(client, 29, {
    "type": "doc",
    "content": [{"type": "paragraph", "content": [
        {"type": "text", "text": "Deberiamos anadir un paso para configurar Slack"}
    ]}]
})

# Respuesta en thread
metabase_create_document_comment(client, 29, content=reply_tree,
                                  parent_comment_id=1)

# Anclado a un bloque concreto del documento
metabase_create_document_comment(client, 29, content=tree,
                                  child_target_id="48f9a7a4-79a0-a282-03a1-ffe2f76b9106")
```

## Notas

`target_type` se fija internamente a `"document"` (unico valor aceptado por la API en v0.59).

El `content` sigue el mismo schema ProseMirror que los documents (ver whitelist en `metabase_validate_document_payload`).
