---
title: "Create a template from a .docx file"
method: POST
path: "/template/upload"
tags: ["Templates"]
---

# Create a template from a .docx file

`POST /template/upload`

## Request

- Base URL: `https://apisign.io/api`
- URL: `https://apisign.io/api/template/upload`
- Auth: API key in header `x-api-key`

Create a template from a Word document. The template is named after the file and has no field definitions.

## Request body

- FileUploadRequest
  - `filename` string, required: File name ending in .docx
  - `fileData` string, required: File bytes, base64-encoded

## Response `200`

Template created

- object
  - `template` Template
    - `id` string
    - `created_at` string, date-time
    - `updated_at` string, date-time
    - `org_id` string
    - `name` string
    - `content` string, nullable: Markdown with {{variables}}
    - `fields` StoredFields, nullable: Field data as stored on a contract or template
      - `fields` FieldDefinition[]
        - `name` string, required: Variable name without braces
        - `type` string, required: signature, initials, signer_name, timestamp, text, email, phone or date
        - `completedBy` 'signer' | 'creator', required
        - `label` string: Prompt shown for a text field
      - `signers` object[]: Per-signer field assignments, matched to signers by signing_order
        - `signing_order` integer
        - `signerFields` string[]
    - `archived` boolean
    - `test_mode` boolean

## Other responses

- `400`: Invalid request, or the action is not allowed in the resource's current state
- `401`: Missing, invalid, expired or deleted API key. Body: `{ "error": "Unauthorized" }`
- `500`: Internal server error (also returned for a request body that is not valid JSON)

---

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