# POST /v4/campaigns/generate-payload

_Merkl API_

Generate an on-chain transaction payload for creating one or more campaigns from the provided data.

## Request body

**`application/json`**
```json
{
  "type": "object",
  "properties": {
    "creatorAddress": {
      "type": "string"
    },
    "rewardToken": {
      "type": "string"
    },
    "distributionChainId": {
      "anyOf": [
        {
          "format": "numeric",
          "default": 0,
          "type": "string"
        },
        {
          "type": "number"
        }
      ]
    },
    "startTimestamp": {
      "anyOf": [
        {
          "format": "numeric",
          "default": 0,
          "type": "string"
        },
        {
          "type": "number"
        }
      ]
    },
    "endTimestamp": {
      "anyOf": [
        {
          "format": "numeric",
          "default": 0,
          "type": "string"
        },
        {
          "type": "number"
        }
      ]
    },
    "campaignsParams": {
      "type": "object",
      "patternProperties": {
        "^(.*)$": {
          "type": "array",
          "items": {
            "additionalProperties": true,
            "type": "object",
            "properties": {
              "amount": {
                "type": "RegExp",
                "source": "[0-9]+",
                "flags": ""
              }
            },
            "required": [
              "amount"
            ]
          }
        }
      }
    }
  },
  "required": [
    "creatorAddress",
    "rewardToken",
    "distributionChainId",
    "startTimestamp",
    "endTimestamp",
    "campaignsParams"
  ]
}
```
**`application/x-www-form-urlencoded`**
```json
{
  "type": "object",
  "properties": {
    "creatorAddress": {
      "type": "string"
    },
    "rewardToken": {
      "type": "string"
    },
    "distributionChainId": {
      "anyOf": [
        {
          "format": "numeric",
          "default": 0,
          "type": "string"
        },
        {
          "type": "number"
        }
      ]
    },
    "startTimestamp": {
      "anyOf": [
        {
          "format": "numeric",
          "default": 0,
          "type": "string"
        },
        {
          "type": "number"
        }
      ]
    },
    "endTimestamp": {
      "anyOf": [
        {
          "format": "numeric",
          "default": 0,
          "type": "string"
        },
        {
          "type": "number"
        }
      ]
    },
    "campaignsParams": {
      "type": "object",
      "patternProperties": {
        "^(.*)$": {
          "type": "array",
          "items": {
            "additionalProperties": true,
            "type": "object",
            "properties": {
              "amount": {
                "type": "RegExp",
                "source": "[0-9]+",
                "flags": ""
              }
            },
            "required": [
              "amount"
            ]
          }
        }
      }
    }
  },
  "required": [
    "creatorAddress",
    "rewardToken",
    "distributionChainId",
    "startTimestamp",
    "endTimestamp",
    "campaignsParams"
  ]
}
```
**`multipart/form-data`**
```json
{
  "type": "object",
  "properties": {
    "creatorAddress": {
      "type": "string"
    },
    "rewardToken": {
      "type": "string"
    },
    "distributionChainId": {
      "anyOf": [
        {
          "format": "numeric",
          "default": 0,
          "type": "string"
        },
        {
          "type": "number"
        }
      ]
    },
    "startTimestamp": {
      "anyOf": [
        {
          "format": "numeric",
          "default": 0,
          "type": "string"
        },
        {
          "type": "number"
        }
      ]
    },
    "endTimestamp": {
      "anyOf": [
        {
          "format": "numeric",
          "default": 0,
          "type": "string"
        },
        {
          "type": "number"
        }
      ]
    },
    "campaignsParams": {
      "type": "object",
      "patternProperties": {
        "^(.*)$": {
          "type": "array",
          "items": {
            "additionalProperties": true,
            "type": "object",
            "properties": {
              "amount": {
                "type": "RegExp",
                "source": "[0-9]+",
                "flags": ""
              }
            },
            "required": [
              "amount"
            ]
          }
        }
      }
    }
  },
  "required": [
    "creatorAddress",
    "rewardToken",
    "distributionChainId",
    "startTimestamp",
    "endTimestamp",
    "campaignsParams"
  ]
}
```

## Example request

```bash
curl -X POST "https://api.merkl.xyz//v4/campaigns/generate-payload" \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ ... }'
```