# GeneratedDocument

Output type describing a document produced by a sync doc-gen or merge call.

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

This custom Apex type represents an output document. It is returned by both Client.mergeDocumentsSync() and Client.generateDocumentSync(), one entry per generated file.

## Fields

### Output fields
| Parameter | Type | Required | Description |
|---|---|---|---|
| name | String | optional | Name of the generated document. |
| downloadUrl | String | optional | URL to download the generated document. |
| contentVersionId | String | optional | Id of the Salesforce ContentVersion for the generated document, when stored as a Salesforce File. |
| file | <a href="#/apex-type-resource">Resource</a> | optional | The generated document as a Resource. |
| previewUrl | String | optional | URL to preview the generated document. |

## Constructors

```apex
global GeneratedDocument(String name, String downloadUrl, Resource file)
```

```apex
global GeneratedDocument(
  String name,
  String downloadUrl,
  String contentVersionId
)
```
