---
title: "Add fields the Word file has and the sheet lacks"
method: POST
path: "/v1/doc-gen/templates/{id}/rescan"
tags: ["Document Generation"]
---

# Add fields the Word file has and the sheet lacks

`POST /v1/doc-gen/templates/{id}/rescan`

## Request

- Base URL: `https://api.talonic.com`
- URL: `https://api.talonic.com/v1/doc-gen/templates/{id}/rescan`
- Auth: HTTP bearer

Reads the stored Word file again for fields the sheet does not have yet (such as red passages). Added fields join as unconfirmed suggestions; every existing field keeps its source, decision and reason. Requires a person at or above member behind the key.

## Path parameters

- `id` string, uuid, required

## Response `201`

The template and the keys of the fields added.

- object
  - `template` DocGenTemplate
    - `id` string, uuid
    - `index` integer: Position in creation order, starting at 1.
    - `name` string
    - `file` string: The uploaded file name.
    - `group` string: Empty when the template has no group.
    - `kind` 'letter' | 'agreement'
    - `pairId` string, uuid, nullable: The companion template generated with this one.
    - `version` string: Empty when the template has no version.
    - `fields` DocGenTemplateField[]
      - `key` string
      - `label` string
      - `kind` 'text' | 'choice' | 'date'
      - `options` string[]: The choices a dropdown control offers; empty for free text and dates.
      - `dateFormat` string, nullable: The Word date format of a date control, such as `dd.MM.yyyy`.
      - `where` string[]: Document parts the field sits in (body, header or footer).
      - `zone` 'header' | 'address' | 'reference' | 'body' | 'signature' | 'footer'
      - `group` string, nullable: The block of the text the field belongs to, such as an address.
      - `controls` string[]: The Word content controls (by id) this field fills.
      - `source` DocGenFieldSource: Where a field's value comes from. `type` selects the shape: `product` (`field`), `reference` (`column`), `extract` (`from`, `pattern`, optional `group` 0-9, optional `mode` `capture` or `remove`), `first` (`sources`, a list of product, reference, extract or party sources), `case` (`caseKey`, optional `when` condition), `user` (`profile`), `rule` (`rule`), `today`, `party` (`role`, `attribute`), `variant` (`by`, `map`, `fallback`), `condition` (`when`, optional `text`), `fixed` (`text`), and `lookup` (`from`, `cases`, `fallback`). A source is validated when stored; one of no known shape is refused.
        - `type` 'product' | 'reference' | 'extract' | 'first' | 'case' | 'user' | 'rule' | 'today' | 'party' | 'variant' | 'condition' | 'fixed' | 'lookup', required
      - `confirmed` boolean: True once a person confirmed the source; until then it is the platform's suggestion.
      - `reason` string, nullable: Why the platform suggested this source.
      - `spot` object, nullable: For a red passage of the template, the words as the template prints them.
        - `original` string
    - `dataProductId` string, uuid, nullable: The data product the field sheet was last proposed for; null until a proposal ran.
    - `updatedAt` string, date-time
    - `uploadedBy` string
    - `generated` integer: How many batches used the template.
    - `lastUsedAt` string, date-time, nullable
  - `added` string[]

## Other responses

- `400`: The request is invalid.
- `403`: The API key does not have the required scope.
- `404`: The requested resource was not found.

## Changes

- **2026-10-28** `0a485a46163e`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/talonic/apis/talonic-api/changes/v1/doc-gen/templates/:id/rescan/post.md)

---

[API](https://skmtc.dev/talonic/apis/talonic-api.md) - [All operations](https://skmtc.dev/talonic/apis/talonic-api/llms.txt) - [OpenAPI document](https://skmtc.dev/talonic/apis/talonic-api/revisions/9f6d53e2ab5e?raw)
