---
title: "Generate document from uploaded file"
method: POST
path: "/v2/document-generations/upload"
---

# Generate document from uploaded file

`POST /v2/document-generations/upload`

## Request

- Base URL: `https://api.signnow.com`
- URL: `https://api.signnow.com/v2/document-generations/upload`
- Auth: HTTP bearer
- TypeScript: <https://skmtc.dev/signnow/apis/signnow-api/docs/v2/document-generations/upload/post.ts> (a function with typed inputs; its response is checked against the schema)

This endpoint allows API users to generate a PDF document by uploading a `.docx` file with tags.

> In development mode, downloaded generated documents will include a watermark.

Learn more about [document generation](/docs/document-generations).

## Request body `multipart/form-data`

- object
  - `file` string, binary, required: The `.docx` file to upload. Maximum size: 10 MB.
  - `data` string, required: A JSON string containing variable mappings. Keys correspond to tag names in the `.docx` template; values are the pre-filled text for each tag. Supports arrays of objects for repeating sections, such as tables and lists. Example for a document with a Products table: `{"Products": [{"ItemPrice": "8", "ItemName": "T-shirt", "ItemQuantity": "10"}, {"ItemPrice": "4", "ItemName": "Belt", "ItemQuantity": "5"}, {"ItemPrice": "20", "ItemName": "Dress", "ItemQuantity": "2"}]}`.
  - `single_document` boolean: If `true`, a single document is generated. If `false`, a document group is generated.

## Response `201`

Successful response.

- object
  - `data` object: Document generation process.
    - `status` 'in_progress' | 'completed' | 'failed': Current status of the document generation process.
    - `process_id` string: ID of the document generation process.

## Other responses

- `400`: * `data` is empty. * `single_document` is not a boolean. * Uploaded file is empty. * Uploaded file exceeds 10 MB. * `data` is not an array. * Uploaded file is not a `.docx`.

---

[API](https://skmtc.dev/signnow/apis/signnow-api.md) - [All operations](https://skmtc.dev/signnow/apis/signnow-api/llms.txt) - [OpenAPI document](https://skmtc.dev/signnow/apis/signnow-api/revisions/1c9c30a6142b?raw)
