---
title: "Create a Markdown template and its source-defined signer roles and fields"
method: POST
path: "/api/v1/templates/markdown"
tags: ["Templates"]
---

# Create a Markdown template and its source-defined signer roles and fields

`POST /api/v1/templates/markdown`

## Request

- Base URL: `https://api.korala.ai`
- URL: `https://api.korala.ai/api/v1/templates/markdown`
- Auth: one of:
  - API key in header `X-API-Key`
  - `bearer` (a scheme the document does not define)

## Request body

- CreateMarkdownTemplateDto
  - `source` string, required: Markdown with the supported Liquid variable, if/unless and for syntax.
  - `sampleData` object: Example JSON for previews. Never implicitly fills a generated agreement.
  - `pageSize` 'A4' | 'Letter'
  - `name` string, required
  - `description` string

## Response `201`

- TemplateDto
  - `collectionIds` string[]: Collection memberships; omitted on lists unless includeCollections=true.
  - `markdown` MarkdownTemplateSourceDto
    - `source` string, required
    - `sampleData` object, required
    - `revision` number, required
    - `formatVersion` 1, required
    - `pageSize` 'A4' | 'Letter', required
    - `pageCount` number: Pages the source renders to with its sample data, as of the last save. Absent on templates saved before this was recorded.
  - `googleSource` GoogleProvenanceDto
    - `fileId` string, required
    - `name` string, required
    - `url` string, required
    - `mimeType` string, required
    - `driveVersion` string, required
    - `docsRevision` string
    - `tabCount` number
    - `skipEmptyPages` boolean: Whether conversion suppresses automatic blank parity pages. Absent on older imports, which retain their original pagination.
    - `fetchedAt` string, required
    - `locallyReplacedAt` string: First local file replacement. When present, this provenance describes the original import, not the current template file. Google variable validation no longer applies; the saved pagination policy is retained.
    - `sourceSha256` string, required: SHA-256 of the stored source, after DOCX ZIP normalization.
    - `providerSourceSha256` string: SHA-256 of the original bytes downloaded from Google.
    - `pdfSha256` string, required
    - `dialect` 'korala-simple-v1', required
  - `id` string, required
  - `name` string, required
  - `description` string, nullable
  - `templateType` 'pdf' | 'docx' | 'markdown', required
  - `baseFileUrl` string, required
  - `isActive` boolean, required
  - `sandbox` boolean, required: Created with a test-mode API key (sandbox template)
  - `formFieldsDetected` number, nullable: How many interactive form fields the base PDF ships with, counted when the upload was confirmed. 0 for a flat PDF, null when the file was never scanned.
  - `autoImportFormFields` boolean, required: Whether those embedded fields were placed as template fields automatically when the upload was confirmed.
  - `detectedMergeFields` DetectedMergeFieldDto[], nullable: Auto-detected input fields from DOCX or Markdown (null for PDF templates)
    - `name` string, required
    - `occurrences` number, required
  - `catalogFormSlug` string, nullable: Standard Forms catalog slug this was cloned from, e.g. "irs-w9" (null for uploaded templates)
  - `catalogFormTitle` string, nullable: Catalog form title at clone time, e.g. "IRS Form W-9 …"
  - `catalogRevision` string, nullable: Catalog form revision at clone time, e.g. "Rev. March 2024"
  - `catalogVersionId` string, nullable: ID of the catalog form version this was cloned from
  - `fieldCount` number: Fields the template places. On template lists only.
  - `signerRoleCount` number: Signer roles the template defines. On template lists only.
  - `createdAt` string, date-time, required
  - `updatedAt` string, date-time, required

---

[API](https://skmtc.dev/korala/apis/korala-public-api.md) · [All operations](https://skmtc.dev/korala/apis/korala-public-api/llms.txt) · [OpenAPI document](https://skmtc.dev/korala/apis/korala-public-api/revisions/5c4d7810c507?raw)
