---
title: "Send a test billing email"
description: "Renders the chosen type with sample data and sends it immediately through the resolved transport, bypassing the outbox."
canonical_url: "https://twominutebilling.com/help/developers/api-reference/webhooks/send-a-test-billing-email"
---
# Send a test billing email

> Renders the chosen type with sample data and sends it immediately through the resolved transport, bypassing the outbox.

<api-operation method="POST" path="/v1/businesses/{biz}/emails/test">
<template v-slot:docs="">

Recorded in the email log with a `[Test]` subject prefix and no customer attached.

## Path parameters

<table>
<thead>
  <tr>
    <th>
      Parameter
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Required
    </th>
    
    <th>
      Description
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        biz
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      <strong>
        yes
      </strong>
    </td>
    
    <td>
      Business id (biz_…)
    </td>
  </tr>
</tbody>
</table>

## Headers

<table>
<thead>
  <tr>
    <th>
      Parameter
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Required
    </th>
    
    <th>
      Description
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        Idempotency-Key
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      no
    </td>
    
    <td>
      Safely retry writes — repeats return the original response. If a write FAILED after it had already taken effect, that failure is what repeats: the key is spent, and a new attempt needs a new key.
    </td>
  </tr>
</tbody>
</table>

## Body

The request body is **required**.

<table>
<thead>
  <tr>
    <th>
      Field
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Required
    </th>
    
    <th>
      Description
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        to
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      <strong>
        yes
      </strong>
    </td>
    
    <td>
      The address to send the test email to.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        type
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      <strong>
        yes
      </strong>
    </td>
    
    <td>
      The email type to send a test of. One of <code>
        invoice_issued
      </code>
      
      , <code>
        payment_receipt
      </code>
      
      , <code>
        payment_failed
      </code>
      
      , <code>
        subscription_canceled_nonpayment
      </code>
      
      .
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        draft
      </code>
    </td>
    
    <td>
      <code>
        object
      </code>
    </td>
    
    <td>
      no
    </td>
    
    <td>
      Send this unsaved draft instead of the stored template.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        draft.subject
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      <strong>
        yes
      </strong>
    </td>
    
    <td>
      The draft subject line.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        draft.heading
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      <strong>
        yes
      </strong>
    </td>
    
    <td>
      The draft heading.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        draft.body
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      <strong>
        yes
      </strong>
    </td>
    
    <td>
      The draft body text.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        draft.footer
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      no
    </td>
    
    <td>
      This email's own footer, same syntax and HTML subset as body. Null or empty uses the business footer (<code>
        email_config.footerNote
      </code>
      
      ), else the built-in one.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        draft.cta_label
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      no
    </td>
    
    <td>
      Button text; only for emails with a button. Null keeps the default.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        draft.show_facts
      </code>
    </td>
    
    <td>
      <code>
        boolean
      </code>
    </td>
    
    <td>
      no
    </td>
    
    <td>
      Whether the email shows the table of key facts (such as amount and date).
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        draft.block_order
      </code>
    </td>
    
    <td>
      <code>
        array of string
      </code>
    </td>
    
    <td>
      no
    </td>
    
    <td>
      Order of the movable sections, each exactly once. Null = body, action, facts, footer.
    </td>
  </tr>
</tbody>
</table>

## Response

<table>
<thead>
  <tr>
    <th>
      Field
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Description
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        object
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      The object type; always <code>
        email_test
      </code>
      
      . One of <code>
        email_test
      </code>
      
      .
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        ok
      </code>
    </td>
    
    <td>
      <code>
        boolean
      </code>
    </td>
    
    <td>
      True if the email was sent.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        error
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      Why sending failed, when it did.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        transport
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      How the email was sent. One of <code>
        console
      </code>
      
      , <code>
        smtp
      </code>
      
      , <code>
        esp
      </code>
      
      .
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        email_id
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      The id of the email message that was created.
    </td>
  </tr>
</tbody>
</table>

## Status codes

<table>
<thead>
  <tr>
    <th>
      Status
    </th>
    
    <th>
      Meaning
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        200
      </code>
    </td>
    
    <td>
      Test performed
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        400
      </code>
    </td>
    
    <td>
      Invalid request
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        409
      </code>
    </td>
    
    <td>
      Idempotency-Key conflict — the key is already in flight, or was reused with a different request payload.
    </td>
  </tr>
</tbody>
</table>
</template>

<template v-slot:request="">

```bash [Request]
curl -X POST "$TMBILLING_URL/v1/businesses/biz_XXXXXXXXXXXX01/emails/test" \
  -H "Authorization: Bearer $TMBILLING_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
    "to": "maya@example.com",
    "type": "invoice_issued"
  }'
```

</template>

<template v-slot:response="">
<code-group>

```json [200 OK]
{
  "object": "email_test",
  "ok": false,
  "error": null,
  "transport": "console",
  "email_id": "em_XXXXXXXXXXXX01"
}
```

```json [400 Bad Request]
{
  "error": {
    "type": "invalid_request_error",
    "message": "Invalid request"
  }
}
```

```json [409 Conflict]
{
  "error": {
    "type": "idempotency_error",
    "message": "Idempotency-Key conflict — the key is already in flight, or was reused with a different request payload."
  }
}
```

</code-group>
</template>
</api-operation>


## Sitemap

See the full [sitemap](https://twominutebilling.com/sitemap.md) for all pages.
