---
title: "Create a new document from an existing template"
method: POST
path: "/api/v1/templates/{templateId}/generate-document"
deprecated: true
---

# Create a new document from an existing template

`POST /api/v1/templates/{templateId}/generate-document`

> **Deprecated.**

This endpoint is deprecated, but will continue to be supported. For more details, see https://docs.documenso.com/developers/public-api. 

Create a new document from an existing template. Passing in values for title and meta will override the original values defined in the template. If you do not pass in values for recipients, it will use the values defined in the template.

## Path parameters

- `templateId` string, required

## Headers

- `authorization` string, required

## Request body

- object
  - `title` string
  - `externalId` string
  - `folderId` string — The ID of the folder to create the document in. If not provided, the document will be created in the root folder.
  - `recipients` object[], required
    - `id` number, required
    - `email` string, email, required
    - `name` string
    - `signingOrder` number
  - `meta` object
    - `subject` string
    - `message` string
    - `timezone` string
    - `dateFormat` string
    - `redirectUrl` string
    - `signingOrder` 'PARALLEL' | 'SEQUENTIAL'
    - `allowDictateNextSigner` boolean
    - `language` 'de' | 'en' | 'fr' | 'es' | 'it' | 'nl' | 'pl' | 'pt-BR' | 'ja' | 'ko' | 'zh'
    - `distributionMethod` 'EMAIL' | 'NONE'
    - `typedSignatureEnabled` boolean
    - `uploadSignatureEnabled` boolean
    - `drawSignatureEnabled` boolean
    - `emailSettings` unknown
  - `authOptions` object
    - `globalAccessAuth` union
      - 'ACCOUNT' | 'TWO_FACTOR_AUTH' — The type of authentication required for the recipient to access the document.
      - string[]
    - `globalActionAuth` union
      - 'ACCOUNT' | 'PASSKEY' | 'TWO_FACTOR_AUTH' | 'PASSWORD' — The type of authentication required for the recipient to sign the document. This field is restricted to Enterprise plan users only.
      - string[]
  - `formValues` object
  - `prefillFields` union[]
    - union
      - object
        - `id` number — The numeric ID of the field in the template. Use when you have the field ID.
        - `secondaryId` string — The secondaryId of the field (e.g. rut, full_name, email). Use for CSV preset fields. Either id or secondaryId must be provided.
        - `type` 'text', required
        - `label` string
        - `placeholder` string
        - `value` string
      - object
        - `id` number — The numeric ID of the field in the template. Use when you have the field ID.
        - `secondaryId` string — The secondaryId of the field (e.g. rut, full_name, email). Use for CSV preset fields. Either id or secondaryId must be provided.
        - `type` 'number', required
        - `label` string
        - `placeholder` string
        - `value` string
      - object
        - `id` number — The numeric ID of the field in the template. Use when you have the field ID.
        - `secondaryId` string — The secondaryId of the field (e.g. rut, full_name, email). Use for CSV preset fields. Either id or secondaryId must be provided.
        - `type` 'radio', required
        - `label` string
        - `value` string
      - object
        - `id` number — The numeric ID of the field in the template. Use when you have the field ID.
        - `secondaryId` string — The secondaryId of the field (e.g. rut, full_name, email). Use for CSV preset fields. Either id or secondaryId must be provided.
        - `type` 'checkbox', required
        - `label` string
        - `value` string[]
      - object
        - `id` number — The numeric ID of the field in the template. Use when you have the field ID.
        - `secondaryId` string — The secondaryId of the field (e.g. rut, full_name, email). Use for CSV preset fields. Either id or secondaryId must be provided.
        - `type` 'dropdown', required
        - `label` string
        - `value` string
      - object
        - `id` number — The numeric ID of the field in the template. Use when you have the field ID.
        - `secondaryId` string — The secondaryId of the field (e.g. rut, full_name, email). Use for CSV preset fields. Either id or secondaryId must be provided.
        - `type` 'date', required
        - `value` string

## Response `200`

200

- object
  - `documentId` number, required
  - `externalId` string, nullable
  - `recipients` object[], required
    - `recipientId` number, required
    - `name` string, required
    - `email` string, email, required
    - `token` string, required
    - `role` 'CC' | 'SIGNER' | 'VIEWER' | 'APPROVER' | 'ASSISTANT', required
    - `signingOrder` number, nullable
    - `signingUrl` string, required

## Other responses

- `400` — 400
- `401` — 401
- `404` — 404
- `500` — 500

---

[API](https://skmtc.dev/kpitaljobs/apis/documenso-api.md) · [All operations](https://skmtc.dev/kpitaljobs/apis/documenso-api/llms.txt) · [OpenAPI document](https://skmtc.dev/kpitaljobs/apis/documenso-api/revisions/fafcd949413a?raw)
