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:

{{"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. 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.

{
  "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, 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.

{
  "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:

{
  "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:

{{"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.

{
  "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.

{
  "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:

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:

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

NameTypeRequiredDescription
namestringyesDisplay name for the generated document
typestringyesDYNAMIC for DOCX or STATIC for PDF
formatstringnoSet to DOCX for dynamic documents; omit for static PDFs
templatesarrayyesOne or more uploaded DOCX or PDF templates
participantsarraynoDocument slots that the Sign step connects to recipients
rulesarraynoConditional visibility rules for fields on static PDFs only

Participant

NameTypeRequiredDescription
idstringyesUUID generated by the caller and reused by the Sign step
namestringyesParticipant label
rolestringnoSIGNER or REVIEWER; defaults to SIGNER

Template

NameTypeRequiredDescription
idstringyesUUID generated by the caller
namestringyesTemplate display name
fileIdstringyesFile ID returned when the template was uploaded
fieldsarrayyesPositioned 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.

nametyperequiredconstraints
idstringyesField id for reference
fieldSubtypestringnoTEXT, CHECKBOX, RADIO, or FILE_UPLOADVisual type of the positioned field
participantstringconditionalRequired for signature-related field typesParticipant UUID assigned to the field
labelstringnoDisplay label for the field
wrapTextbooleannodefault: falseWhether text wraps within the bounding box
requiredbooleannodefault: falseWhether a value must be supplied
xPositionnumberyesPDF position from the left edge as a percentage of the page
yPositionnumberyesPDF position from the top edge as a percentage of the page
pageNumbernumberyesPDF page number, starting at 1
widthnumberyesPDF field width as a percentage of the page
heightnumberyesPDF field height as a percentage of the page; use at least 8 for signatures
fontSizenumbernoFont size for text fields
valuestringnoStatic or mapped value for a PDF overlay field; for a DOCX mapping, include this value in the original text field tag
fieldTypestringyesField 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.

nametyperequiredconstraints
idstringyesUUID
labelstringyesHuman-friendly name of the rule
groupsOperatorstringyesAND or OR across groups
conditionGroupsarrayyesConditions that determine whether the rule matches
targetsarrayyesFields to show or hide

Condition Group

nametyperequiredconstraints
idstringyesUUID
conditionsOperatorstringyesALL or ANY within the group
conditionsarrayyesValues and comparisons to evaluate

Condition Item

nametyperequiredconstraints
idstringyesUUID
operatorstringyesComparison, such as eq, contains, or empty
valuestring | numberyesValue to compare against
variableValuestring | numberyesFixed value or workflow-data mapping

Rule Target

nametyperequiredconstraints
actionstringyesSHOW or HIDE
fieldIdstringyesID 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:

{{"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:

{
  "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.


Did this page help you?