---
title: "Read a document into a template body"
method: POST
path: "/api/v1/templates/import"
tags: ["Templates"]
---

# Read a document into a template body

`POST /api/v1/templates/import`

## Request

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

Takes the pages of a contract as pictures and returns them as markdown, so an owner can replace a template body with a document they already have. The pages are drawn by the caller, because nothing on the account opens a PDF. This sends the pages to a model, and the transcription is a draft: nothing is written to any template until the owner saves it.

## Response `200`

The document as markdown.

- object
  - `ok` unknown, required
  - `data` object, required
    - `markdown` string, required: The document as markdown. Empty where nothing could be read, with `trouble` saying why.
    - `pages` number, required: How many pages were read.
    - `model` string, required: The model that read them.
    - `trouble` 'unavailable' | 'unreadable' | 'ran_long': Why the transcription is short or missing. The pages read before it are still returned.
  - `meta` object, required
    - `requestId` string, required: Echoed in the x-request-id header. Quote it in a bug report.

## Other responses

- `400`: The pages did not arrive in a shape that can be read.
- `422`: Nothing could be read, 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)
