***

title: get_document
slug: /reference/python/agents/swml-service/get-document
description: Get the current SWML document as a Python dictionary.
max-toc-depth: 3
---------------------

For a complete index of all SignalWire documentation pages, fetch https://signalwire.com/docs/llms.txt

Get the current SWML document as a Python dictionary. The returned structure follows
the standard SWML format with `version` and `sections` keys.

## **Returns**

`dict[str, Any]` — The current SWML document. Structure:

```json
{
    "version": "1.0.0",
    "sections": {
        "main": [
            {"answer": {}},
            {"ai": {...}}
        ]
    }
}
```

## **Example**

```python {7}
from signalwire import SWMLService

service = SWMLService(name="my-service")
service.add_verb("answer", {})
service.add_verb("play", {"url": "https://example.com/audio.mp3"})

doc = service.get_document()
print(doc["version"])       # "1.0.0"
print(len(doc["sections"]["main"]))  # 2
```