---
name: metabase_move_collection
kind: function
lang: py
domain: infra
version: "1.0.0"
purity: impure
signature: "def metabase_move_collection(client: MetabaseClient, collection_id: int, parent_id: int | None) -> dict"
description: "Mueve una collection (sub-arbol completo) a otro padre. Endpoint: PUT /api/collection/:id con {parent_id: ...}."
tags: [metabase, collection, move, tree, api, python]
uses_functions: []
uses_types: []
returns: []
returns_optional: false
error_type: "error_go_core"
imports: [httpx]
params:
  - name: client
    desc: "instancia autenticada de MetabaseClient"
  - name: collection_id
    desc: "ID de la collection a mover"
  - name: parent_id
    desc: "ID de la collection padre destino; None mueve a la raiz (Our analytics)"
output: "dict: collection actualizada con nuevo parent_id y location actualizado"
tested: false
tests: []
test_file_path: ""
file_path: "python/functions/metabase/collections.py"
---

## Ejemplo

```python
# Mover collection 12 dentro de collection 3
col = metabase_move_collection(client, 12, parent_id=3)
print(col["location"])  # "/3/"

# Mover a raiz
col = metabase_move_collection(client, 12, parent_id=None)
print(col["location"])  # "/"
```

## Notas

Metabase reubica atomicamente la collection y todo su sub-arbol: colecciones
hijas, cards, dashboards y documents contenidos en ellas. El campo `location`
de la respuesta refleja la nueva ruta en formato `"/parent_id/"` o `"/"` para
la raiz.

Para mover un document individual usar `metabase_move_document`.
