> ## 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.

# Create Digital Product

> Link assets to a Shopify product or variant to create a digital product.

## Overview

Creating a digital product links one or more assets to a Shopify product or variant. When a
customer purchases that Shopify product, Filemonk will automatically deliver the linked assets
to them.

You must provide a `shopify_product_id`. To link to a specific variant only (rather than all
variants of a product), also include `shopify_variant_id`.

<Info>
  Shopify IDs are **numeric integers** (e.g. `8847261098265`), not GID strings. You can find
  the numeric ID in your Shopify admin URL or via the Shopify API.
</Info>

## Request body

<ParamField body="digital_product" type="object" required>
  <Expandable title="Digital product fields">
    <ParamField body="shopify_product_id" type="integer" required>
      The numeric Shopify product ID to link to.
    </ParamField>

    <ParamField body="shopify_variant_id" type="integer">
      The numeric Shopify variant ID. Omit to link at the product level (all variants).
    </ParamField>

    <ParamField body="asset_ids" type="array" required>
      Array of asset UUIDs to attach to this digital product.
    </ParamField>

    <ParamField body="upsert_always" type="boolean" default="false">
      When `true`, a new copy of the assets is created for each order placed, even if the
      customer has ordered before. Useful for products where every purchase should generate
      a fresh set of assets (e.g. unique licence keys).
    </ParamField>

    <ParamField body="custom_message" type="string">
      A custom message shown to customers on the download page. Required when `preorder_enabled` is `true`.
    </ParamField>

    <ParamField body="preorder_enabled" type="boolean" default="false">
      Set to `true` to configure this as a preorder product. Customers who purchase will see
      a waiting screen until `preorder_launch_date` is reached. Requires `preorder_launch_date`
      and `custom_message`.
    </ParamField>

    <ParamField body="preorder_launch_date" type="string">
      ISO 8601 datetime when the preorder content becomes available. Must be at least 2 hours
      in the future. Required when `preorder_enabled` is `true`.
    </ParamField>

    <ParamField body="preorder_subject" type="string">
      Email subject for the preorder notification sent to customers when the content launches.
    </ParamField>

    <ParamField body="preorder_heading" type="string">
      Heading displayed on the customer's download page while the preorder is active.
    </ParamField>

    <ParamField body="preorder_description" type="string">
      Description displayed on the customer's download page while the preorder is active.
    </ParamField>
  </Expandable>
</ParamField>

## Response

Returns the created digital product object with all linked assets.

<RequestExample>
  ```bash cURL (basic) theme={null}
  curl -X POST 'https://app.filemonk.io/api/v1/external/digital_products' \
    -H 'X-Auth-Token: fm_api_key_your_key_here' \
    -H 'Content-Type: application/json' \
    -d '{
      "digital_product": {
        "shopify_product_id": 8847261098265,
        "asset_ids": ["a1b2c3d4-e5f6-7890-abcd-ef1234567890"],
        "custom_message": "Thanks for your purchase!"
      }
    }'
  ```

  ```bash cURL (variant-level) theme={null}
  curl -X POST 'https://app.filemonk.io/api/v1/external/digital_products' \
    -H 'X-Auth-Token: fm_api_key_your_key_here' \
    -H 'Content-Type: application/json' \
    -d '{
      "digital_product": {
        "shopify_product_id": 8847261098265,
        "shopify_variant_id": 46012345678921,
        "asset_ids": ["a1b2c3d4-e5f6-7890-abcd-ef1234567890"],
        "custom_message": "Thanks for your purchase!"
      }
    }'
  ```

  ```bash cURL (preorder) theme={null}
  curl -X POST 'https://app.filemonk.io/api/v1/external/digital_products' \
    -H 'X-Auth-Token: fm_api_key_your_key_here' \
    -H 'Content-Type: application/json' \
    -d '{
      "digital_product": {
        "shopify_product_id": 8847261098265,
        "asset_ids": ["a1b2c3d4-e5f6-7890-abcd-ef1234567890"],
        "custom_message": "Your download will be available on launch day!",
        "preorder_enabled": true,
        "preorder_launch_date": "2026-05-01T09:00:00Z",
        "preorder_heading": "Coming Soon",
        "preorder_description": "Your files will be ready on May 1st."
      }
    }'
  ```

  ```javascript Node.js theme={null}
  const response = await fetch(
    'https://app.filemonk.io/api/v1/external/digital_products',
    {
      method: 'POST',
      headers: {
        'X-Auth-Token': 'fm_api_key_your_key_here',
        'Content-Type': 'application/json'
      },
      body: JSON.stringify({
        digital_product: {
          shopify_product_id: 8847261098265,
          asset_ids: ['a1b2c3d4-e5f6-7890-abcd-ef1234567890'],
          custom_message: 'Thanks for your purchase!'
        }
      })
    }
  );
  const data = await response.json();
  ```

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

  response = requests.post(
      'https://app.filemonk.io/api/v1/external/digital_products',
      headers={'X-Auth-Token': 'fm_api_key_your_key_here'},
      json={
          'digital_product': {
              'shopify_product_id': 8847261098265,
              'asset_ids': ['a1b2c3d4-e5f6-7890-abcd-ef1234567890'],
              'custom_message': 'Thanks for your purchase!'
          }
      }
  )
  data = response.json()
  ```
</RequestExample>

<ResponseExample>
  ```json 201 theme={null}
  {
    "digital_product": {
      "id": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
      "shopify_product_id": 8847261098265,
      "shopify_variant_id": null,
      "assets": [
        {
          "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
          "type": "external",
          "name": "Photoshop Brushes Pack",
          "filename": "brushes-pack-v2.zip",
          "external_url": "https://cdn.example.com/files/brushes-pack-v2.zip",
          "content_type": "application/zip",
          "byte_size": 0,
          "created_at": "2026-03-01T14:30:00Z"
        }
      ],
      "upsert_always": false,
      "custom_message": "Thanks for your purchase!",
      "preorder_enabled": false,
      "preorder_launch_date": null,
      "preorder_subject": null,
      "preorder_heading": null,
      "preorder_description": null,
      "created_at": "2026-04-08T10:00:00Z",
      "updated_at": "2026-04-08T10:00:00Z"
    }
  }
  ```

  ```json 422 theme={null}
  {
    "errors": ["Preorder launch date must be in the future"]
  }
  ```
</ResponseExample>
