---
title: "Generate document from uploaded file"
url: "https://docs.signnow.com/docs/document-generation/operations/post-v2-document-generations-upload"
type: "endpoint"
section: "document-generation"
slug: "document-generation/operations/post-v2-document-generations-upload"
method: "POST"
path: "/v2/document-generations/upload"
operation_id: "post-v2-document-generations-upload"
authorization: "bearer"
---

# Generate document from uploaded file

`POST /v2/document-generations/upload`

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).

## Authorization

bearer

## Form Data Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `file` | string | Yes | The `.docx` file to upload. Maximum size: 10 MB. |
| `data` | string | Yes | 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 (e.g., tables, lists). <br>Request example for generating 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 | No | If `true`, a single document is generated. If `false`, a document group is generated. |

## Responses

### 200

Success

**Example** (`Success`)

```json
{
  "data": {
    "status": "in_progress",
    "process_id": "348bf62a-1c97-11f1-a071-5a78fa528452"
  }
}
```

### 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`.

**Example** (`Empty data`)

```json
{
  "errors": [
    {
      "code": 21008003,
      "message": "The `data` field must not be empty."
    }
  ]
}
```

**Example** (`data is not an array`)

```json
{
  "errors": [
    {
      "code": 21008007,
      "message": "The `data` field must be an array."
    }
  ]
}
```

**Example** (`Uploaded file is empty`)

```json
{
  "errors": [
    {
      "code": 21008004,
      "message": "The uploaded file must not be empty."
    }
  ]
}
```

**Example** (`Uploaded file is not a .docx`)

```json
{
  "errors": [
    {
      "code": 21008009,
      "message": "The uploaded file must have a .docx extension."
    }
  ]
}
```

**Example** (`single_document is not a boolean`)

```json
{
  "errors": [
    {
      "code": 21008008,
      "message": "The `single_document` field must be a boolean."
    }
  ]
}
```

**Example** (`Uploaded file exceeds maximum size`)

```json
{
  "errors": [
    {
      "code": 21008005,
      "message": "The uploaded file exceeds the maximum allowed size of 10 MB."
    }
  ]
}
```

## Code Examples

> Replace `$SIGNNOW_ACCESS_TOKEN` and any `{placeholder}` values before running.

### cURL

```bash
curl -X POST \
  "https://api.signnow.com/v2/document-generations/upload" \
  -H "Authorization: Bearer $SIGNNOW_ACCESS_TOKEN" \
  -H "Content-Type: application/json"
```

---
*Full reference: https://docs.signnow.com/docs/document-generation/operations/post-v2-document-generations-upload*
