---
updatedAt: 2026-10-16T17:13:06.000Z
agentTools:
  projectIndex: https://developer.intellistack.com/llms.txt
---

# Document Step

Generates dynamic documents from DOCX templates or prepares static PDFs. Use this step to define workflow-populated fields, participants, and signing fields without collecting signatures.

The Document step produces a document that later workflow steps can use. Streamline supports two document modes:

* **Dynamic documents** use an uploaded DOCX template whose fields are embedded in the document. Streamline discovers those fields and replaces them with workflow data when it generates the document.
* **Static documents** use an uploaded PDF whose original content stays fixed. Streamline overlays mapped workflow data, signer input fields, and signature fields at fixed positions on its pages.

For documents that will be signed, the Document step defines everything shown to the signer:

* The template and generated document.
* Participants, which act as document slots for signers or reviewers.
* Input, checkbox, signature, initials, date-signed, and other fields assigned to signer participants.

The Document step defines participants and fields, but it does not run the signing process. A following Sign step references this Document step and assigns a recipient and contact details to each participant by reusing the participant's UUID.

The examples in the main guide show the workflow step's `config` value. The ready-to-use example at the bottom includes the complete step object.

## Generate documents and embed data

### Dynamic documents (DOCX)

Add text field tags to the DOCX where mapped values should appear. For an API-created document, include the source mapping in the tag's `value`:

```text
{{"fieldType":"FORM_FIELD","label":"Customer name","value":"{{`Customer details`.`323e4567-e89b-42d3-a456-426614174002`}}"}}
```

The mapping uses the source step's exact `description` and the actual UUID of the source field.

After adding the tags, [upload the DOCX](#upload-the-document-template). Set `type` to `DYNAMIC` and `format` to `DOCX`, then create the Document step with an empty `fields` array:

**ID note:** Generate `templates[].id` as a UUID. Use the `fileId` returned after uploading the DOCX as `templates[].fileId`.

```json
{
  "name": "Generated service agreement",
  "type": "DYNAMIC",
  "format": "DOCX",
  "templates": [
    {
      "id": "123e4567-e89b-42d3-a456-426614174000",
      "name": "Service agreement",
      "fileId": "223e4567-e89b-42d3-a456-426614174001",
      "fields": []
    }
  ]
}
```

For an API-created dynamic document, include the mapping in the original text field tag before uploading the DOCX. Keep `templates[].fields` empty in the request.

### Static documents (PDFs)

[Upload the PDF](#upload-the-document-template), set `type` to `STATIC`, and omit `format`. The PDF content stays fixed. Position fields over the PDF to display mapped data at specific page coordinates:

**ID note:** Generate `templates[].id` as a UUID. Use the `fileId` returned after uploading the PDF as `templates[].fileId`.

```json
{
  "name": "Static customer summary",
  "type": "STATIC",
  "templates": [
    {
      "id": "823e4567-e89b-42d3-a456-426614174007",
      "name": "Customer summary",
      "fileId": "923e4567-e89b-42d3-a456-426614174008",
      "fields": [
        {
          "id": "customer-name",
          "fieldSubtype": "TEXT",
          "wrapText": false,
          "required": false,
          "xPosition": 10,
          "yPosition": 18,
          "pageNumber": 1,
          "width": 40,
          "height": 4,
          "fieldType": "FORM_FIELD",
          "value": "{{`Customer details`.`323e4567-e89b-42d3-a456-426614174002`}}"
        }
      ]
    }
  ]
}
```

For a static PDF, setting a field's `value` to a template expression creates the field mapping when the Document step is saved.

PDF field geometry uses percentages of the selected page, not pixels or PDF points. `xPosition` and `yPosition` locate the field from the page's top-left corner. `width` and `height` are also percentages. Keep all four values between `0` and `100`, and ensure the position plus the size remains within the page. `pageNumber` is 1-based.

## Add conditional content and fields

Conditional configuration through the API is supported only for static PDFs.

### Static PDF: show or hide overlay fields

A static PDF cannot add or remove its original content. Instead, use the top-level `rules` array to show or hide positioned overlay fields:

1. Add the overlay field to `templates[].fields` and give it a unique `id`.
2. Add a rule with one or more condition groups.
3. Set each condition's `variableValue` to mapped workflow data and `value` to the value you want to compare against.
4. Add the overlay field's ID to `targets` and choose `SHOW` or `HIDE`.

This static PDF example shows `approval-message` only when the mapped approval status equals `approved`:

```json
{
  "name": "Conditional approval notice",
  "type": "STATIC",
  "templates": [
    {
      "id": "e23e4567-e89b-42d3-a456-426614174020",
      "name": "Approval notice",
      "fileId": "f23e4567-e89b-42d3-a456-426614174021",
      "fields": [
        {
          "id": "approval-message",
          "fieldSubtype": "TEXT",
          "wrapText": true,
          "required": false,
          "xPosition": 10,
          "yPosition": 30,
          "pageNumber": 1,
          "width": 45,
          "height": 6,
          "fieldType": "FORM_FIELD",
          "value": "Approved"
        }
      ]
    }
  ],
  "rules": [
    {
      "id": "123e4567-e89b-42d3-a456-426614174022",
      "label": "Show approval message",
      "groupsOperator": "AND",
      "conditionGroups": [
        {
          "id": "223e4567-e89b-42d3-a456-426614174023",
          "conditionsOperator": "ALL",
          "conditions": [
            {
              "id": "323e4567-e89b-42d3-a456-426614174024",
              "operator": "eq",
              "value": "approved",
              "variableValue": "{{`Approval`.`423e4567-e89b-42d3-a456-426614174025`}}"
            }
          ]
        }
      ],
      "targets": [
        {
          "action": "SHOW",
          "fieldId": "approval-message"
        }
      ]
    }
  ]
}
```

Within a rule, `conditionsOperator` controls whether all (`ALL`) or any (`ANY`) conditions in a group must match. `groupsOperator` combines multiple condition groups with `AND` or `OR`. A `SHOW` target appears when the rule matches; a `HIDE` target is removed when the rule matches.

## Configure participants and signing fields

Dynamic DOCX and static PDF documents use the same participant model. A participant is a slot in the document that a recipient from the Sign step will fill. Add one participant for each signer or reviewer, and set its `role` to `SIGNER` or `REVIEWER`. Generate a UUID for each participant and set it as `participants[].id`.

Signer participants can have input, checkbox, signature, initials, date-signed, and other signing fields. Assign each field to a signer participant by setting `participant` to that participant's generated UUID. Reviewer participants represent review-only slots.

The following Sign step references this Document step for the generated document, field definitions, and participants. It reuses each participant UUID when adding the recipient and contact details.

### Dynamic DOCX signing fields

Add signing field tags to the DOCX before uploading it:

```text
{{"fieldType":"SIGNATURE","participant":"623e4567-e89b-42d3-a456-426614174005","required":true}}
```

In the editor, the tag becomes a draggable signing field placeholder assigned to the participant.

**ID note:** Generate `participants[].id` as a UUID and use the same UUID in each assigned field's `participant` property and in the Sign step.

```json
{
  "name": "Agreement ready for signature",
  "type": "DYNAMIC",
  "format": "DOCX",
  "templates": [
    {
      "id": "423e4567-e89b-42d3-a456-426614174003",
      "name": "Agreement",
      "fileId": "523e4567-e89b-42d3-a456-426614174004",
      "fields": []
    }
  ],
  "participants": [
    {
      "id": "623e4567-e89b-42d3-a456-426614174005",
      "name": "Customer signer",
      "role": "SIGNER"
    }
  ]
}
```

### Static PDF signing fields

Position each signing field over the PDF and assign it to a participant:

**ID note:** Generate `participants[].id` as a UUID and use the same UUID in each assigned field's `participant` property and in the Sign step.

```json
{
  "name": "Static consent form",
  "type": "STATIC",
  "templates": [
    {
      "id": "b23e4567-e89b-42d3-a456-426614174010",
      "name": "Consent form",
      "fileId": "c23e4567-e89b-42d3-a456-426614174011",
      "fields": [
        {
          "id": "consent-signature",
          "fieldSubtype": "TEXT",
          "wrapText": false,
          "required": true,
          "xPosition": 10,
          "yPosition": 70,
          "pageNumber": 1,
          "width": 35,
          "height": 8,
          "fieldType": "SIGNATURE",
          "participant": "d23e4567-e89b-42d3-a456-426614174012"
        }
      ]
    }
  ],
  "participants": [
    {
      "id": "d23e4567-e89b-42d3-a456-426614174012",
      "name": "Customer signer",
      "role": "SIGNER"
    }
  ]
}
```

## Upload the document template

Before creating the Document step, create a file record:

```bash
curl --request POST \
  --url https://api-us.streamline.intellistack.ai/v1/files \
  --header "Authorization: Bearer $ACCESS_TOKEN" \
  --header "Content-Type: application/json" \
  --data '{
    "fileName": "agreement.docx",
    "storageLifecycle": "NO_EXPIRATION",
    "readAccess": "AUTHENTICATED"
  }'
```

The response contains `fileId` and `uploadUrl`. Upload the file bytes to the temporary URL:

```bash
curl --request PUT \
  --upload-file ./agreement.docx \
  "$UPLOAD_URL"
```

Before creating the Document step, fetch `GET /v1/files/{fileId}` and wait until the file's `status` is `READY`.

Use the returned `fileId` as `templates[].fileId` when creating the Document step. The caller must generate a separate UUID for `templates[].id`; the file upload does not assign that ID. For a PDF, replace the example DOCX filename and path with the PDF.

## Limitations and common errors

* **The uploaded template cannot be found.** Complete the `PUT` request to the returned `uploadUrl`, then use the upload response's `fileId` as `templates[].fileId`. Do not use the `uploadUrl` or the caller-generated template UUID as the file ID.
* **A field does not appear on a dynamic document.** Add its text field tag to the DOCX before uploading the template. For the initial Document step request, use an empty `fields` array.
* **A mapped value is empty on a dynamic DOCX.** Include the source expression in the original text field tag's `value` before uploading the DOCX. If the uploaded template omitted the value, correct and upload the DOCX again, then recreate the Document step.
* **A copied dynamic DOCX refers to an earlier workflow.** Upload the original source DOCX again instead of reusing a file ID from another Document step.
* **A mapped value is empty on a static PDF.** Confirm that the source step description and field UUID in the field's `value` expression match the workflow exactly.
* **A field appears in the wrong place on a static PDF.** Check its `pageNumber`, `xPosition`, `yPosition`, `width`, and `height`. Geometry is expressed as percentages from the page's top-left corner, not pixels or points.
* **A signing field is missing or assigned to the wrong person.** Its `participant` value must match a signer participant's generated UUID. Reuse that participant UUID when assigning the recipient in the Sign step.
* **The document type does not match the file.** Use `DYNAMIC` with DOCX and `STATIC` with PDF. Set `format: "DOCX"` only for dynamic documents.
* **The request rejects an ID.** Generate valid UUIDs for `templates[].id` and `participants[].id`. The uploaded `fileId` is a different identifier.
* **A value is rejected because of capitalization.** Values such as `DYNAMIC`, `STATIC`, `SIGNER`, `REVIEWER`, `FORM_FIELD`, and `SIGNATURE` must be uppercase.

## Property reference

### Top-level properties

| Name           | Type   | Required | Description                                                 |
| -------------- | ------ | -------- | ----------------------------------------------------------- |
| `name`         | string | yes      | Display name for the generated document                     |
| `type`         | string | yes      | `DYNAMIC` for DOCX or `STATIC` for PDF                      |
| `format`       | string | no       | Set to `DOCX` for dynamic documents; omit for static PDFs   |
| `templates`    | array  | yes      | One or more uploaded DOCX or PDF templates                  |
| `participants` | array  | no       | Document slots that the Sign step connects to recipients    |
| `rules`        | array  | no       | Conditional visibility rules for fields on static PDFs only |

### Participant

| Name   | Type   | Required | Description                                              |
| ------ | ------ | -------- | -------------------------------------------------------- |
| `id`   | string | yes      | UUID generated by the caller and reused by the Sign step |
| `name` | string | yes      | Participant label                                        |
| `role` | string | no       | `SIGNER` or `REVIEWER`; defaults to `SIGNER`             |

### Template

| Name     | Type   | Required | Description                                        |
| -------- | ------ | -------- | -------------------------------------------------- |
| `id`     | string | yes      | UUID generated by the caller                       |
| `name`   | string | yes      | Template display name                              |
| `fileId` | string | yes      | File ID returned when the template was uploaded    |
| `fields` | array  | yes      | Positioned fields for a static PDF; empty for DOCX |

### Field

These properties apply to positioned fields on static PDFs. Dynamic DOCX fields come from tags in the uploaded template.

| name           | type    | required    | constraints                                                                                                           |                                            |
| -------------- | ------- | ----------- | --------------------------------------------------------------------------------------------------------------------- | ------------------------------------------ |
| `id`           | string  | yes         | Field id for reference                                                                                                |                                            |
| `fieldSubtype` | string  | no          | `TEXT`, `CHECKBOX`, `RADIO`, or `FILE_UPLOAD`                                                                         | Visual type of the positioned field        |
| `participant`  | string  | conditional | Required for signature-related field types                                                                            | Participant UUID assigned to the field     |
| `label`        | string  | no          |                                                                                                                       | Display label for the field                |
| `wrapText`     | boolean | no          | default: `false`                                                                                                      | Whether text wraps within the bounding box |
| `required`     | boolean | no          | default: `false`                                                                                                      | Whether a value must be supplied           |
| `xPosition`    | number  | yes         | PDF position from the left edge as a percentage of the page                                                           |                                            |
| `yPosition`    | number  | yes         | PDF position from the top edge as a percentage of the page                                                            |                                            |
| `pageNumber`   | number  | yes         | PDF page number, starting at 1                                                                                        |                                            |
| `width`        | number  | yes         | PDF field width as a percentage of the page                                                                           |                                            |
| `height`       | number  | yes         | PDF field height as a percentage of the page; use at least `8` for signatures                                         |                                            |
| `fontSize`     | number  | no          | Font size for text fields                                                                                             |                                            |
| `value`        | string  | no          | Static or mapped value for a PDF overlay field; for a DOCX mapping, include this value in the original text field tag |                                            |
| `fieldType`    | string  | yes         | Field behavior, such as `FORM_FIELD`, `SIGNATURE`, `INITIALS`, `FULL_NAME`, or `DATE_SIGNED`                          |                                            |

### Rule

Conditional visibility rules show or hide fields based on data from previous workflow steps.

| name              | type   | required | constraints                                        |
| ----------------- | ------ | -------- | -------------------------------------------------- |
| `id`              | string | yes      | UUID                                               |
| `label`           | string | yes      | Human-friendly name of the rule                    |
| `groupsOperator`  | string | yes      | `AND` or `OR` across groups                        |
| `conditionGroups` | array  | yes      | Conditions that determine whether the rule matches |
| `targets`         | array  | yes      | Fields to show or hide                             |

### Condition Group

| name                 | type   | required | constraints                        |
| -------------------- | ------ | -------- | ---------------------------------- |
| `id`                 | string | yes      | UUID                               |
| `conditionsOperator` | string | yes      | `ALL` or `ANY` within the group    |
| `conditions`         | array  | yes      | Values and comparisons to evaluate |

### Condition Item

| name            | type             | required | constraints                                      |
| --------------- | ---------------- | -------- | ------------------------------------------------ |
| `id`            | string           | yes      | UUID                                             |
| `operator`      | string           | yes      | Comparison, such as `eq`, `contains`, or `empty` |
| `value`         | string \| number | yes      | Value to compare against                         |
| `variableValue` | string \| number | yes      | Fixed value or workflow-data mapping             |

### Rule Target

| name      | type   | required | constraints                     |
| --------- | ------ | -------- | ------------------------------- |
| `action`  | string | yes      | `SHOW` or `HIDE`                |
| `fieldId` | string | yes      | ID of the field to show or hide |

## Ready-to-use workflow step

This complete step is the first of the matching Document, Collaboration, and Sign examples. Add these text field tags to the DOCX before uploading it:

```text
{{"fieldType":"FULL_NAME","participant":"623e4567-e89b-42d3-a456-426614174005","required":true}}
{{"fieldType":"SIGNATURE","participant":"623e4567-e89b-42d3-a456-426614174005","required":true}}
{{"fieldType":"FULL_NAME","participant":"823e4567-e89b-42d3-a456-426614174007","required":true}}
{{"fieldType":"SIGNATURE","participant":"823e4567-e89b-42d3-a456-426614174007","required":true}}
```

Then add this object to `workflow.steps`:

```json
{
  "description": "Generate agreement",
  "type": "document",
  "config": {
    "name": "Agreement",
    "type": "DYNAMIC",
    "format": "DOCX",
    "templates": [
      {
        "id": "123e4567-e89b-42d3-a456-426614174000",
        "name": "Agreement",
        "fileId": "223e4567-e89b-42d3-a456-426614174001",
        "fields": []
      }
    ],
    "participants": [
      {
        "id": "623e4567-e89b-42d3-a456-426614174005",
        "name": "Contract owner",
        "role": "SIGNER"
      },
      {
        "id": "823e4567-e89b-42d3-a456-426614174007",
        "name": "Customer signer",
        "role": "SIGNER"
      }
    ]
  },
  "edges": []
}
```

Replace the template `fileId` with the ID returned when you upload the DOCX. Generate new template and participant UUIDs, and update the participant UUIDs in both the DOCX tags and the matching Sign example.