---
title: "Draft a template in another language"
method: POST
path: "/api/v1/templates/translate"
tags: ["Templates"]
---

# Draft a template in another language

`POST /api/v1/templates/translate`

## Request

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

Sends the blocks of one template body to a model and returns the same blocks in the target language. Merge fields are checked on the way back and the whole translation is refused if one of them moved, because a contract with a renamed placeholder reads correctly and files a blank. The result is a draft: it is not written to the template until the owner saves it.

## Request body

- object
  - `from` 'en' | 'nl' | 'fr' | 'de' | 'es' | 'it' | 'pt' | 'pl' | 'ro' | 'bg' | 'cs' | 'sk' | 'hu' | 'hr' | 'sr' | 'sl' | 'el' | 'da' | 'sv' | 'nb' | 'fi' | 'et' | 'lv' | 'lt' | 'ga' | 'mt' | 'is' | 'sq' | 'mk' | 'uk' | 'ru' | 'tr' | 'ar' | 'fa' | 'he' | 'ur' | 'hi' | 'bn' | 'zh' | 'ja' | 'ko' | 'vi' | 'th' | 'id' | 'sw' | 'so' | 'am' | 'ti' | 'ps' | 'ku', required: An ISO 639-1 code from the list in config/languages.ts.
  - `to` 'en' | 'nl' | 'fr' | 'de' | 'es' | 'it' | 'pt' | 'pl' | 'ro' | 'bg' | 'cs' | 'sk' | 'hu' | 'hr' | 'sr' | 'sl' | 'el' | 'da' | 'sv' | 'nb' | 'fi' | 'et' | 'lv' | 'lt' | 'ga' | 'mt' | 'is' | 'sq' | 'mk' | 'uk' | 'ru' | 'tr' | 'ar' | 'fa' | 'he' | 'ur' | 'hi' | 'bn' | 'zh' | 'ja' | 'ko' | 'vi' | 'th' | 'id' | 'sw' | 'so' | 'am' | 'ti' | 'ps' | 'ku', required: An ISO 639-1 code from the list in config/languages.ts.
  - `blocks` string[], required: The template body, one entry per block, markers already stripped.

## Response `200`

The translated blocks.

- object
  - `ok` unknown, required
  - `data` object, required
    - `blocks` string[], required: The translated blocks, in the order they were sent, and the same number of them.
  - `meta` object, required
    - `requestId` string, required: Echoed in the x-request-id header. Quote it in a bug report.

## Other responses

- `422`: The model returned nothing usable, and the reason why.
- `429`: Too many translations.

---

[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)
