---
title: "Propose the merge fields for a document"
method: POST
path: "/api/v1/templates/fields"
tags: ["Templates"]
---

# Propose the merge fields for a document

`POST /api/v1/templates/fields`

## Request

- Base URL: `http://localhost:5180`
- URL: `http://localhost:5180/api/v1/templates/fields`
- Auth: API key in cookie `better-auth.session_token`

Takes a document and returns it with merge fields in place of the parts that belong to one particular tenancy: a name, a rent, a date, an account. Every field is checked against the ones the product can fill, and the answer is compared line by line with what was sent: a proposal that reworded anything is refused whole. Nothing is written to any template.

## Request body

- object
  - `markdown` string, required: The document, as markdown.

## Response `200`

The document with its fields proposed.

- object
  - `ok` unknown, required
  - `data` object, required
    - `markdown` string, required: The same document with merge fields in place of the spans that belong to one tenancy.
    - `placed` string[], required: The fields it put in, in the order they first appear.
    - `model` string, required
  - `meta` object, required
    - `requestId` string, required: Echoed in the x-request-id header. Quote it in a bug report.

## Other responses

- `422`: Nothing usable came back, and the reason why.
- `429`: Too much reading in one minute.

---

[API](https://skmtc.dev/dardaris/apis/dardaris-api.md) · [All operations](https://skmtc.dev/dardaris/apis/dardaris-api/llms.txt) · [OpenAPI document](https://skmtc.dev/dardaris/apis/dardaris-api/revisions/4aff33835c73?raw)
