Templates

Draft a template in another language

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.

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

Request body

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.

blocksstring[] required

The template body, one entry per block, markers already stripped.

Response

The translated blocks.

okunknown required

Changes

No recorded changes to this operation across all 1 revision of this API.