appPublishDocumentTemplate
Requires permission documents:template:update.
An installed app publishes its own document template: created on the first call, a new published revision on the next ones. The template must render against sample data. Needs the write_document_templates scope. It never becomes the default on its own: the organization chooses that.
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
mutation AppPublishDocumentTemplate($input: AppPublishDocumentTemplateInput!) {
appPublishDocumentTemplate(input: $input) {
id
name
createdAt
activeRevisionId
docType
handle
}
}
curl -X POST "https://<api-host>/graphql" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
--data @- <<'EOF'
{
"query": "mutation AppPublishDocumentTemplate($input: AppPublishDocumentTemplateInput!) {\n appPublishDocumentTemplate(input: $input) {\n id\n name\n createdAt\n activeRevisionId\n docType\n handle\n }\n}",
"variables": {
"input": {
"docType": "string",
"handle": "string",
"name": "string",
"source": "string"
}
}
}
EOF
Variables:
{
"input": {
"docType": "string",
"handle": "string",
"name": "string",
"source": "string"
}
}
Response:
{
"data": {
"appPublishDocumentTemplate": {
"id": "id",
"name": "string",
"createdAt": "2025-01-15T00:00:00Z",
"activeRevisionId": "id",
"docType": "string",
"handle": "string"
}
}
}
appPublishDocumentTemplate(
input: AppPublishDocumentTemplateInput!
): DocumentTemplate!
Arguments
appPublishDocumentTemplate.input ● AppPublishDocumentTemplateInput! non-null input
The template's type, handle, name and source.
Type
DocumentTemplate object
A tenant's Liquid template for one document type. Printing uses its published revision.