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

# Create Campaign

> Creates a new campaign with variants

<Info>
  Scope required: `rewards.issue`
</Info>

This endpoint creates a new partner-initiated campaign for a merchant. A
campaign defines the time window, terms, and reward variants for issuing
rewards to users.

Each campaign must have between 1 and 4 variants. Treatment variants specify
a `reward_template_id` that defines the reward to be issued. Control variants
(named "Control") do not require a
`reward_template_id`.

Use the [List Reward Templates](/partner/reward-templates/list-reward-templates)
endpoint to discover available reward templates for a merchant.

### Choosing a redemption window

A campaign can express its redemption window in two independent ways:

* **Fixed window** — `redeemable_from` / `redeemable_to`. The same calendar
  dates apply to every guest, whenever their reward was issued.
* **Relative window** — `retire_after_days`. Each guest gets that many days
  from the moment their own reward was issued.

For evergreen, always-on flows where guests enter continuously — birthday,
abandoned cart, post-purchase, service recovery — set `retire_after_days` and
**omit `end_at` and `redeemable_to`**. A campaign with no end date stays
redeemable indefinitely, so every guest gets the same full window regardless of
when they enter.

Adding a fixed end date to that shape truncates the window for late entrants. A
campaign with `redeemable_to` of `2026-12-31` and `retire_after_days` of `14`
gives a guest issued a reward on `2026-12-30` a single day to redeem, not
fourteen. The request still returns `201` and nothing surfaces the shortened
window, so choose the shape deliberately rather than setting both out of habit.

<Warning>
  A campaign with no end date sends no "expiring soon" notification — that
  reminder is driven by the campaign end date, not by the per-guest relative
  window. Guests on an evergreen campaign are not warned before their reward
  expires.
</Warning>

### Parameters

<ParamField body="campaign.merchant_id" type="string" required>
  Merchant ID
</ParamField>

<ParamField body="campaign.name" type="string" required>
  Campaign name
</ParamField>

<ParamField body="campaign.objective" type="string">
  Campaign objective
</ParamField>

<ParamField body="campaign.fine_print" type="string">
  Terms and conditions
</ParamField>

<ParamField body="campaign.start_at" type="string" required>
  Campaign start date (ISO8601)
</ParamField>

<ParamField body="campaign.end_at" type="string">
  Campaign end date (ISO8601). Omit for an evergreen campaign with no end date.
  Required when `redeemable_to` is sent — sending `redeemable_to` on its own
  returns a 400.
</ParamField>

<ParamField body="campaign.redeemable_from" type="string" required>
  Reward redemption start date (ISO8601)
</ParamField>

<ParamField body="campaign.redeemable_to" type="string">
  Reward redemption end date (ISO8601). Omit for an open-ended redemption
  window.
</ParamField>

<ParamField body="campaign.retire_after_days" type="integer">
  Reward expiry measured in days from issuance, 1-999 — for example `14` for
  "expires 14 days after the guest receives it". Omit for no relative expiry,
  which leaves each reward bounded only by the campaign's redemption window.
</ParamField>

<ParamField body="campaign.variants" type="array" required>
  Campaign variants (1-4 variants)

  <Expandable title="variant">
    <ParamField body="name" type="string" required>
      Variant name
    </ParamField>

    <ParamField body="reward_template_id" type="string">
      Reward template ID. Required for treatment variants, omit for control
      variants.
    </ParamField>
  </Expandable>
</ParamField>

### Response

Returns 201 Created with the campaign object.

<RequestExample>
  ```bash Evergreen Campaign theme={null}
  curl https://api.thanxsandbox.com/partner/campaigns \
    -X POST \
    -H 'X-ClientId: {client_id}' \
    -H 'Accept-Version: v4.0' \
    -H 'Content-Type: application/json' \
    -H 'Authorization: Bearer {access_token}' \
    -d '{
      "campaign": {
        "merchant_id": "k2lye10h32l5wzo",
        "name": "Birthday Reward",
        "objective": "Celebrate guest birthdays",
        "fine_print": "Limit one per customer",
        "start_at": "2025-06-01T00:00:00Z",
        "redeemable_from": "2025-06-01T00:00:00Z",
        "retire_after_days": 14,
        "variants": [
          {
            "name": "Treatment",
            "reward_template_id": "abc123def456"
          },
          {
            "name": "Control"
          }
        ]
      }
    }'
  ```

  ```bash Fixed Window Campaign theme={null}
  curl https://api.thanxsandbox.com/partner/campaigns \
    -X POST \
    -H 'X-ClientId: {client_id}' \
    -H 'Accept-Version: v4.0' \
    -H 'Content-Type: application/json' \
    -H 'Authorization: Bearer {access_token}' \
    -d '{
      "campaign": {
        "merchant_id": "k2lye10h32l5wzo",
        "name": "Summer Free Coffee",
        "objective": "Re-engage lapsed customers",
        "fine_print": "Limit one per customer",
        "start_at": "2025-06-01T00:00:00Z",
        "end_at": "2025-08-31T23:59:59Z",
        "redeemable_from": "2025-06-01T00:00:00Z",
        "redeemable_to": "2025-09-30T23:59:59Z",
        "variants": [
          {
            "name": "Treatment",
            "reward_template_id": "abc123def456"
          },
          {
            "name": "Control"
          }
        ]
      }
    }'
  ```
</RequestExample>

<ResponseExample>
  ```json 201 Evergreen theme={null}
  {
    "campaign": {
      "id": "camp_abc123",
      "name": "Birthday Reward",
      "objective": "Celebrate guest birthdays",
      "start_at": "2025-06-01T00:00:00Z",
      "end_at": null,
      "redeemable_from": "2025-06-01T00:00:00Z",
      "redeemable_to": null,
      "retire_after_days": 14,
      "time_zone": "America/Los_Angeles",
      "fine_print": "Limit one per customer",
      "variants": [
        {
          "id": "var_treat1",
          "name": "Treatment",
          "reward_template_id": "abc123def456"
        },
        {
          "id": "var_ctrl1",
          "name": "Control",
          "reward_template_id": null
        }
      ]
    }
  }
  ```

  ```json 201 Fixed Window theme={null}
  {
    "campaign": {
      "id": "camp_abc123",
      "name": "Summer Free Coffee",
      "objective": "Re-engage lapsed customers",
      "start_at": "2025-06-01T00:00:00Z",
      "end_at": "2025-08-31T23:59:59Z",
      "redeemable_from": "2025-06-01T00:00:00Z",
      "redeemable_to": "2025-09-30T23:59:59Z",
      "retire_after_days": null,
      "time_zone": "America/Los_Angeles",
      "fine_print": "Limit one per customer",
      "variants": [
        {
          "id": "var_treat1",
          "name": "Treatment",
          "reward_template_id": "abc123def456"
        },
        {
          "id": "var_ctrl1",
          "name": "Control",
          "reward_template_id": null
        }
      ]
    }
  }
  ```
</ResponseExample>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.