> You are reading the Docusign Developer Documentation. For clean Markdown of any page, append .md to the page URL.
>
> Documentation indexes by section:
> - APIs and SDKs: https://docusign.docs.buildwithfern.com/docs/llms.txt
> - Platform 101: https://docusign.docs.buildwithfern.com/platform/llms.txt
> - Extension Apps: https://docusign.docs.buildwithfern.com/extension-apps/llms.txt
> - Docusign CLI: https://docusign.docs.buildwithfern.com/docusign-cli/llms.txt
>
> Authentication (OAuth, JWT Grant, M2M): https://docusign.docs.buildwithfern.com/platform/auth
> Webhooks and Connect: https://docusign.docs.buildwithfern.com/platform/webhooks
>
> OpenAPI specifications: https://docusign.docs.buildwithfern.com/openapi.json
> MCP server: https://docusign.docs.buildwithfern.com/_mcp/server

# Update sender fields for envelope

PUT https://demo.docusign.net/restapi/v2.1/accounts/{accountId}/envelopes/{envelopeId}/docGenFormFields
Content-Type: application/json

This method dynamically generates an envelope's documents by populating its sender fields. The envelope must be in a draft state.

Use the [DocumentGeneration::getEnvelopeDocGenFormFields](/docs/esign-rest-api/reference/envelopes/documentgeneration/getenvelopedocgenformfields/) response to retrieve the list of sender fields for your envelope. Use that list to build the request for this method. For each field, specify the field name and the value to populate.

For example, your request body might look like this:

```json
{
  "docGenFormFields": [
    {
      "documentId": "bf3202e1-xxxx-xxxx-xxxx-af4f41366879",
      "docGenFormFieldList": [
        {
          "name": "Candidate_Name",
          "value": "Peggy Olson"
        },
        {
          "name": "Job_Title",
          "value": "Technical Writer"
        },
        {
          "name": "Manager_Name",
          "value": "Donald Draper"
        },
        {
          "name": "Start_Date",
          "value": "1960-02-28"
        },
        {
          "name": "Salary",
          "value": "3380"
        }
      ]
    }
  ]
}
```

### Important notes

* If `update_docgen_formfields_only` is false (the default), the `documentId` changes after the update.
* This endpoint does not validate number, date, or select data field values. The request can succeed even if a number or date field value is not a valid number or date, or if a select field value is not one of the allowed values.

### Related topics

* [Learn about document generation in the eSignature concepts guide.](/docs/esign-rest-api/esign101/concepts/documents/document-generation/)
* [See this method in use in your preferred coding language](/docs/esign-rest-api/how-to/request-signature-email-document-generation/).

Reference: https://developers.docusign.com/docs/esign-rest-api/reference/envelopes/documentgeneration/updateenvelopedocgenformfields

## Authentication

- `Authorization` header (required) (prefixed with ` Bearer  `) — OAuth 2.0 access token (JWT or auth-code grant). Sent as `Authorization: Bearer <token>` on every request except `GET /v2.1` and `GET /service_information`, which are public discovery endpoints.

## Servers

- `https://demo.docusign.net/restapi` (Demo, default)
- `https://www.docusign.net/restapi` (Production)

## Request

### Path parameters

- `accountId` (string, required) — The external account number (int) or account ID Guid.
- `envelopeId` (string, required) — The envelope's GUID. Example: `93be49ab-xxxx-xxxx-xxxx-f752070d71ec`

### Query parameters

- `update_docgen_formfields_only` (string, optional) — When **false** or omitted, the documents are updated. When **true,** only the form fields are updated. The documents are unchanged. This option is used by integrators to save form field values without merging.

### Body (application/json)

This endpoint expects a docGenFormFieldRequest.

- `docGenFormFields` (list of docGenFormFields, optional) — A list of `docGenFormFields` objects.

## Response

### 200

Successful response.

- `docGenFormFields` (list of docGenFormFields, optional) — A list of `docGenFormFields` objects.
- `errorDetails` (errorDetails, optional) — This object describes errors that occur. It is only valid for responses, and ignored in requests.

## Errors

### 400 Bad Request Error

Error encountered.

- `errorCode` (string, optional) — The code associated with the error condition.
- `message` (string, optional) — A brief message describing the error condition.

## Types

### docGenFormFields

A collection of document generation fields.

- `docGenConditionalRules` (list of docGenConditionalRule, optional)
- `docGenDocumentStatus` (string, optional) — The status of the document. This is a read-only property, and not used in [updateEnvelopeDocGenFormFields](/docs/esign-rest-api/reference/envelopes/documentgeneration/updateenvelopedocgenformfields/). Valid values: - `mergesucceeded` - `created` - `hassyntaxerror`
- `docGenErrors` (list of docGenSyntaxError, optional) — A list of `docGenSyntaxError` objects.
- `docGenFormFieldList` (list of docGenFormField, optional) — A list of `docGenFormField` objects.
- `documentId` (string, optional) — The GUID of the document.

### errorDetails

This object describes errors that occur. It is only valid for responses, and ignored in requests.

- `errorCode` (string, optional) — The code associated with the error condition.
- `message` (string, optional) — A brief message describing the error condition.

### docGenConditionalRule

- `conditionalOperations` (list of docGenConditionalOperationBase, optional)
- `conditionalRuleEffect` (string, optional)
- `conditionalRuleEffectFields` (list of string, optional)
- `conditionalRuleOperator` (string, optional)

### docGenSyntaxError

Describes document generation errors.

- `errorCode` (string, optional) — A code associated with the error condition.
- `message` (string, optional) — The error message.
- `tagIdentifier` (string, optional) — The tag that caused the syntax error. See [Document Generation Syntax](https://support.docusign.com/s/document-item?bundleId=als1679428547895&topicId=ftc1679700030026.html) to learn more about document generation syntax rules.

### docGenFormField

The document fields available for document generation. This object is used in reponses (GET) and requests (PUT). When used with [DocumentGeneration: updateEnvelopeDocGenFormFields](/docs/esign-rest-api/reference/envelopes/documentgeneration/updateenvelopedocgenformfields/) (PUT), the `name` and `value` / `rowValues` properties are required and any other values are ignored.

- `children` (list of docGenFormField, optional)
- `connectedObjectDetails` (connectedObjectDetails, optional)
- `defaultValue` (string, optional)
- `description` (string, optional) — A description of the field. Displayed with the label.
- `filter` (DocGenFormFieldFilter, optional)
- `format` (docGenFormat, optional)
- `fullyQualifiedPath` (string, optional) — Reserved for Docusign use. This value is returned in the `getEnvelopeDocGenFormFields` response but should not be included in `updateEnvelopeDocGenFormFields` requests.
- `hidden` (boolean, optional)
- `label` (string, optional) — A label displayed near the field.
- `name` (string, optional) — The name of the sender field. Required for PUT requests.
- `options` (list of docGenFormFieldOption, optional) — When `type` is `Select`, this array describes the available options.
- `order` (string, optional) — Not currently used.
- `predefinedValidation` (string, optional) — Reserved for Docusign.
- `readOnly` (boolean, optional)
- `required` (string, optional) — When **true,** the field is required.
- `rowValues` (list of docGenFormFieldRowValue, optional) — For fields of type `TableRow`, this property represents the sender fields in the row. For GET requests, this array contains a single `docGenFormFieldRowValue` object. That object contains a list of sender fields that will appear in each row. For PUT requests, you must supply a `docGenFormFieldRowValue` object for each row in the table. This populates the data in the table.
- `type` (string, optional) — The kind of data the sender field holds. Valid values: - `TextBox` - `Date` - `Number` - `Select` - `TableRow`
- `validation` (docGenFormFieldValidation, optional) — Describes how values are validated.
- `value` (string, optional) — The value of the sender field. For PUT requests, you must supply either this property (for all fields except `TableRow` types) or `rowValues` (for `TableRow` fields).

### docGenConditionalOperationBase

### connectedObjectDetails

- `recordId` (string, optional)

### DocGenFormFieldFilter

### docGenFormat

- `expression` (string, optional)
- `locale` (string, optional)

### docGenFormFieldOption

Specifies an individual option setting when type is `Select`.

- `description` (string, optional) — Description of the selectable option.
- `label` (string, optional) — The label for the selectable option.
- `selected` (string, optional) — When **true,** the option is selected.
- `value` (string, optional) — Specifies the value of the option. This is the value of the form field when this option is selected.

### docGenFormFieldRowValue

An object representing a row of a dynamic table.

- `docGenFormFieldList` (list of docGenFormField, optional) — The sender fields in each row of the table. For GET requests, the `label`, `type`, `required`, and `name` properties will be returned. For POST requests, supply the `name` and `value` for each child object. These correspond to the values in each column.

### docGenFormFieldValidation

Describes how values are validated.

- `errorMessage` (string, optional) — The error message when validation fails.
- `expression` (string, optional) — The expression used to validate values.

## Examples

**Request**

```json
{
  "docGenFormFields": [
    {
      "docGenConditionalRules": [
        {
          "conditionalOperations": [
            {}
          ],
          "conditionalRuleEffect": "sample string 1",
          "conditionalRuleEffectFields": [
            "sample string 1"
          ],
          "conditionalRuleOperator": "sample string 2"
        }
      ],
      "docGenDocumentStatus": "sample string 1",
      "docGenErrors": [
        {
          "errorCode": "sample string 1",
          "message": "sample string 2",
          "tagIdentifier": "sample string 3"
        }
      ],
      "docGenFormFieldList": [
        {
          "children": [
            {}
          ],
          "connectedObjectDetails": {
            "recordId": "sample string 1"
          },
          "defaultValue": "sample string 1",
          "description": "sample string 2",
          "format": {
            "expression": "sample string 1",
            "locale": "sample string 2"
          },
          "fullyQualifiedPath": "sample string 3",
          "hidden": true,
          "label": "sample string 4",
          "name": "sample string 5",
          "options": [
            {
              "description": "sample string 1",
              "label": "sample string 2",
              "selected": "sample string 3",
              "value": "sample string 4"
            }
          ],
          "order": "sample string 6",
          "predefinedValidation": "sample string 7",
          "readOnly": true,
          "required": "sample string 8",
          "rowValues": [
            {
              "docGenFormFieldList": [
                {}
              ]
            }
          ],
          "type": "sample string 9",
          "validation": {
            "errorMessage": "sample string 1",
            "expression": "sample string 2"
          },
          "value": "sample string 10"
        }
      ],
      "documentId": "sample string 2"
    }
  ]
}
```

**Response**

```json
{
  "docGenFormFields": [
    {
      "docGenConditionalRules": [
        {
          "conditionalOperations": [
            {}
          ],
          "conditionalRuleEffect": "sample string 1",
          "conditionalRuleEffectFields": [
            "sample string 1"
          ],
          "conditionalRuleOperator": "sample string 2"
        }
      ],
      "docGenDocumentStatus": "sample string 1",
      "docGenErrors": [
        {
          "errorCode": "sample string 1",
          "message": "sample string 2",
          "tagIdentifier": "sample string 3"
        }
      ],
      "docGenFormFieldList": [
        {
          "children": [
            {}
          ],
          "connectedObjectDetails": {
            "recordId": "sample string 1"
          },
          "defaultValue": "sample string 1",
          "description": "sample string 2",
          "format": {
            "expression": "sample string 1",
            "locale": "sample string 2"
          },
          "fullyQualifiedPath": "sample string 3",
          "hidden": true,
          "label": "sample string 4",
          "name": "sample string 5",
          "options": [
            {
              "description": "sample string 1",
              "label": "sample string 2",
              "selected": "sample string 3",
              "value": "sample string 4"
            }
          ],
          "order": "sample string 6",
          "predefinedValidation": "sample string 7",
          "readOnly": true,
          "required": "sample string 8",
          "rowValues": [
            {
              "docGenFormFieldList": [
                {}
              ]
            }
          ],
          "type": "sample string 9",
          "validation": {
            "errorMessage": "sample string 1",
            "expression": "sample string 2"
          },
          "value": "sample string 10"
        }
      ],
      "documentId": "sample string 2"
    }
  ],
  "errorDetails": {
    "errorCode": "sample string 1",
    "message": "sample string 2"
  }
}
```