---
title: "CreateDocumentTemplateAsync"
url: "https://devportal.jilson.dev/apis/document-generator-pkce-flow-1/versions/c7bf5731-4982-4310-bcfe-512415c7d543/operations/CreateDocumentTemplateAsync"
---

> Full API specification: https://devportal.jilson.dev/apis/document-generator-pkce-flow-1/versions/c7bf5731-4982-4310-bcfe-512415c7d543.md

# CreateDocumentTemplateAsync

`POST` `/v1/documentTemplates`

Operation ID: `CreateDocumentTemplateAsync`

## Request body

Content types: `application/json-patch+json`, `application/json`, `text/json`, `application/*+json`

## Responses

- `201` - Created
- `400` - Bad Request
- `401` - Unauthorized
- `422` - Client Error
- `500` - Server Error

## OpenAPI definition

```yaml
openapi: 3.0.1
info:
  title: Document Generator API
  version: "1.0"
paths:
  /v1/documentTemplates:
    post:
      tags:
        - DocumentTemplates
      operationId: CreateDocumentTemplateAsync
      requestBody:
        content:
          application/json-patch+json:
            schema:
              $ref: "#/components/schemas/DocumentTemplateRequest"
          application/json:
            schema:
              $ref: "#/components/schemas/DocumentTemplateRequest"
          text/json:
            schema:
              $ref: "#/components/schemas/DocumentTemplateRequest"
          application/*+json:
            schema:
              $ref: "#/components/schemas/DocumentTemplateRequest"
      responses:
        "201":
          description: Created
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/DocumentTemplateResponse"
        "400":
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ProblemDetails"
        "401":
          description: Unauthorized
        "422":
          description: Client Error
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ProblemDetails"
        "500":
          description: Server Error
security:
  - https://auth.sharefiletest.io:
      - docgen:all.full
      - docgen:doctemplate.packaging
      - docgen:doctemplate.template-provider
      - docgen:doctemplate.permanentdelete
components:
  schemas:
    DocumentTemplateRequest:
      type: object
      properties:
        name:
          type: string
          nullable: true
        rsTemplateId:
          type: string
          nullable: true
        rsTemplateParentId:
          type: string
          nullable: true
        status:
          $ref: "#/components/schemas/DocumentTemplateStatus"
        file:
          $ref: "#/components/schemas/FileDTO"
        roles:
          type: array
          items:
            $ref: "#/components/schemas/Role"
          nullable: true
        fields:
          type: array
          items:
            $ref: "#/components/schemas/Field"
          nullable: true
        templateType:
          $ref: "#/components/schemas/TemplateType"
        esignSettings:
          $ref: "#/components/schemas/EsignSettings"
        workflowSettings:
          $ref: "#/components/schemas/WorkflowSettings"
        description:
          type: string
          nullable: true
        message:
          type: string
          nullable: true
        tags:
          type: array
          items:
            type: string
          nullable: true
        isKbaEnabled:
          type: boolean
          nullable: true
        isPasscodeEnabled:
          type: boolean
          nullable: true
        isShared:
          type: boolean
          nullable: true
        signerSequencing:
          type: boolean
          nullable: true
        containerRID:
          type: string
          nullable: true
        base64EncodedFile:
          type: string
          nullable: true
        variables:
          type: array
          items:
            $ref: "#/components/schemas/Variable"
          nullable: true
      additionalProperties: false
    DocumentTemplateResponse:
      type: object
      properties:
        id:
          type: string
          nullable: true
        rid:
          type: string
          nullable: true
        containerRID:
          type: string
          nullable: true
        name:
          type: string
          nullable: true
        creator:
          $ref: "#/components/schemas/User"
        rsTemplateId:
          type: string
          nullable: true
        rsTemplateParentId:
          type: string
          nullable: true
        status:
          $ref: "#/components/schemas/DocumentTemplateStatus"
        file:
          $ref: "#/components/schemas/File"
        roles:
          type: array
          items:
            $ref: "#/components/schemas/Role"
          nullable: true
        fields:
          type: array
          items:
            $ref: "#/components/schemas/Field"
          nullable: true
        templateType:
          $ref: "#/components/schemas/TemplateType"
        esignSettings:
          $ref: "#/components/schemas/EsignSettings"
        workflowSettings:
          $ref: "#/components/schemas/WorkflowSettings"
        permissions:
          $ref: "#/components/schemas/PermissionSet"
        description:
          type: string
          nullable: true
        message:
          type: string
          nullable: true
        tags:
          type: array
          items:
            type: string
          nullable: true
        isKbaEnabled:
          type: boolean
          nullable: true
        isPasscodeEnabled:
          type: boolean
          nullable: true
        isShared:
          type: boolean
          nullable: true
        signerSequencing:
          type: boolean
          nullable: true
        createdAt:
          type: string
          format: date-time
          nullable: true
        updatedAt:
          type: string
          format: date-time
          nullable: true
        variables:
          type: array
          items:
            $ref: "#/components/schemas/Variable"
          nullable: true
      additionalProperties: false
    ProblemDetails:
      type: object
      properties:
        type:
          type: string
          nullable: true
        title:
          type: string
          nullable: true
        status:
          type: integer
          format: int32
          nullable: true
        detail:
          type: string
          nullable: true
        instance:
          type: string
          nullable: true
      additionalProperties: {}
    DocumentTemplateStatus:
      enum:
        - Draft
        - Live
        - Expired
      type: string
    FileDTO:
      type: object
      properties:
        fileRID:
          type: string
          nullable: true
        fileContainerRID:
          type: string
          nullable: true
        fileId:
          type: string
          nullable: true
        fileName:
          type: string
          nullable: true
        eTag:
          type: string
          nullable: true
        fileSource:
          $ref: "#/components/schemas/FileSource"
        shareFileStreamId:
          type: string
          nullable: true
        createdById:
          type: string
          nullable: true
        createdOnUtc:
          type: string
          format: date-time
        deletedOnUtc:
          type: string
          format: date-time
          nullable: true
        deletedById:
          type: string
          nullable: true
        base64EncodedFile:
          type: string
          nullable: true
        remoteUrl:
          type: string
          nullable: true
      additionalProperties: false
    Role:
      type: object
      properties:
        id:
          type: string
          nullable: true
        name:
          type: string
          nullable: true
        sequence:
          type: integer
          format: int32
        isSender:
          type: boolean
      additionalProperties: false
    Field:
      type: object
      properties:
        id:
          type: string
          nullable: true
        type:
          $ref: "#/components/schemas/FieldType"
        x:
          type: number
          format: double
          nullable: true
        y:
          type: number
          format: double
          nullable: true
        height:
          type: number
          format: double
          nullable: true
        width:
          type: number
          format: double
          nullable: true
        isRequired:
          type: boolean
          nullable: true
        groupRequirement:
          $ref: "#/components/schemas/GroupRequirement"
        fontSize:
          type: integer
          format: int32
          nullable: true
        multiline:
          type: boolean
          nullable: true
        transparent:
          type: boolean
          nullable: true
        textAlign:
          $ref: "#/components/schemas/TextAlignment"
        selectOptions:
          type: array
          items:
            type: string
          nullable: true
        chargeAfterExecuted:
          type: boolean
          nullable: true
        paymentAmount:
          type: integer
          format: int32
          nullable: true
        helpText:
          type: string
          nullable: true
        page:
          type: integer
          format: int32
          nullable: true
        name:
          type: string
          nullable: true
        isDateSigned:
          type: boolean
          nullable: true
        dateFormat:
          type: string
          nullable: true
        signatureImage:
          type: string
          nullable: true
        signatureText:
          type: string
          nullable: true
        signatureType:
          $ref: "#/components/schemas/SignatureType"
        signatureJsonData:
          type: string
          nullable: true
        groupId:
          type: string
          nullable: true
        signatureId:
          type: string
          nullable: true
        assignedTo:
          $ref: "#/components/schemas/Role"
        dataPreFilledType:
          $ref: "#/components/schemas/DataPreFilledType"
        variableId:
          type: string
          nullable: true
        attributePath:
          type: string
          nullable: true
        value:
          type: string
          nullable: true
        fullyQualifiedPath:
          type: string
          nullable: true
      additionalProperties: false
    TemplateType:
      enum:
        - Static
        - Dynamic
      type: string
    EsignSettings:
      type: object
      properties:
        expiresInDays:
          type: integer
          format: int32
      additionalProperties: false
    WorkflowSettings:
      type: object
      properties:
        needApproval:
          type: boolean
      additionalProperties: false
    Variable:
      type: object
      properties:
        id:
          type: string
          nullable: true
        name:
          type: string
          nullable: true
        provider:
          type: string
          nullable: true
        entity:
          type: string
          nullable: true
        connectionRID:
          type: string
          nullable: true
        entityId:
          type: string
          nullable: true
        version:
          type: string
          nullable: true
      additionalProperties: false
    User:
      type: object
      properties:
        id:
          type: string
          nullable: true
        firstName:
          type: string
          nullable: true
        lastName:
          type: string
          nullable: true
        emailAddress:
          type: string
          nullable: true
      additionalProperties: false
    File:
      type: object
      properties:
        fileRID:
          type: string
          nullable: true
        fileContainerRID:
          type: string
          nullable: true
        fileId:
          type: string
          nullable: true
        fileName:
          type: string
          nullable: true
        eTag:
          type: string
          nullable: true
        fileSource:
          $ref: "#/components/schemas/FileSource"
        shareFileStreamId:
          type: string
          nullable: true
        createdById:
          type: string
          nullable: true
        createdOnUtc:
          type: string
          format: date-time
        deletedOnUtc:
          type: string
          format: date-time
          nullable: true
        deletedById:
          type: string
          nullable: true
      additionalProperties: false
    PermissionSet:
      type: object
      properties:
        canRead:
          type: boolean
          nullable: true
        canCreate:
          type: boolean
          nullable: true
        canDelete:
          type: boolean
          nullable: true
        canShare:
          type: boolean
          nullable: true
        canModify:
          type: boolean
          nullable: true
      additionalProperties: false
    FileSource:
      enum:
        - ShareFile
        - Base64String
        - RemoteUrl
      type: string
    FieldType:
      enum:
        - SignatureComponent
        - InitialsComponent
        - DateComponent
        - TextComponent
        - SelectComponent
        - CheckComponent
        - CheckGroupComponent
        - AttachmentComponent
        - SignatureAnnotationComponent
        - TextAnnotationComponent
        - CheckmarkAnnotationComponent
        - PaymentComponent
      type: string
    GroupRequirement:
      enum:
        - OnlyOne
        - OneOrMore
      type: string
    TextAlignment:
      enum:
        - Left
        - Right
        - Center
      type: string
    SignatureType:
      enum:
        - Typed
        - Drawn
      type: string
    DataPreFilledType:
      enum:
        - None
        - Manual
        - SourceMapped
      type: string
  securitySchemes:
    https://auth.sharefiletest.io:
      type: oauth2
      flows:
        authorizationCode:
          authorizationUrl: https://auth.sharefiletest.io/connect/authorize
          tokenUrl: https://auth.sharefiletest.io/connect/token
          scopes:
            docgen:all.full: Full access to Doc Gen APIs.
            docgen:doctemplate.packaging: Doc Template Packaging APIs Access
            docgen:doctemplate.template-provider: Document Templates full access to template provider
            docgen:doctemplate.permanentdelete: Access to permanently delete document template and metadata
```
