# Document Generate Async (https://developers.doctavian.com/openapi/latest/reference/Documents/operations-documents-document-generate-async)

## `POST /documents/document/generate/async`

**Document Generate Async**

Initiates the same file generation as `documents-document-generate` — specify a template, supply the data to populate it, and configure the output format, storage location, and delivery method — but asynchronously.

This endpoint returns HTTP `200` with an empty body as soon as the request is accepted and queued. That response only acknowledges receipt; it does not mean the document was generated, and it carries no document metadata.

**The result arrives at your callback URL, not in the response to this call.** Once generation finishes, Doctavian sends a `POST` to the URL formed by joining the `iss` and `dest` claims of the `X-Client-Authorization` token supplied on this request, authenticating itself through the external connector named by that token's `connector_id` claim. Your endpoint should return any success status to acknowledge receipt.

The callback body is the generation outcome, in one of two shapes. On success it is the `DocumentGenerateResponse` envelope — the identical shape the synchronous `documents-document-generate` operation returns as its success body, carrying `result.data.document` (the generated document's `deliveryMethod`, `name`, `fileFormat`, `urn`, and, for drive deliveries, `uri` and the sharing links) plus `consumption`. On failure it is the standard `ErrorResponse` error envelope, with the cause in `error.innerErrors[]` under the failure's own code: unlike the synchronous operation, no `GENERATE_FUNCTION_FAILED` entry is added after it. Both shapes carry the same `externalContext`, `origin`, `dateTime`, `userId`, and `operationId` metadata; `result` and `consumption` appear only on success, `error` only on failure. Correlate a callback back to the request that produced it through `externalContext`, which is echoed back unchanged from the request body.

A `400` from this endpoint means the request was rejected before being queued, so no callback follows it. Usage limits are checked once the request is processed, so a reached limit arrives at the callback as an `ErrorResponse` with `LIMIT_BREACH`, not as an HTTP `403` from this endpoint.

Use this endpoint instead of the synchronous variant when generation is expected to take long enough that you don't want the calling request to block, or when your integration is callback-driven.

### Parameters
- `X-Client-Authorization` (header, string) — This does not authenticate the async request itself — that's `Authorization`. It authenticates Doctavian's callback to your service once the async result is ready. Generate it by calling `POST /common/client/token` with the claims below inside a `clientToken` object. That endpoint signs and encrypts the payload for you and returns the ready-to-use token in `result.data.clientToken.token` — you never construct or sign this token yourself. Required claims: `connector_id` (the id of the external connector, a GUID, that Doctavian uses to authenticate to your service), `sub` (a placeholder kept for backward compatibility, whose value Doctavian does not use — copy the `connector_id` value into it), `iss` (base URL of the service receiving the callback), `dest` (the callback route, e.g. `/temp/callback` — combined with `iss` to form the full callback URL). Optional claims: `oid`,`client_id`,`full_name`, `email`, `locale`, `zoneinfo`. You don't need to set `iat` or `exp` — the token endpoint handles timing. `iss` and `dest` cannot resolve back to Doctavian's own API — that combination is rejected to prevent a callback loop. If this header is missing on an async request, the response is `400 X_CLIENT_AUTH_ERROR` ("header is missing for async operations").

### Request body (`application/json`)

- `externalContext` (object) — Optional, arbitrary JSON object supplied by the caller to correlate this request with an external system, process, or transaction (e.g. an order ID or a trace ID from your own system). Its shape isn't validated or interpreted by Doctavian — any JSON object is accepted — and the same object is returned unchanged as `externalContext` in the response envelope, so you can match a response back to the request that produced it. Omit it if you don't need this correlation.
- `template` (object) **required** — The template used to generate the final document. Locating the template file requires either `url` alone, or `urn` together with `loadMethod` — supplying neither pair means the template can't be resolved and the request fails with a 400 response.
  - `name` (string) — Optional label for this template. Only meaningful when this template object is placed inside `relatedItems`: it must then match the reference name used by an Include directive inside the primary template's content, so the merge engine knows which related file to pull in. Has no effect on the top-level template being generated.
  - `urn` (string) — Identifier of the template in the storage selected by `loadMethod` — a Storage key, a OneDrive file ID, or a Google Drive file ID, depending on which `loadMethod` is set. Mandatory together with `loadMethod` when `url` is not supplied; if both `urn`+`loadMethod` and `url` are omitted, the template can't be located and the request fails with a 400 `TEMPLATE_NOT_FOUND` response. If the urn doesn't resolve to an existing file for the given `loadMethod`, the request also fails with a 400 `TEMPLATE_NOT_FOUND` response.
  - `fileFormat` (any) **required** — Mandatory. The template's file format, without a leading dot. Must be consistent with `loadMethod`: `gdoc`, `gsheet`, and `gslide` are Google Workspace formats and are only usable when `loadMethod` is `GoogleDrive`; `docx`, `xlsx`, `xlsm`, and `pptx` are Microsoft formats and are only usable when `loadMethod` is `Storage` or `OneDrive`.
  - `loadMethod` (any) — Where the template file identified by `urn` is stored: Doctavian's internal Storage, or a connected OneDrive or Google Drive. Mandatory together with `urn` when `url` is not supplied. When `OneDrive` or `GoogleDrive` is used, the file must be accessible to the drive account associated with the request's Auth token, or the request fails.
  - `options` (object) — Load options for the template file, passed through to the rendering engine that opens it. Only the property matching the template's `fileFormat` is read (`docxLoadOptions` for `docx`, `xlsxLoadOptions` for `xlsx`, `pptxLoadOptions` for `pptx`). An `xlsm` template has no load options, and neither do the Google formats (`gdoc`, `gsheet`, `gslide`), which are rendered by Google instead. Entirely optional.
    - `docxLoadOptions` (string) _(default: "{ \"PreserveUnsupportedFeatures\": true }")_ — JSON-serialized Word load options, as a string (not a nested JSON object). Only used when the template's `fileFormat` is `docx`. If omitted, defaults to `{"PreserveUnsupportedFeatures": true}`, so content the renderer does not natively support is preserved rather than stripped when the template is loaded. See more: [DocxLoadOptions](https://www.gemboxsoftware.com/document/docs/GemBox.Document.DocxLoadOptions.html).
    - `xlsxLoadOptions` (string) — JSON-serialized Excel load options, as a string (not a nested JSON object). Only used when the template's `fileFormat` is `xlsx`. Optional; if omitted, the renderer's own defaults apply. See more: [XlsxLoadOptions](https://www.gemboxsoftware.com/spreadsheet/docs/GemBox.Spreadsheet.XlsxLoadOptions.html).
    - `pptxLoadOptions` (string) — JSON-serialized PowerPoint load options, as a string (not a nested JSON object). Only used when the template's `fileFormat` is `pptx`. Optional; if omitted, the renderer's own defaults apply. See more: [PptxLoadOptions](https://www.gemboxsoftware.com/presentation/docs/GemBox.Presentation.PptxLoadOptions.html).
  - `relatedItems` (array<object>) — Additional templates that the primary template's content can pull in via an Include directive (e.g. a standard addendum reused across several main templates). Optional; omit it if the template doesn't include any other files. Each entry is a template reference with the same shape and load rules as the top-level `template` object.
    - `name` (string) **required** — Reference name for this related template. Mandatory: this is the name an Include directive inside the primary template's content uses to pull in this file, so it must match that reference exactly or the include resolves to nothing.
    - `urn` (string) — Identifier of the related template in the storage selected by `loadMethod` — a Storage key, a OneDrive file ID, or a Google Drive file ID. Mandatory together with `loadMethod` when `url` is not supplied for this entry.
    - `fileFormat` (any) **required** — Mandatory. File format of this related template, without a leading dot. Follows the same loadMethod pairing rule as the top-level template's `fileFormat`: Google formats require `loadMethod: GoogleDrive`; Microsoft formats require `loadMethod: Storage` or `OneDrive`.
    - `loadMethod` (any) — Where this related template's file is stored. Mandatory together with `urn` when `url` is not supplied for this entry.
    - `url` (string) — Direct download URL for this related template, used instead of `urn`+`loadMethod` to locate the file. Optional; supply either this or `urn`+`loadMethod`, not both.
    - `options` (object) — Load options for this related template, following the same per-format rules as `template.options`. Optional.
      - `docxLoadOptions` (string) _(default: "{ \"PreserveUnsupportedFeatures\": true }")_ — JSON-serialized Word load options, as a string (not a nested JSON object). Only used when this entry's `fileFormat` is `docx`. If omitted, defaults to `{"PreserveUnsupportedFeatures": true}`, so content the renderer does not natively support is preserved rather than stripped. See more: [DocxLoadOptions](https://www.gemboxsoftware.com/document/docs/GemBox.Document.DocxLoadOptions.html).
      - `xlsxLoadOptions` (string) — JSON-serialized Excel load options, as a string (not a nested JSON object). Only used when this entry's `fileFormat` is `xlsx`. Optional; if omitted, the renderer's own defaults apply. See more: [XlsxLoadOptions](https://www.gemboxsoftware.com/spreadsheet/docs/GemBox.Spreadsheet.XlsxLoadOptions.html).
      - `pptxLoadOptions` (string) — JSON-serialized PowerPoint load options, as a string (not a nested JSON object). Only used when this entry's `fileFormat` is `pptx`. Optional; if omitted, the renderer's own defaults apply. See more: [PptxLoadOptions](https://www.gemboxsoftware.com/presentation/docs/GemBox.Presentation.PptxLoadOptions.html).
  - `url` (string) — Direct download URL for the template file. When set, the file is downloaded from this URL directly into memory rather than being looked up via `urn`+`loadMethod`. Supply either this field alone, or `urn`+`loadMethod` together — not both. Omitting all three (`url`, `urn`, `loadMethod`) causes the request to fail with a 400 `TEMPLATE_NOT_FOUND` response.
- `data` (object) **required** — The data source that supplies values consumed by the template's merge fields, expressions, and other data-driven elements (e.g. repeaters, tables). Unlike `template`, `data` has no `url` alternative — `urn` and `loadMethod` are both always mandatory.
  - `loadMethod` (any) **required** — Mandatory. How the data in `urn` is retrieved. `Storage`, `OneDrive`, and `GoogleDrive` treat `urn` as a static file location and use its contents as-is (for a drive, the file must be accessible to the account tied to the request's Auth token). `GraphQL` treats `urn` as the URL of an external API to call, combining it with `query` and `variables` to build the request and transform the result into the data consumed by the template.
  - `urn` (string) **required** — Mandatory. Meaning depends on `loadMethod`: a Storage key, a OneDrive file ID, or a Google Drive file ID when `loadMethod` is `Storage`, `OneDrive`, or `GoogleDrive`; the URL of the external API to call when `loadMethod` is `GraphQL`. In the `GraphQL` case, the target doesn't have to be a true GraphQL endpoint — it can also be a plain REST endpoint, which is called with a `PUT` request instead of a GraphQL query.
  - `variables` (array<DataVariable>) — Optional list of named values injected into the data before merging. How each entry is applied depends on its `type`: a `global` variable is added as a top-level property on the data object; a `fieldExpression` variable is placed at the specific location given by its `name` (see `name`'s description); a `graphql` variable supplies a value for a variable referenced in `query`. Omit this array entirely if the template needs no additional or computed values beyond what `urn` already provides.
    - `name` (string) **required** — Mandatory. The variable's name. For `type: fieldExpression`, use a `Path.Name` format (e.g. `Account.CreatedDate`) so the engine knows which object in the data the computed value belongs to; for `type: global` or `type: graphql`, this is just the variable's own name.
    - `value` (string) **required** — Mandatory. The variable's value. For `type: graphql`, this is always a fixed literal value. For `type: global` or `type: fieldExpression`, this can be a fixed literal, a function expression (e.g. `{!$now()}`), or a reference to one or more other variables, and these can be combined in a single expression.
    - `type` (string) **required** _(enum: "fieldExpression", "graphql", "global")_ — Mandatory. Controls how this variable is applied — see the `variables` array description for what each value does. Must match one of `fieldExpression`, `graphql`, or `global` exactly, including case.
  - `query` (string) — GraphQL request body, as a JSON-serialized string (e.g. `"{\"query\":\"{...}\"}"`). Only read when `loadMethod` is `GraphQL`; ignored for every other `loadMethod`. Optional even when `loadMethod` is `GraphQL`.
  - `embedded` (string) — Optional custom metadata to write into the generated file's document properties (e.g. PDF metadata), as a JSON-serialized string of key-value pairs. This metadata isn't visible in the document's rendered content but can be read back from the file's properties. Omit it if no custom metadata is needed.
- `document` (object) **required** — Configuration for the document produced by this request: how dates and numbers are formatted, the output file's name and format, and where it's delivered.
  - `timeZone` (string) **required** — Mandatory. Timezone used to render date/time values in the generated document. Must be one of the supported timezone identifiers listed in the [locale reference](https://developers.doctavian.com/en/function-reference/locales); an unsupported value causes the request to fail with a 400 response.
  - `locale` (string) **required** — Mandatory. Locale used for language- and region-specific formatting (dates, numbers, currency) in the generated document. Must be one of the supported locale codes listed in the [locale reference](https://developers.doctavian.com/en/function-reference/locales), which follows the [Unicode CLDR Project](https://cldr.unicode.org/) naming (e.g. `en_GB`, `es_MX`). An unsupported value fails with `500` `LOCALE_DOWNLOAD_FAILED`, followed by `GENERATE_FUNCTION_FAILED`.
  - `name` (string) **required** — Mandatory. Name of the generated file, without a file extension — the extension is derived from `fileFormat` automatically.
  - `fileFormat` (string) **required** _(enum: "docx", "xlsx", "xlsm", "pptx", "gdoc", "gsheet", "gslide", "pdf", "csv")_ — Mandatory. Output format of the generated file, which must be one the template's `fileFormat` can produce: a `docx` template produces `docx` or `pdf`; `xlsx` produces `xlsx`, `pdf` or `csv`; `xlsm` produces `xlsm`, `xlsx`, `pdf` or `csv`; `pptx` produces `pptx` or `pdf`; `gdoc` produces `gdoc`, `docx` or `pdf`; `gsheet` produces `gsheet`, `xlsx`, `pdf` or `csv`; and `gslide` produces `gslide`, `pptx` or `pdf`. Requesting a format the template can't produce causes the request to fail with a 400 response.
  - `deliveryMethod` (string) **required** _(enum: "Storage", "OneDrive", "GoogleDrive")_ — Mandatory. Where the generated file is delivered. Constrained by `fileFormat`: `gdoc`, `gsheet`, and `gslide` can only be delivered to `GoogleDrive`; `docx`, `xlsx`, `xlsm`, and `pptx` can be delivered to `Storage` or `OneDrive`; `pdf` and `csv` can be delivered to any of the three. Requesting a delivery method the file format doesn't support causes the request to fail with a 400 response.
  - `path` (string) **required** — Mandatory. Destination folder for the generated file. `"root"` (for `Storage`) and `""` (for `OneDrive` or `GoogleDrive`) are the root of the selected location, not a placeholder to fill in — to target a subfolder, concatenate the relative subfolder path onto that root value rather than replacing it. Getting this wrong for the selected `deliveryMethod` — including the root value itself — causes the request to fail, because the generated file can't be saved to a location that doesn't resolve.
  - `options` (object) — Save options for the output file, passed through to the rendering engine that writes it, plus delivery-specific sharing and generation settings. Only the save-options property matching `fileFormat` is read; there is no equivalent option set for `xlsm`, `gdoc`, `gsheet` or `gslide`. All properties here are optional.
    - `pdfSaveOptions` (string) _(default: "{ \"ConformanceLevel\": \"PdfA3a\", \"Version\": \"PDF_1_7\", \"ImageDpi\": 750, \"SelectionType\": \"EntireFile\" }")_ — JSON-serialized PDF save options, as a string. Only used when `fileFormat` is `pdf`. If omitted, defaults to `{"ConformanceLevel": "PdfA3a", "Version": "PDF_1_7", "ImageDpi": 750, "SelectionType": "EntireFile"}`, which gives the widest PDF/A conformance, a balance of image size versus quality, and — for an `xlsx` source — ensures every sheet is included rather than just the active one. `ConformanceLevel` selects the PDF/A archival standard applied to the output. Accepted values: `PdfA1a` (full accessibility, tagged structure), `PdfA1b` (visual reproducibility only), `PdfA2a`, `PdfA2b`, `PdfA2u` (PDF 1.7 based; `u` requires Unicode text mapping), `PdfA3a`, `PdfA3b`, `PdfA3u` (as PDF/A-2 but allowing embedded file attachments). `Version` selects the underlying PDF specification. Accepted values: `PDF_1_4` (broadest compatibility), `PDF_1_5`, `PDF_1_6`, `PDF_1_7`, `PDF_2_0`. See more: [PdfSaveOptions](https://www.gemboxsoftware.com/pdf/docs/GemBox.Pdf.PdfSaveOptions.html).
    - `docxSaveOptions` (string) — JSON-serialized Word save options, as a string. Only used when `fileFormat` is `docx`. Optional; if omitted, the renderer's own defaults apply. See more: [DocxSaveOptions](https://www.gemboxsoftware.com/document/docs/GemBox.Document.DocxSaveOptions.html).
    - `onedrive` (object) — Sharing rights applied to the generated file when `deliveryMethod` is `OneDrive`. Ignored for any other `deliveryMethod`. All properties are optional and default to no sharing beyond the owner's own access.
      - `viewAnonymous` (boolean) _(default: false)_ — Creates a link that lets anyone with it view the generated document, without signing in. Defaults to `false` (no anonymous view link created).
      - `editAnonymous` (boolean) _(default: false)_ — Creates a link that lets anyone with it edit the generated document, without signing in. Defaults to `false` (no anonymous edit link created).
      - `viewOrganization` (boolean) _(default: false)_ — Creates a link that lets anyone signed into the same organization view the generated document. Defaults to `false` (no organization-wide view link created).
      - `editOrganization` (boolean) _(default: false)_ — Creates a link that lets anyone signed into the same organization edit the generated document. Defaults to `false` (no organization-wide edit link created).
      - `editUsers` (array<string>) — Email addresses of specific users to grant edit access to. Optional; omit or leave empty for no per-user edit sharing.
      - `viewUsers` (array<string>) — Email addresses of specific users to grant view access to. Optional; omit or leave empty for no per-user view sharing.
    - `xlsxSaveOptions` (string) — JSON-serialized Excel save options, as a string. Only used when `fileFormat` is `xlsx` or `csv`. Optional; if omitted, the renderer's own defaults apply. See more: [XlsxSaveOptions](https://www.gemboxsoftware.com/spreadsheet/docs/GemBox.Spreadsheet.XlsxSaveOptions.html).
    - `pptxSaveOptions` (string) — JSON-serialized PowerPoint save options, as a string. Only used when `fileFormat` is `pptx`. Optional; if omitted, the renderer's own defaults apply. See more: [PptxSaveOptions](https://www.gemboxsoftware.com/presentation/docs/GemBox.Presentation.PptxSaveOptions.html).
    - `googleGenerate` (object) — Generation performance options used only when the template's `fileFormat` is a Google format (`gdoc`, `gsheet`, `gslide`). Ignored for Microsoft-format templates.
      - `nativeMergeEnabled` (boolean) _(default: false)_ — Merges all merge fields in a single batched call to the Google API instead of one call per field. Speeds up generation for templates with many simple merge fields, but can be slower than the default for templates that use repeaters or tables, since those already make one call per repeated item regardless of this setting; also gives little benefit for templates with only a few merge fields. Defaults to `false`.
      - `nativeImageMergeEnabled` (boolean) _(default: false)_ — Merges all images in a single batched call to the Google API instead of one call per image. Speeds up generation for templates with many images, but can be slower than the default for templates with only a few. Defaults to `false`.
      - `functionsExternalUrlAllowed` (boolean) _(default: false)_ — Allows Google Sheets formulas in the template to fetch images from external URLs during generation. Defaults to `false`.
    - `googleDrive` (object) — Sharing rights applied to the generated file when `deliveryMethod` is `GoogleDrive`. Ignored for any other `deliveryMethod`. All properties are optional and default to no sharing beyond the owner's own access.
      - `viewAnonymous` (boolean) _(default: false)_ — Creates a link that lets anyone with it view the generated document, without signing in. Defaults to `false` (no anonymous view link created).
      - `editAnonymous` (boolean) _(default: false)_ — Creates a link that lets anyone with it edit the generated document, without signing in. Defaults to `false` (no anonymous edit link created).
      - `viewOrganization` (boolean) _(default: false)_ — Creates a link that lets anyone signed into the same organization view the generated document. Defaults to `false` (no organization-wide view link created).
      - `editOrganization` (boolean) _(default: false)_ — Creates a link that lets anyone signed into the same organization edit the generated document. Defaults to `false` (no organization-wide edit link created).
      - `editUsers` (array<string>) — Email addresses of specific users to grant edit access to. Optional; omit or leave empty for no per-user edit sharing.
      - `viewUsers` (array<string>) — Email addresses of specific users to grant view access to. Optional; omit or leave empty for no per-user view sharing.

### Responses

#### `200` — The request was accepted and queued for background processing. This response has no body -- it acknowledges receipt only and says nothing about whether generation succeeded. The generated document's metadata, or the error if generation fails, is delivered separately by a `POST` to the callback URL built from the `X-Client-Authorization` token's `iss` and `dest` claims. See this operation's callback documentation for both payload shapes.

#### `400` — The request was rejected before it was queued, so no callback is sent for it. A missing `X-Client-Authorization` header returns `X_CLIENT_AUTH_ERROR`. Failures that occur during generation itself are not reported here -- they are delivered to the callback URL instead.

`application/json`:

- `error` (object) **required** — What went wrong. `statusCode` and `message` describe the failure category, `innerErrors` the specific causes.
  - `innerErrors` (array<object>) **required** — One entry per distinct problem found with the request. At least one entry is always present, and a request failing several checks reports each of them separately -- read the whole array rather than only the first entry.
    - `code` (string) **required** — Stable, machine-readable Doctavian error code identifying what went wrong, in SCREAMING_SNAKE_CASE. This is the field to branch on in code: the two message fields are prose and may be reworded, but a code, once published, keeps its meaning.
    - `message` (string) **required** — Technical explanation of this specific failure, written for developers and logs. May reference internal specifics and is not safe to show an end user -- use `userMessage` for anything user-facing.
    - `userMessage` (string) **required** — The same failure phrased for an end user and safe to display in a UI verbatim. Says what the user can do about the problem where there is something to do, and never exposes internal detail.
    - `urn` (string) — The request property this error concerns, when the error is about one property. Optional: most errors leave it out. Named by the property's server-side name in PascalCase, not the JSON field name — `TemplateName` for `template.templateName`. Not related to the `urn` that identifies a file elsewhere in the API.
    - `eventId` (string) _(format: uuid)_ — Identifier of the logged failure behind this entry. Present only when the failure was logged, so treat it as optional. Quote it together with `operationId` when reporting the problem to support.
  - `message` (string) **required** — Short summary of the failure category, mirroring the HTTP status text (e.g. `Bad Request`). It names the class of failure only; the specific cause is in `innerErrors`.
  - `statusCode` (integer) **required** — HTTP status code of the error, repeated inside the body so the envelope stays self-contained when it is logged or forwarded. Always a number, never a string, and always equal to the response's own HTTP status.
  - `externalErrors` (array<any>) — Additional error detail attached as the server produced it. Each entry can be any JSON value and its shape is not fixed: an object returned by an external service the request depended on — such as the Google Apps Script execution layer used for `gdoc`, `gsheet` and `gslide` generation — or a plain string, such as the message of an unhandled exception. Use it for diagnostics only, and branch on `innerErrors[].code` instead. Empty or absent when there is nothing to add.
- `dateTime` (string) **required** _(format: date-time)_ — UTC timestamp when the error response was generated, with between three and seven decimal places. Doctavian's own responses end in `Z`; a response from the gateway — a `401` for a missing or invalid credential, or a `404` for a request that matches no operation — has seven decimal places and ends in `+00:00` instead.
- `operationId` (string) — Identifier of this operation in Doctavian's Azure logs, generated per request and returned on both success and failure. This is the primary reference to quote when reporting a problem to support; when `eventId` is also present, quote both. Left out of a response from the gateway, which answers some requests before they reach Doctavian: a `401` for a missing or invalid credential, and a `404` for a request that matches no operation, such as one without a mandatory query parameter. Such a response has no operation to log, and its `origin` may be empty.
- `eventId` (string) _(format: uuid)_ — Identifier of the corresponding entry in Doctavian's server-side error log. Present only when the failure was handled and logged, so treat it as optional and don't rely on it being there. When reporting a problem to support, quote it together with `operationId`: `operationId` identifies the request that was made, `eventId` identifies the logged failure behind it, and having both is what lets support trace the request end to end. A failure can instead, or also, carry an `eventId` on individual `innerErrors` entries.
- `origin` (string) **required** — The HTTP method and full request URL that produced this response, e.g. `POST https://api.doctavian.com/v1/documents/document/generate`. Useful when the envelope is logged or forwarded away from the call that produced it.
- `userId` (string) _(format: uuid)_ — The unique identifier of the user or system that initiated the request. Left out of the response when the request carried no bearer token — a guest caller on an operation that does not require one, such as a recipient signing with a `tid` — because there is no signed-in user to identify. Also left out when the caller has no Doctavian user yet: `platform-subscription-resolve` and `platform-subscription-trial-start` run before the caller's user exists, so their responses carry no `userId`.
- `externalContext` (object) — Optional, arbitrary JSON object echoed back unchanged from the request's externalContext, if one was supplied. Used to correlate this response with the request that produced it.