# Types.DocGenRequestInput

Input describing a document-generation request: template, merge variables, destination, and output type.

> Kind: Apex type · Updated: 2026-07-01

Represents the input for the Generate Document (Sync) and Generate Document methods. It carries the template to render, the merge variables, the Resource destination, the DocGenParams, and the output document type.

## Fields

### Fields
| Parameter | Type | Required | Description |
|---|---|---|---|
| templateId | String | required | Id of the template to render. |
| variables | Map&lt;String, String&gt; | required | Merge variables passed to the template as key/value pairs. |
| documentType | String | required | Output document type for the generated file. |
| destination | <a href="#/apex-type-resource">Resource</a> | required | The Resource that specifies where the generated document is stored. |
| params | <a href="#/apex-type-docgen-params">DocGenParams</a> | required | Additional generation parameters. See Types.DocGenParams. |
| cloudFilesVariables | List&lt;<a href="#/apex-type-cloudfiles-variable">CloudFilesVariable</a>&gt; | optional | Optional structured CloudFiles variables. Only populated via the overload that accepts them; not part of the constructor documented below. |

## Constructors

This custom type has a constructor that takes in the parameters in the order shown. Note the argument order differs from the field declaration order in the repo: the constructor takes documentType before destination, whereas the class declares destination before documentType.

```apex
global DocGenRequestInput(
      String templateId,
      Map<String, String> variables,
      String documentType,
      Resource destination,
      DocGenParams params
)
```

## Example

```apex
// For a more detailed example, see the example section in the
// Generate Document (Sync) article.
Types.DocGenRequestInput input = new Types.DocGenRequestInput(
  templateId,
  variables,
  documentType,
  destination,
  params
);
```
