# Envelope Create (https://developers.doctavian.com/openapi/latest/reference/Signatures/envelope-signatures-envelope-create)

## `POST /signatures/envelope/create`

**Envelope Create**

Creates a signature envelope from one or more uploaded documents, the recipients who must act on it, and the fields they complete or sign. The envelope is created in `Draft` status and nothing is sent to recipients by this call — send it separately with `signatures-envelope-send`.

Uploading the documents is a mandatory first step: every document must already be in Storage before this call. Upload each one with `signatures-document-upload`, which returns a storage id, then reference that id in `documents[].urn` with `documents[].loadMethod` set to `Storage`. There is no way to send document content inline — no base64 field and no multipart variant — so an envelope cannot be created in a single request.

Storage keeps an uploaded document for 24 hours, so the upload and this call have to happen within that window. If an id does not resolve — wrong id, never uploaded, or the window has passed — the whole request fails with a `500` carrying `FILE_NOT_EXISTS_IN_STORAGE`, and no envelope is created.

A `.docx` document is converted to PDF while the envelope is created, because signing operates on PDF only, and anchor text is resolved against that converted PDF.

The parts of the request are linked by client-assigned reference ids rather than server ids, because no server ids exist yet: you choose `documents[].referenceDocumentId`, `recipients[].referenceSignerId` and `signGroups[].referenceSignGroupId`, each unique within the request, and `fields[]` points at them. The response returns the server-generated id for every object created.

Some failures depend on the subscription rather than on the request: multi-factor authentication on a recipient, attachment fields, digital signature fields, the `viewer` role and the `inpersonsigner` role each have their own error code when the plan does not include them. See the `400` response for the full list of error codes.

This operation is metered. A successful call reports one unit of the `envelopes-created` dimension, returned in `consumption`.

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

- `documents` (array<DocumentInput>) **required** — The documents the envelope is built from. Mandatory, and must contain at least one entry — an absent list is rejected with `NO_DOCUMENTS`, an empty one with `DOCUMENT_LIST_CANNOT_BE_EMPTY`.
  - `referenceDocumentId` (integer) **required** — Client-assigned id for this document, unique within the request. Mandatory; rejected with `REFERENCE_DOCUMENT_ID_REQUIRED` when absent. `fields[].referenceDocumentId` uses it to say which document a field belongs to. The server-generated document id is returned in the response.
  - `name` (string) **required** — Display name for the document within the envelope. Mandatory; rejected with `DOCUMENT_NAME_REQUIRED` when absent.
  - `loadMethod` (string) — How to source the document's content. `Storage` is the only recognized value, and it fetches the bytes identified by `urn`. There is no inline or base64 content field. Anything else, or omitting it, fails the request with the same `500` `FILE_NOT_EXISTS_IN_STORAGE` as a missing file rather than a validation error — always send `Storage`.
  - `urn` (string) — Storage id of the file, as returned by `signatures-document-upload` — or any other Storage file id, such as the `urn` of a document generated with `deliveryMethod` `Storage`. Only consulted when `loadMethod` is `Storage`. A `.docx` document is converted to PDF while the envelope is created, because signing operates on PDF only. Using the id moves the file into the envelope: it is removed from Storage as soon as the envelope is created, and the id stops resolving. Each id can therefore be used once — send the same id again, to another create or to an update, and the request fails with `FILE_NOT_EXISTS_IN_STORAGE`; upload the file again instead. To get the file back afterwards, download it from the envelope with `signatures-envelope-document-download`. If no file can be found for this id, the request fails with a `500` carrying `FILE_NOT_EXISTS_IN_STORAGE`.
  - `externalContext` (any) — Arbitrary JSON object for this document, stored with it and echoed back unchanged in the response and by `signatures-envelope-get`. Its shape is not validated, fixed or interpreted — use it for whatever the integration needs, such as your own record id or a correlation key. One common use is matching the entry in the response back to the document you sent: the response returns server-generated ids and does not echo the client reference id, so an `externalContext` is what ties the two together.
- `fields` (array<FieldInput>) — The fields placed on the documents for recipients to complete or sign. Optional.
  - `type` (any) **required** — What kind of field this is, which determines how it is rendered and what the recipient does with it. Mandatory; rejected with `FIELD_TYPE_REQUIRED` when absent and `FIELD_TYPE_INVALID` when outside the listed set. At most one `digitalsignature` field is allowed per recipient (or per sign group) per document — a second is rejected with `ONLY_ONE_DIGITAL_SIGNATURE_FIELD_ALLOWED`.
  - `properties` (any) — Styling and behavior for this field.
  - `referenceSignerId` (integer) — The `recipients[].referenceSignerId` of the person who completes this field. Set this or `referenceSignGroupId`, never both and never neither.
  - `referenceSignGroupId` (integer) — The `signGroups[].referenceSignGroupId` of the group whose members may complete this field. Set this or `referenceSignerId`, never both and never neither.
  - `referenceDocumentId` (integer) **required** — The `documents[].referenceDocumentId` of the document this field is placed on. Mandatory; rejected with `FIELD_REFERENCE_DOCUMENT_ID_REQUIRED` when absent.
  - `name` (string) **required** — Name of the field in the generated PDF. Mandatory; rejected with `PDF_FIELD_NAME_REQUIRED` when absent. Must be unique across every field in the request, not only within one document — a repeated name is rejected with `DUPLICATE_FIELD_NAME`. The response echoes it back on each `fields` entry, so it is what maps a returned id onto the field you sent.
  - `value` (string) — Pre-filled value for the field. Its meaning and format depend entirely on `type` and are not validated on write.
  - `anchorString` (string) — Text to search for in the document; the field is placed onto that text rather than at fixed coordinates, and takes the same dimensions as the matched text, so the length of the anchor determines the width of the field. Matching is case-sensitive, and a field is placed at **every** occurrence of the text in the document. When the text occurs once, the field keeps this `name`. When it occurs more than once, one field is created per occurrence and each is named with a numeric suffix — `myFieldName__1`, `myFieldName__2` and so on — so field names stay unique. Read values back, and match fields in responses, by those suffixed names. Anchors are resolved while the envelope is created, against the PDF the document was converted to. Supply this or the full coordinate set, never both. The anchor text is left in the document exactly as authored. It is not removed, and the field placed over it does not hide it, so format it in the document to be invisible — normally by setting its font color to the background color, white on a white page. An anchor left in a readable color is printed in the signed document and seen by every recipient. Wrap the anchor in a delimiter that will not occur in ordinary prose — `@signature_buyer@` rather than `Sign here:` — so that it matches only where you intended. Because every occurrence produces a field, an anchor made of everyday words picks up headings, footers and body text as well as the spot you had in mind. The delimiter is a convention, not syntax: `@` has no special meaning to the matcher and the text is matched literally, so any distinctive wrapper works as long as you use it consistently in the template.
  - `page` (integer) — 1-based page number the field is placed on. Part of the coordinate placement set — supply `page`, `height`, `width`, `positionX` and `positionY` together, or use `anchorString` instead.
  - `height` (number) — Height of the field in pixels. Part of the coordinate placement set — supply `page`, `height`, `width`, `positionX` and `positionY` together, or use `anchorString` instead.
  - `width` (number) — Width of the field in pixels. Part of the coordinate placement set — supply `page`, `height`, `width`, `positionX` and `positionY` together, or use `anchorString` instead.
  - `positionX` (number) — Horizontal position of the field's top-left corner, in pixels measured from the left edge of the page. Part of the coordinate placement set — supply `page`, `height`, `width`, `positionX` and `positionY` together, or use `anchorString` instead.
  - `positionY` (number) — Vertical position of the field's top-left corner, in pixels measured from the top edge of the page. Larger values move the field down the page. Part of the coordinate placement set — supply `page`, `height`, `width`, `positionX` and `positionY` together, or use `anchorString` instead.
  - `isRequired` (boolean) — Whether the recipient must complete this field before they can finish signing.
  - `tooltip` (string) — Help text shown to the recipient when they reach the field.
- `recipients` (array<RecipientInput>) **required** — The people who receive the envelope and what each of them may do with it. Mandatory, and must contain at least one entry — an absent list is rejected with `NO_RECIPIENTS`, an empty one with `RECIPIENT_LIST_CANNOT_BE_EMPTY`.
  - `referenceSignerId` (integer) — Client-assigned id for this recipient, unique within the request. `fields[].referenceSignerId` uses it to assign fields to this person. The server-generated recipient id is returned in the response.
  - `referenceSignGroupId` (integer) — The `signGroups[].referenceSignGroupId` of the group this recipient belongs to. When set, the group's `role`, signing order and mandatory flag govern this recipient, and `role` on the recipient is not validated.
  - `name` (string) **required** — Recipient's full name, used in notifications and on the signed document. Mandatory; rejected with `RECIPIENT_NAME_REQUIRED` when absent.
  - `email` (string) **required** _(format: email)_ — Email address the envelope is sent to. Mandatory; rejected with `RECIPIENT_EMAIL_REQUIRED` when absent and `RECIPIENT_INVALID_EMAIL_ADDRESS` when it is not a valid address.
  - `role` (any) — What this recipient does with the envelope. Validated only when the recipient has no `referenceSignGroupId`; for a grouped recipient the group's role applies instead. A value outside the listed set is rejected with `RECIPIENT_ROLE_INVALID`. The `viewer` and `inpersonsigner` roles additionally require the subscription to include them, failing with `VIEWER_ROLE_NOT_ALLOWED` or `INPERSON_ROLE_NOT_ALLOWED`. Choosing `inpersonsigner` also makes `hostEmail` mandatory on this recipient.
  - `signOrder` (integer) — Position of this recipient in the signing sequence. Mandatory, and must be non-zero, when `envelope.isSignOrder` is true and the recipient is not in a sign group — otherwise the request is rejected with `RECIPIENT_SIGN_ORDER_REQUIRED`. Ignored when `envelope.isSignOrder` is false.
  - `mandatory` (boolean) — Whether this recipient must complete their part for the envelope to complete.
  - `hostEmail` (string) _(format: email)_ — Email address of the person who facilitates in-person signing for this recipient. That host runs the signing session, and must open the signing using this exact address — an address that does not match cannot open it. The notification for this recipient goes to the host, not to the recipient, and tells the host the signing is an in-person flow. Mandatory when `role` is `inpersonsigner`: absent it is rejected with `HOST_EMAIL_REQUIRED`, malformed with `HOST_INVALID_EMAIL_ADDRESS`. The address must belong to an existing user on an active subscription, otherwise the request fails with `HOST_USER_INVALID` — someone outside your subscription cannot be nominated as host.
  - `isMfaEnabled` (boolean) — Whether this recipient must pass multi-factor authentication before signing. Requires the subscription to include MFA, otherwise the request fails with `MFA_NOT_ALLOWED`. When the account's MFA channel is not email, `phoneNumber` becomes mandatory.
  - `phoneNumber` (string) — Phone number used to deliver the recipient's multi-factor authentication code. Mandatory when `isMfaEnabled` is true and the account's MFA channel is not email — otherwise the request is rejected with `PHONE_NUMBER_REQUIRED`. No format is enforced.
  - `language` (any) — Language this recipient's signing pages are shown in, whatever their browser is set to. Optional. Must be `en` or `es`, matched without regard to case and stored in lowercase; any other value is rejected with `RECIPIENT_LANGUAGE_INVALID`. When omitted, null or empty, the recipient gets the calling user's `ENVELOPE_RECIPIENT_LANGUAGE` setting, which can be set at account, subscription or user level and is `en` unless changed. It applies to a recipient in a sign group too: each member carries their own language. It is fixed once the envelope is sent.
  - `externalContext` (any) — Arbitrary JSON object for this recipient, stored with it and echoed back unchanged in the response. Its shape is not validated, fixed or interpreted — use it for whatever the integration needs, such as your own record id or a correlation key. One common use is matching the entry in the response back to the recipient you sent: the response returns server-generated ids and does not echo the client reference id, so an `externalContext` is what ties the two together.
- `signGroups` (array<SignGroupInput>) — Groups of recipients that share a role, a position in the signing order and a set of fields, so a field can be assigned to the group rather than to one named person. Optional.
  - `referenceSignGroupId` (integer) **required** — Client-assigned id for this sign group, unique within the request. Mandatory; rejected with `REFERENCE_SIGN_GROUP_ID_REQUIRED` when absent. `recipients[].referenceSignGroupId` and `fields[].referenceSignGroupId` both point at it.
  - `name` (string) **required** — Display name for the group. Mandatory; rejected with `SIGN_GROUP_NAME_REQUIRED` when absent. Must be unique across the sign groups in the request. The response echoes it back on each `signGroups` entry, so it is what maps a returned id onto the group you sent.
  - `role` (any) **required** — What members of this group do with the envelope. Mandatory; rejected with `SIGN_GROUP_ROLE_REQUIRED` when absent and `SIGN_GROUP_ROLE_INVALID` when outside the listed set. It governs every recipient assigned to the group, whose own `role` is then not validated.
  - `signOrder` (integer) — Position of this group in the signing sequence. Mandatory, and must be non-zero, when `envelope.isSignOrder` is true — otherwise the request is rejected with `SIGN_GROUP_SIGN_ORDER_REQUIRED`.
  - `mandatory` (boolean) — Whether this group must complete its part for the envelope to complete.
- `envelope` (any) — Settings that apply to the envelope as a whole: the notification email, the sender shown to recipients, signing order, expiry, reminders and notifications.
- `externalContext` (any) — Arbitrary JSON object supplied by the caller and echoed back unchanged in the response envelope, on success and on error alike, for correlating a request with its response. Its shape is not validated or interpreted. To store a context with the envelope, send it as `envelope.externalContext`.

### Responses

#### `201` — The envelope was created in `Draft` status. No notification is sent to recipients by this call. `result.data` is the new envelope in full, in the same shape `signatures-envelope-get` returns: the envelope settings, including the `envelope.externalContext` stored with it, and every document, original document, recipient, sign group and field with its server-generated id. Match each returned entry to the object you sent by its marker: documents and recipients echo the `externalContext` supplied for them, and sign groups and fields echo their `name`, which is unique across the request. The client reference ids are not echoed back. `consumption` reports one unit of the `envelopes-created` metering dimension. The root `externalContext` is present only when the request supplied one, and is echoed back unchanged.

`application/json`:

_any_

#### `400` — The request was rejected. `error.innerErrors[].code` identifies the specific problem. Request structure: `NO_DOCUMENTS`, `DOCUMENT_LIST_CANNOT_BE_EMPTY`, `NO_RECIPIENTS`, `RECIPIENT_LIST_CANNOT_BE_EMPTY`. Reference ids: `REFERENCE_DOCUMENT_ID_REQUIRED`, `REFERENCE_SIGN_GROUP_ID_REQUIRED`, `DUPLICATE_REFERENCE_DOCUMENT_ID`, `DUPLICATE_REFERENCE_RECIPIENT_ID`, `DUPLICATE_REFERENCE_SIGNGROUP_ID`. Documents: `DOCUMENT_NAME_REQUIRED`. Recipients: `RECIPIENT_NAME_REQUIRED`, `RECIPIENT_EMAIL_REQUIRED`, `RECIPIENT_INVALID_EMAIL_ADDRESS`, `RECIPIENT_ROLE_INVALID`, `RECIPIENT_EITHER_SIGNER_OR_SIGNGROUP_REQUIRED`, `RECIPIENT_SIGN_ORDER_REQUIRED`, `HOST_EMAIL_REQUIRED`, `HOST_INVALID_EMAIL_ADDRESS`, `HOST_USER_INVALID`, `PHONE_NUMBER_REQUIRED`, `RECIPIENT_LANGUAGE_INVALID`. Sign groups: `SIGN_GROUP_NAME_REQUIRED`, `SIGN_GROUP_ROLE_REQUIRED`, `SIGN_GROUP_ROLE_INVALID`, `SIGN_GROUP_SIGN_ORDER_REQUIRED`. Fields: `PDF_FIELD_NAME_REQUIRED`, `DUPLICATE_FIELD_NAME`, `FIELD_TYPE_REQUIRED`, `FIELD_TYPE_INVALID`, `FIELD_REFERENCE_DOCUMENT_ID_REQUIRED`, `FIELD_EITHER_SIGNER_OR_SIGNGROUP_REQUIRED`, `FIELD_BOTH_SIGNER_AND_SIGNGROUP_CANNOT_BE_SET`, `ANCHOR_NOT_PROVIDED_POSITION_REQUIRED`, `ANCHOR_PROVIDED_POSITION_NOT_REQUIRED`, `ONLY_ONE_DIGITAL_SIGNATURE_FIELD_ALLOWED`, `FIELD_REGEX_PATTERN_INVALID`. Envelope settings: `SENDER_INVALID_EMAIL_ADDRESS`, `ENVELOPE_EXPIRY_DAYS_TOO_LOW`. Subscription entitlements — the request is well formed but the plan does not include the feature: `MFA_NOT_ALLOWED`, `ATTACHMENT_FIELD_NOT_ALLOWED`, `DIGITAL_SIGNATURE_FIELD_NOT_ALLOWED`, `VIEWER_ROLE_NOT_ALLOWED`, `INPERSON_ROLE_NOT_ALLOWED`.

`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.

#### `500` — The envelope could not be created. Returned when a document referenced by `documents[].urn` cannot be found in Storage (`FILE_NOT_EXISTS_IN_STORAGE`), and when an unhandled error occurs while converting the documents to PDF, resolving anchor text or saving the envelope (`FUNCTION_EXECUTION_ERROR`). Nothing is persisted. When one is available, this response carries an `eventId` identifying the logged failure — quote it together with `operationId` when reporting the problem to support.

`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.