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

# Notify Buyers

> Send the delivery email to everyone who bought a digital product, in one call.

Sends the customer notification / delivery email to **every buyer** of a digital
product, instead of calling [`POST /orders/{id}/notify`](/api-reference/orders/notify-order)
once per order. Use this after updating a product's files to let all existing
buyers know a new version is available.

The emails are sent in the background, so the call returns immediately with the
number of orders queued — it does not wait for delivery. Each buyer receives the
same standard delivery email they'd get from the per-order notify endpoint,
unless you override the subject or body in this request.

<Note>
  Buyers are resolved from the orders Filemonk has linked to this digital product.
  Discarded (deleted) orders are skipped.
</Note>

## Path parameters

<ParamField path="id" type="string" required>
  The ID (UUID) of the digital product whose buyers should be notified.
</ParamField>

## Request body

<ParamField body="subject" type="string">
  Override the email subject for this send. Supports the same Liquid variables
  as your email template (`{{ order.name }}`, `{{ customer.name }}`,
  `{{ shop.name }}`). When omitted, the subject from your Filemonk email
  settings is used.
</ParamField>

<ParamField body="body" type="string">
  Override the email body for this send. Supports the same Liquid variables as
  your email template. When omitted, the body from your Filemonk email settings
  is used.
</ParamField>

## Response

<ResponseField name="digital_product_id" type="string" required>
  The digital product the notifications were queued for.
</ResponseField>

<ResponseField name="notified_count" type="integer" required>
  The number of orders queued for notification.
</ResponseField>

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST 'https://app.filemonk.io/api/v1/external/digital_products/a1b2c3d4-e5f6-7890-abcd-ef1234567890/notify_buyers' \
    -H 'X-Auth-Token: fm_api_key_your_key_here' \
    -H 'Content-Type: application/json'
  ```

  ```bash cURL (custom message) theme={null}
  curl -X POST 'https://app.filemonk.io/api/v1/external/digital_products/a1b2c3d4-e5f6-7890-abcd-ef1234567890/notify_buyers' \
    -H 'X-Auth-Token: fm_api_key_your_key_here' \
    -H 'Content-Type: application/json' \
    -d '{
      "subject": "Your {{ shop.name }} download has been updated",
      "body": "Hi {{ customer.name }}, a new version of your file is ready. Use your original download link to access it."
    }'
  ```

  ```javascript Node.js theme={null}
  const DIGITAL_PRODUCT_ID = 'a1b2c3d4-e5f6-7890-abcd-ef1234567890';

  const result = await fetch(
    `https://app.filemonk.io/api/v1/external/digital_products/${DIGITAL_PRODUCT_ID}/notify_buyers`,
    {
      method: 'POST',
      headers: {
        'X-Auth-Token': 'fm_api_key_your_key_here',
        'Content-Type': 'application/json'
      },
      body: JSON.stringify({
        subject: 'Your {{ shop.name }} download has been updated',
        body: 'Hi {{ customer.name }}, a new version of your file is ready. Use your original download link to access it.'
      })
    }
  ).then(r => r.json());

  console.log(`Queued ${result.notified_count} notifications`);
  ```

  ```python Python theme={null}
  import requests

  DIGITAL_PRODUCT_ID = 'a1b2c3d4-e5f6-7890-abcd-ef1234567890'

  result = requests.post(
      f'https://app.filemonk.io/api/v1/external/digital_products/{DIGITAL_PRODUCT_ID}/notify_buyers',
      headers={'X-Auth-Token': 'fm_api_key_your_key_here'},
      json={
          'subject': 'Your {{ shop.name }} download has been updated',
          'body': 'Hi {{ customer.name }}, a new version of your file is ready. Use your original download link to access it.'
      }
  ).json()

  print(f"Queued {result['notified_count']} notifications")
  ```
</RequestExample>

<ResponseExample>
  ```json 202 theme={null}
  {
    "digital_product_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    "notified_count": 142
  }
  ```

  ```json 422 theme={null}
  {
    "error": "This digital product has no orders to notify"
  }
  ```

  ```json 404 theme={null}
  {
    "error": "Digital product not found"
  }
  ```
</ResponseExample>
