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

# Campaign templates

> A conceptual overview of campaign templates in Voucherify

Campaign templates allow you to save a configuration of a created promotion tier, discount coupon, or gift voucher campaign and recreate it later.

<Note>
  Referrals and loyalty programs are not supported.
</Note>

## Purpose

Campaign templates help you manage campaigns by ensuring:

* **Rapid setup**: Quickly setting up new campaigns with a similar configuration.
* **Team enablement**: Making it easier for your team members to create campaigns.
* **Project migration**: Copying them to other projects, such as moving a campaign configuration from a test environment to a production environment.
* **Library creation**: Creating a library of campaigns to be used in the future.

## Permissions

You need permissions granted by the account owner to manage campaign templates.

Required permissions:

* **Campaign templates**: Permission to create, read, or delete campaign templates.
* **Campaigns**: Permission to create campaigns, required to create a new campaign from an existing template.

Optional permissions for creating related resources:

* **Validation rules**: For adding or cloning validation rules.
* **Customers (segments)**: For creating customer segments.
* **Products**: For creating a new product collection, product, or SKU.
* **Locations**: For creating a new location.

## Campaign template object details

A template saves the following elements of campaign configuration.

<Expandable title="Saved configuration elements">
  Saved configuration elements:

  * Campaign type
  * General campaign settings
  * Timeframe settings
  * Discount settings
  * Validation rule (the validation rule is cloned)
  * Product details (product collection, product, SKU)
  * Dynamic segment details
  * Location details
  * Metadata configuration (product, customer, order, redemption, campaign, voucher, promotion tier)
  * Custom event configuration
</Expandable>

The following elements aren't saved in the template and they must be edited in the campaign builder.

<Expandable title="Unsaved configuration elements">
  Unsaved configuration elements:

  * Campaign name
  * Category
  * Code count
  * Access settings in the Areas and Stores (Enterprise feature)
</Expandable>

The following elements **are not supported** by campaign templates:

<Expandable title="Unsupported configuration elements">
  Unsupported configuration elements:

  * Redeeming API keys (validation rule)
  * Redeeming users (validation rule)
  * Customer loyalty tier (validation rule)
  * Static segments
</Expandable>

## Dashboard operations

Campaign templates are managed through the dashboard.

### Creating a campaign template

In Voucherify dashboard, go to **Campaigns hub** > **Campaigns** or **Promotion tiers**:

1. Select an existing campaign or an individual promotion tier.
2. In the upper right corner, click the **star-folder icon** or **Create template**.
3. Name the template and, optionally, add a description.

<Warning>
  You cannot create a template out of a draft campaign.
</Warning>

Templates are listed in the **Templates** tab of the **Campaign hub** section.

### Using campaign templates

In a campaign template, click the three-dot menu to:

* **Create campaign**: Opens a builder to create a new campaign from the template. You can either leave the configuration as it is or change it.
* **Copy**: Copies the campaign template to a selected project. You can change its name and description.
* **Edit**: Edits the campaign template’s name and description within the current project.
* **Delete**: Deletes the campaign template.

Discount campaign templates can be also used to create promotion tiers and the other way round; promotion tier templates can be used to create discount campaigns.

<Info>
  When a campaign is created out of a template in a different project, the template itself is not copied to the campaign template list in the target project.
</Info>

## Template resource behavior

When you create a campaign from a template, its resources will be **created, cloned, or used again**.

<Warning>
  When you click **Confirm** in the **Campaign Resource Summary**, the new resources listed there will be created or cloned within the project, even if you leave the campaign builder.
</Warning>

### Create a new resource

New resources are created when they don't exist or have been changed since the template was saved:

* **Does not exist**: A validation rule is added because the template is used in a project which does not have it yet.
* **Restored**: An SKU was permanently deleted and it is restored from a template.
* **Changed**: A validation rule or static collection used in the template has been changed in the meantime, so it will be created again.

### Selecting different resources during campaign creation

When creating a campaign from a template, you can select different existing resources instead of using the ones saved in the template.

This applies to:

* Product collections (static or dynamic)
* Dynamic customer segments

If you select a different resource:

* The system compares it with the resource saved in the template.
* If it has the same configuration, no warning appears.
* If it is different, a warning appears. However, you can still continue and create the campaign using the selected resource.

This allows you to reuse the same campaign structure while choosing a different product collection or customer segment, without changing the template.

### Clone resource

A resource is cloned for example when an existing validation rule used in the template is copied so it can be used separately in a new campaign. This prevents changes from being introduced to other campaigns that use the validation rule saved in the template.

### Reuse resource

Resources are reused when they already exist and haven't been modified:

For example, a product collection is reused in its current state because it already exists in the project and it has not been changed.

### Specific resource behavior

The following resources behave in specific ways depending on the case:

* **Dynamic segments**: Only the configuration of the dynamic customer segments is copied between projects. To fill a segment, you can import customers from the other project.
* **Discounting main product**: When discounting a main product, all its SKUs will be recreated in the new project.
* **Discounting SKU**: When discounting an SKU, only the selected SKUs will be recreated, including the main product in the new project.
* **Modified resources**: If the product or SKU has been modified in the meantime, its current state is used. For example, if the price has been changed from \$10 to \$15, the product will be reused with the current price of \$15 and not copied or recreated with the original \$10 price.
* **In-bin products**: Any products/SKUs currently in the bin make it impossible to use the template since `source_id` is a unique identifier that cannot be reused.
* **Backup function**: Resources deleted after the template’s creation will still be correctly reproduced in any project. The template can serve as a backup for your resources.

### Metadata schema and custom event schema

Definitions of metadata and custom events are **never created** by copying the template to a different project or if they have been deleted. However, products containing the metadata are completely recreated, meaning all products will have proper metadata.

The template stores information about:

* **Metadata**: Properties along with their required types.
* **Custom events**: Only the names without properties and types.

<Tip>
  Before using a template in a new project, recreate relevant metadata or custom event schemas.
</Tip>

#### Schema statuses

Schemas, just like other resources, have their own statuses when a campaign is created from a template:

| Status              | Description                                                                  | Action/Outcome                                                                                                                                                                                               |
| :------------------ | :--------------------------------------------------------------------------- | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Schemas matched** | The schema present in the template matches the schema in the project.        | The campaign is created from the template.                                                                                                                                                                   |
| **Schemas differ**  | The schema type in the template differs from the one in the project.         | The campaign template **cannot be created**. This outcome is available for metadata schema only. Contact your project administrator or the account owner to modify the metadata definitions in this project. |
| **Schemas missing** | The schema in the template does not correspond to any schema in the project. | You can create the campaign from the template, however, the campaign may not work correctly. Ask the project administrator or the account owner to configure the schema definitions.                         |

<Note>
  If the metadata types saved in the template differ from those defined in the project (for example string in one project, object in the other project), you **cannot** create a campaign from the template.
</Note>

## Related features

Experiment with other features to improve your campaign results.

<AccordionGroup>
  <Accordion title="Developer setup: Templates API">
    You can also use [Templates API](/api-reference/templates/list-campaign-templates) to manage campaign templates programmatically.

    Additionally, you can also use the following endpoints from the Management API (enterprise feature):

    * [List campaign templates](/api-reference/management/list-campaign-templates)
    * [Copy campaign template to a project](/api-reference/management/copy-campaign-template-to-a-project)
  </Accordion>
</AccordionGroup>
