> 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

# DocumentGeneration Resource

[Document generation](https://support.docusign.com/s/document-item?bundleId=als1679428547895\&topicId=ldx1679428689631.html) enables you
to create reusable templates
with professionally formatted documents
that include personalized data.
For example, you can create
a boilerplate employment offer letter
that is updated with job details
for each candidate from an HR system .

To learn more about using these endpoints
with the eSignature API,
see [Document generation](/docs/esign-rest-api/esign101/concepts/documents/document-generation)
in the eSignature concepts guide.

## Methods supported

| Method                                                                                                                             | Description                                                                                                                                                                                                              |
| ---------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| [createArchiveMetadataEnvelopes](/docs/esign-rest-api/reference/envelopes/documentgeneration/createarchivemetadataenvelopes)       | POST `/restapi/v2.1/accounts/{accountId}/envelopes/archive_metadata` Add metadata in the form of GenAndSend to existing envelopes in docusign.                                                                           |
| [createGenAndArchiveEnvelopes](/docs/esign-rest-api/reference/envelopes/documentgeneration/creategenandarchiveenvelopes)           | POST `/restapi/v2.1/accounts/{accountId}/envelopes/generate_and_archive` Generates the document using DocuSign Spring CM template then returns the html content of the document.                                         |
| [createGenAndConvertEnvelopes](/docs/esign-rest-api/reference/envelopes/documentgeneration/creategenandconvertenvelopes)           | POST `/restapi/v2.1/accounts/{accountId}/envelopes/generate_and_convert` Generates the document using DocuSign Spring CM template then returns the content of the document based on the return document type.            |
| [createGenAndConvertMultiEnvelopes](/docs/esign-rest-api/reference/envelopes/documentgeneration/creategenandconvertmultienvelopes) | POST `/restapi/v2.1/accounts/{accountId}/envelopes/generate_and_convert_multi` Generates multiple document using DocuSign Spring CM template then returns the content of the document based on the return document type. |
| [createGenAndSendEnvelopes](/docs/esign-rest-api/reference/envelopes/documentgeneration/creategenandsendenvelopes)                 | POST `/restapi/v2.1/accounts/{accountId}/envelopes/generate_and_send` Generates the documents for an envelope using DocuSign Spring CM then creates the envelope.                                                        |
| [createLinkMetadataEnvelopes](/docs/esign-rest-api/reference/envelopes/documentgeneration/createlinkmetadataenvelopes)             | POST `/restapi/v2.1/accounts/{accountId}/envelopes/{envelopeId}/archive_metadata` Add metadata in the form of GenAndSend to existing envelopes in docusign.                                                              |
| [getEnvelopeDocGenFormFields](/docs/esign-rest-api/reference/envelopes/documentgeneration/getenvelopedocgenformfields)             | GET `/restapi/v2.1/accounts/{accountId}/envelopes/{envelopeId}/docGenFormFields` Returns sender fields for an envelope.                                                                                                  |
| [updateEnvelopeDocGenFormFields](/docs/esign-rest-api/reference/envelopes/documentgeneration/updateenvelopedocgenformfields)       | PUT `/restapi/v2.1/accounts/{accountId}/envelopes/{envelopeId}/docGenFormFields` Updates sender fields for an envelope.                                                                                                  |

## DocumentGeneration properties

| Property           | Type         | Description                                                                                      |
| ------------------ | ------------ | ------------------------------------------------------------------------------------------------ |
| `docGenFormFields` | array        |                                                                                                  |
| `errorDetails`     | errorDetails | This object describes errors that occur. It is only valid for responses and ignored in requests. |