> ## Documentation Index
> Fetch the complete documentation index at: https://docs.helpgenie.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# System Emails

> Preview and send test copies of transactional system emails. Admin only.

The `system-emails` resource allows admins to preview and send test copies of transactional emails (welcome messages, access approvals, access requests). Both actions are restricted to internal admin users.

***

## Preview system email

Renders the HTML preview of a system email template.

<ParamField body="resource" type="string" required>
  Must be `"system-emails"`
</ParamField>

<ParamField body="action" type="string" required>
  Must be `"preview"`
</ParamField>

<ParamField body="data" type="object" required>
  <Expandable title="properties">
    <ParamField body="template" type="string" required>
      The template to preview. One of:

      * `welcome_business` — Welcome email for business accounts
      * `welcome_consumer` — Welcome email for consumer accounts
      * `access_approved` — Notification when genie access is approved
      * `access_request` — Notification of a new access request
    </ParamField>
  </Expandable>
</ParamField>

<ResponseField name="success" type="boolean" />

<ResponseField name="data" type="object">
  <Expandable title="properties">
    <ResponseField name="html" type="string">
      The rendered HTML of the email template.
    </ResponseField>
  </Expandable>
</ResponseField>

<CodeGroup>
  ```typescript Request theme={null}
  const response = await ApiService.invoke({
    resource: "system-emails",
    action: "preview",
    data: {
      template: "welcome_business",
    },
  });
  ```

  ```bash cURL theme={null}
  curl -X POST https://api.helpgenie.ai/v1/system-emails \
    -H "Authorization: Bearer hg_live_YOUR_ADMIN_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "resource": "system-emails",
      "action": "preview",
      "data": {
        "template": "welcome_business"
      }
    }'
  ```
</CodeGroup>

***

## Send test email

Sends a test copy of a system email template to a specified recipient.

<ParamField body="resource" type="string" required>
  Must be `"system-emails"`
</ParamField>

<ParamField body="action" type="string" required>
  Must be `"sendTest"`
</ParamField>

<ParamField body="data" type="object" required>
  <Expandable title="properties">
    <ParamField body="template" type="string" required>
      The template to send. One of:

      * `welcome_business`
      * `welcome_consumer`
      * `access_approved`
      * `access_request`
    </ParamField>

    <ParamField body="recipient" type="string" required>
      Destination email address for the test email.
    </ParamField>
  </Expandable>
</ParamField>

<ResponseField name="success" type="boolean" />

<CodeGroup>
  ```typescript Request theme={null}
  const response = await ApiService.invoke({
    resource: "system-emails",
    action: "sendTest",
    data: {
      template: "welcome_business",
      recipient: "test@example.com",
    },
  });
  ```

  ```bash cURL theme={null}
  curl -X POST https://api.helpgenie.ai/v1/system-emails \
    -H "Authorization: Bearer hg_live_YOUR_ADMIN_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "resource": "system-emails",
      "action": "sendTest",
      "data": {
        "template": "welcome_business",
        "recipient": "test@example.com"
      }
    }'
  ```
</CodeGroup>

***

## Error codes

| Code               | Meaning                                                     |
| ------------------ | ----------------------------------------------------------- |
| `VALIDATION_ERROR` | Missing `template` or `recipient`, or unknown template name |
| `FORBIDDEN`        | Admin access required                                       |
| `INTERNAL_ERROR`   | Email delivery failed                                       |
