Email Templates Queries

Access email templates for automated communications.

EmailTemplate — Returns a single email template based on the id provided

query GetEmailTemplate($id: ID) {
  EmailTemplate(id: $id) {
    id
    label
    document_type
    default
    active
    body
    to
    cc
    bcc
    object
    files { id }
    created_at
    updated_at
    deleted_at
  }
}
{
  "id": 100012
}

EmailTemplates — Returns a list of email templates with ordering, filters, and search

query EmailTemplates(
  $where: QueryEmailTemplatesWhereWhereConditions,
  $orderBy: [QueryEmailTemplatesOrderByOrderByClause!],
  $search: String
) {
  EmailTemplates(
    where: $where
    orderBy: $orderBy
    search: $search
  ) {
    id
    label
    document_type
    active
    default
    object
    created_at
    updated_at
  }
}
{
  "where": {
    "AND": [
      { "column": "ACTIVE", "operator": "EQ", "value": true }
    ]
  },
  "orderBy": [
    { "column": "LABEL", "order": "ASC" }
  ],
  "search": "template name"
}

Available fields

FieldTypeDescription
idIntUnique identifier of the email template.
labelStringLabel of the email template.
document_typeTypeType of document (invoice, estimate, order, etc.).
defaultBooleanWhether this is the default template for the document type.
activeBooleanWhether the email template is active.
bodyStringEmail body content.
to[String]Default TO recipients.
cc[String]Default CC recipients.
bcc[String]Default BCC recipients.
objectStringEmail subject line.
files[File]Attached files.
created_atDateTimeCreation date.
updated_atDateTimeLast update date.
deleted_atDateTimeDeletion date (soft delete).

Filters

You can create filters based on following fields

id - Int
Example: { "column": "ID", "operator": "EQ", "value": 100012 }
label - String
Example: { "column": "LABEL", "operator": "LIKE", "value": "%invoice%" }
document_type - Type
Example: { "column": "DOCUMENT_TYPE", "operator": "EQ", "value": "invoice" }
active - Boolean
Example: { "column": "ACTIVE", "operator": "EQ", "value": true }
default - Boolean
Example: { "column": "DEFAULT", "operator": "EQ", "value": true }

Sorting

You can sort data based on following fields: label, active, default, document_type

query SortEmailTemplates(
  $where: QueryEmailTemplatesWhereWhereConditions
) {
  EmailTemplates(
    where: $where
    orderBy: [{ column: LABEL, order: ASC }]
  ) {
    id
    label
    document_type
    active
    default
    object
  }
}

Example of data returned

{
  "data": {
    "EmailTemplates": [
      {
        "id": 100001,
        "label": "Invoice Reminder",
        "document_type": "invoice",
        "active": true,
        "default": true,
        "object": "Payment Reminder - Invoice {{invoice_number}}",
        "created_at": "2025-01-01T09:00:00Z",
        "updated_at": "2025-01-15T10:30:00Z"
      },
      {
        "id": 100002,
        "label": "Order Confirmation",
        "document_type": "order",
        "active": true,
        "default": false,
        "object": "Order Confirmation - {{order_number}}",
        "created_at": "2025-01-01T09:00:00Z",
        "updated_at": "2025-01-01T09:00:00Z"
      }
    ]
  }
}

Enums

Type (EmailTemplate)

ValueDescription
invoiceInvoice document.
estimateEstimate/quote document.
orderSales order document.
shipping_orderShipping order document.
credit_noteCredit note document.
purchasePurchase order document.
purchase_receiptPurchase receipt document.
product_returnProduct return document.
deliveryDelivery document.
refundRefund document.
stock_adjustmentStock adjustment document.
stock_entryStock entry document.
stock_removalStock removal document.
stock_transferStock transfer document.
subscriptionSubscription document.
b2b_storeB2B store document.

EmailTemplateFileType

ValueDescription
emailTemplateFilesFiles attached to the email template.