***

title: body
slug: /reference/python/agents/data-map/body
description: Set the request body for a webhook.
max-toc-depth: 3
---------------------

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

[ref-datamap]: /docs/server-sdks/reference/python/agents/data-map

[params]: /docs/server-sdks/reference/python/agents/data-map/params

Set the request body for the most recently added webhook. Used for POST/PUT
requests. Writes to the `body` key of the webhook definition.

<Warning>
  `body()` and [`params()`][params] write to different keys in the webhook
  specification: `body` sets the request body, while `params` sets
  query/form parameters.
</Warning>

## **Parameters**

<ParamField path="data" type="dict[str, Any]" required={true} toc={true}>
  Request body data. Supports `${variable}` substitutions.
</ParamField>

## **Returns**

[`DataMap`][ref-datamap] -- Self for method chaining. Raises `ValueError` if no webhook has been
added yet.

## **Example**

```python {10}
from signalwire import DataMap, FunctionResult

search = (
    DataMap("search_docs")
    .purpose("Search documentation")
    .parameter("query", "string", "Search query", required=True)
    .webhook(
        "POST",
        "https://api.docs.example.com/search",
        headers={"Authorization": "Bearer TOKEN"}
    )
    .body({"query": "${args.query}", "limit": 3})
    .output(FunctionResult("Found: ${response.results[0].title}"))
)
```