Create multiple campaigns

Everything you need to know to create multiple campaigns in batch on Merkl

While Merkl Studio is ideal for creating standard campaigns, Merkl also provides tooling for campaign creators who need to create multiple (and potentially advanced) campaigns at once.

This feature enables campaign creators to launch multiple campaigns sharing the same base parameters (creator address, reward token, reward chain, start and end time) in a single transaction.

All batch campaign creation methods involve generating campaign configurations and their corresponding payloads. This guide walks you through configuration and payload generation. Once you have a payload, refer to Create a Campaign from a Multisig or Gnosis Safe for execution instructions.

Method 1: Override Parameters from Existing Template Campaigns

This method uses existing campaigns as templates. You select past campaigns that closely match what you want, tweak a few parameters in their configuration, generate a payload, and execute it with a Safe.

1. Retrieve Campaign Templates

Choose past campaigns as close as possible to what you plan to launch. We strongly recommend matching both the campaign type and the distribution type. This minimizes edits and reduces the chance of errors.

Next, find the DatabaseId of the template campaign(s) you will use to derive your payload(s). To do this:

  1. Go to the Merkl app

  2. Select an opportunity and open the "Advanced" tab

  3. Copy your template DatabaseId

2. Prepare the Campaign Payload

Use this endpoint to build a batch using your selected template DatabaseId value(s) (from Step 1) and updated parameters for all your campaigns.

Request body structure:

{
  "creatorAddress": "0x...", // address in checksum format
  "rewardToken": "0x...", // checksum format
  "distributionChainId": 1, // chain where rewards will be distributed
  "startTimestamp": 1756512000, // Unix seconds
  "endTimestamp": 1756598400, // Unix seconds
  "campaignsParams": {
    "9427880006586247706": [// <-- template DatabaseId from Step 1
      {
        "amount": "85372895000000000000000", // in decimals
        "targetToken": "0x...", // or poolAddress / poolId / market / evkAddress
        "blacklist": [] // addresses to exclude (checksum)
      // ... override more parameters
      }
      // ...add more campaigns for this same template DatabaseId if needed
    ]
    // Add more DatabaseId, each with its own array of campaigns.
  }
}

Understanding Parameters

The endpoint uses two types of parameters:

1. Base Parameters (apply to all campaigns in the batch)

These parameters are shared across all campaigns. If you need different values for some campaigns (e.g., different reward token), create a separate payload.

  • creatorAddress: The address creating the campaigns

  • rewardToken: The token used for rewards across all campaigns

  • distributionChainId: The chain ID where campaigns will run

  • startTimestamp: The start date of the campaigns (in Unix timestamp format)

  • endTimestamp: The end date of the campaigns (in Unix timestamp format)

You can use this converter to convert dates to Unix timestamps.

2. Per-Campaign Parameters (specific to each campaign)

These parameters go under campaignsParams and let you customize each campaign. The available fields correspond to the campaign-specific parameters in each campaign configuration.

You can view all available parameters for a specific campaign using this endpoint.

Example: Campaign ID 13756496363331257690 - https://api.merkl.xyz/v4/config/13756496363331257690

For simple use cases where you only want to change the campaign amount, you'll only need to modify the amount field.

Example

You want to generate a payload for the following campaigns:

  • 2 Uniswap V3 campaigns (template DatabaseId: 9427880006586247706)

  • 1 Morpho (supply at the market level) campaign with a fixed rate of 5% APR (template DatabaseId: 6937583984928148176)

  • 1 Aave (supply side) campaign with a capped APR of 10% (template DatabaseId: 711211603263558496)

When using the API endpoint, the body will look like this:

Method 2: Using Campaign Configurations

This method allows you to generate a campaign payload using full campaign configurations rather than just overriding parameters from templates.

1. Retrieve Campaign Configurations

Use this endpoint to retrieve campaign configurations from existing campaigns.

2. Adjust Parameters

Modify the parameters in the configurations according to your needs. Refer to the campaign configuration documentation for details on available parameters.

3. Preview Your Campaigns (Optional)

You can simulate how your campaigns would appear after your payload is executed:

4. Generate the Payload

Call the endpoint https://api.merkl.xyz/docs#tag/config/post/v4configencodebatchsafe to generate your payload. You may also call this endpoint if you want to get the transaction data to execute your campaign from an EOA.

In the request body, enter your configurations as a list:

Method 3: Pre-Set Campaign Keys (Deprecated)

This method requires the Merkl team to pre-define campaigns in the backend. You then generate a payload by specifying the amount, dates, and chain for each pre-defined campaign.

Setup

To get started, provide:

We'll save these configurations and generate the corresponding keys needed to launch your campaigns in bulk, which we'll share via a GitHub Gist.

Once configured, you'll be able to create multiple campaigns at once, all sharing the same base parameters:

  • program: Provided by us—the internal ID of your incentive program

  • creator: The Safe address that will execute the campaign payload

  • rewardToken: In checksum format

  • distributionChainId: The chain where rewards will be distributed

  • startTimestamp: Campaign start time (Unix timestamp)

  • endTimestamp: Campaign end time (Unix timestamp)

Payload Generation

Generate your campaign payloads using this endpoint.

To use it:

  1. Input the base parameters listed above.

  2. In the request body, paste the JSON file with the keys and placeholder amounts we provided via GitHub Gist (see example below).

  3. For each key:

    • Replace the placeholder amount with the number of tokens you want to allocate (in raw units).

    • Use the correct number of decimals (e.g., 5000000000000000000 for 5 tokens if the token has 18 decimals).

    • If you do not plan to incentivize a specific key, remove it entirely from the JSON rather than setting the amount to 0.

  4. Click Send. If the payload is successfully generated, you'll be able to download it. If there's an error, reach out to us and we'll help troubleshoot.

  5. Download the generated payload

Example

Let’s say you’re a chain and want to incentivize:

  • 5 Uniswap pools

  • 2 Euler vaults

You would send us the addresses of the pools and vaults you want to incentivize. Once received, we’ll configure your setup and return the associated keys via a GitHub Gist.

The Gist will follow this format:

For example, it would look like this:

The values(100000000000000000000) are placeholder values. When creating your campaigns, you’ll need to replace them with the actual amounts you want to allocate. All amounts must be entered in raw format using the correct token decimals.

Then proceed with the steps outlined in the Payload Generation section above.

Considerations Before Generating a Payload

  • Minimum Rewards Threshold: Each campaign must meet the minimum hourly token distribution (typically ≥ ~$1/hour). If a campaign in the payload falls below this threshold, the payload will not be generated and will return an error message.

  • Duplicate Campaigns: If you're reusing the same keys or configuration to increase rewards for an existing campaign, you’ll need to modify the startTimestamp or endTimestamp slightly (e.g., by 1 second) to avoid a duplicate campaign error.

  • Payload Size Limitations: If your payload is too large, Safe may fail to execute the transaction. In that case, split your campaigns into multiple smaller batches. Creating up to ~20 campaigns at once typically works fine.

  • Decimal Precision: Ensure the amounts you distribute match the token's decimals. For example, for an 18-decimal token, 1 token = 1000000000000000000.

Last updated