Document Generation

Updates sender fields for an envelope

PUT
/v2.1/accounts/{accountId}/envelopes/{envelopeId}/docGenFormFields

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

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

Authorization

OAuth2
AuthorizationBearer <token>

OAuth 2.0 access token obtained via Authorization Code Grant or JWT Grant.

In: header

Path Parameters

accountId*string

The external account number (int) or account ID GUID.

envelopeId*string

The envelope's GUID.

Example: 93be49ab-xxxx-xxxx-xxxx-f752070d71ec

Query Parameters

update_docgen_formfields_only?string

When false or omitted, the documents are updated.

When true, only the form fields are updated. The documents are unchanged.

Request Body

application/json

This object maps the document generation fields to their values.

docGenFormFields?array<>

A list of docGenFormFields objects.

Response Body

application/json

application/json

curl -X PUT "https://example.com/v2.1/accounts/string/envelopes/string/docGenFormFields" \  -H "Content-Type: application/json" \  -d '{}'
{  "docGenFormFields": [    {      "docGenDocumentStatus": "string",      "docGenErrors": [        {          "errorCode": "string",          "message": "string",          "tagIdentifier": "string"        }      ],      "docGenFormFieldList": [        {          "connectedObjectDetails": {            "recordId": "string"          },          "defaultValue": "string",          "description": "string",          "filter": "string",          "format": {            "expression": "string",            "locale": "string"          },          "fullyQualifiedPath": "string",          "hidden": "string",          "label": "string",          "name": "string",          "options": [            {              "description": "string",              "label": "string",              "selected": "string",              "value": "string"            }          ],          "order": "string",          "predefinedValidation": "string",          "readOnly": "string",          "required": "string",          "rowValues": [            {              "docGenFormFieldList": [                {}              ]            }          ],          "type": "string",          "validation": {            "errorMessage": "string",            "expression": "string"          },          "value": "string"        }      ],      "documentId": "string"    }  ],  "errorDetails": {    "errorCode": "string",    "message": "string"  }}

Returns sender fields for an envelope GET

Given an `envelopeId`, this method returns the sender fields found in that envelope's documents. After you retrieve the sender fields, use the [DocumentGeneration::updateEnvelopeDocGenFormFields](https://developers.docusign.com/docs/esign-rest-api/reference/envelopes/documentgeneration/updateenvelopedocgenformfields/) method to populate the fields. If the specified envelope does not contain a document with sender fields, the method will return success (`200`) and an empty object (`{}`) in the response. ### Next steps - [Learn about document generation in the eSignature concepts guide.](https://developers.docusign.com/docs/esign-rest-api/esign101/concepts/documents/document-generation/) - [Learn how to send an envelope with document generation in your preferred coding language](https://developers.docusign.com/docs/esign-rest-api/how-to/request-signature-email-document-generation/).

Creates a user authorization POST

Creates an authorization allowing one user to send and/or manage envelopes on behalf of another user. The _agent_ user acts on behalf of the _principal_ user. The principal user is specified by the `userId` path parameter. The agent user is specified in the request body. Each principal user can only share signing permission with one agent user. Specify in the request the level of access to share with the agent user. If you share signing access, the agent user will receive an email notification. To call this endpoint: * You must be an account administrator or you must be the principal user. * The agent user and principal user must belong to the same account. * At least one of the following account settings must be enabled: `AllowDelegatedSigning`, `AllowManagingEnvelopesOnBehalfOfOthers`, `AllowEditingEnvelopesOnBehalfOfOthers`, `AllowSendingEnvelopesOnBehalfOfOthers`. These settings correspond to the level of access you can set for the authorization.