previewDocumentEmail
Requires permission settings:documents:read.
Render one document email template with sample data, using this org's brand, saved line-item columns, base currency and default language, applying an optional in-progress brand DRAFT. Persists nothing.
Errors: a failed call returns a GraphQL errors entry, not a field on the result, and data may be null or partial. Read the entry's extensions.code and message; every shape and code is in the Error reference.
Example:
- GraphQL
- cURL
query PreviewDocumentEmail($type: String!) {
previewDocumentEmail(type: $type) {
type
html
locale
subject
templateVersion
}
}
curl -X POST "https://<api-host>/graphql" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
--data @- <<'EOF'
{
"query": "query PreviewDocumentEmail($type: String!) {\n previewDocumentEmail(type: $type) {\n type\n html\n locale\n subject\n templateVersion\n }\n}",
"variables": {
"type": "string"
}
}
EOF
Variables:
{
"type": "string"
}
Response:
{
"data": {
"previewDocumentEmail": {
"type": "string",
"html": "string",
"locale": "string",
"subject": "string",
"templateVersion": 0
}
}
}
previewDocumentEmail(
draft: DocumentEmailDraftInput
locale: String
type: String!
): DocumentEmailPreview!
Arguments
previewDocumentEmail.draft ● DocumentEmailDraftInput input
Unsaved edits to preview. Omit to preview the saved version.
previewDocumentEmail.locale ● String scalar
The language of the email, as a locale code.
previewDocumentEmail.type ● String! non-null scalar
The kind of document the email is for.
Type
DocumentEmailPreview object
A rendered sample of one outbound document email.