Campaign .: Get Details

API Reference / v15

Get details of a Campaign

This endpoint returns details of a campaign as it applies to the user. To view a campaign’s details, you must have a user access token with the manage_user_campaigns permission.

Request Endpoint

GET /v15/campaigns/:id/:representation_type

Authorization Required – User Token in Header

Submit a user token with the manage_user_campaigns permission in the Authorization header.

Authorization: token 981-64eef337afa90f88bb897160f686dc9c64a4ff5848eeb8410942e0eecd35f1

Representation Types

Parameters Description
basic_v1 Basic title and description of campaign.
custom_progress_based_v1 Progress and requirements for gift card based campaign.(Not applicable for gift card based loyalty campaign)
item_based_loyalty_v1 Progress, required items and reward for item based loyalty campaign.
spend_based_loyalty_v1 Progress and requirements for spend based loyalty campaign.
visit_based_loyalty_v1 Progress and requirements for visit based loyalty campaign.
item_based_gift_card_loyalty_v1 Progress and requirements for item based gift card campaign.
spend_based_gift_card_loyalty_v1 Progress and requirements for spend based gift card campaign.

Basic Representation cURL Example

curl https://sandbox.thelevelup.com/v15/campaigns/20/basic_v1 \
  -H Accept:application/json \
  -H Content-Type:application/json \
  -H 'Authorization:token 981-64eef337afa90f88bb897160f686dc9c64a4ff5848eeb8410942e0eecd35f1'

Basic Representation Example Response

HTTP/1.1 200 OK

{
  "campaign": {
    "description": "Visit 10 times, get $10!",
    "title": "Loyalty"
  }
}

Basic Response Parameters

Parameters Description
description Campaign description.
title Campaign title.

Custom Progress Based Representation cURL Example

curl https://sandbox.thelevelup.com/v15/campaigns/20/custom_progress_based_v1 \
  -H Accept:application/json \
  -H Content-Type:application/json \
  -H 'Authorization:token 981-64eef337afa90f88bb897160f686dc9c64a4ff5848eeb8410942e0eecd35f1'

Custom Progress Based Representation Example Response

HTTP/1.1 200 OK

 {
  "campaign": {
    "closes_at": null,
    "currency": "USD",
    "current_progress": 0,
    "description": "Spend $50, get $5 credit!",
    "id": 17440,
    "image": null,
    "opens_at": "2022-09-14T16:45:06-04:00",
    "opted_in": null,
    "point_label_singular": null,
    "point_label_plural": null,
    "progress_type": "spend",
    "qualifying_order_spend_amount": null,
    "required_item_plural": "gift cards",
    "required_item_singular": "gift card",
    "requires_opt_in": false,
    "title": "Custom Loyalty",
    "goals": [
      {
        "goal": {
          "accomplished": false,
          "description": "Thanks for spending $50 at Pita Pit. Here's $5 to spend on anything you'd like!",
          "id": 1,
          "image": null,
          "progress_required": 500,
          "title": "Your $5 Reward"
        }
      }
    ]
  }
}

Custom Progress Based Response Parameters

Parameters Description
description Campaign description.
title Campaign title.
closes_at Campaign close time.
currency Campaign currency. Default value is USD.
current_progress Total progress of the user.
id Campaign ID.
image Campaign image.
opens_at Campaign start date and time.
opted_in Returns true is user has already opted in for the campaign.
point_label_plural Returns ‘points’. Applicable only for points based campaign.
point_label_singular Returns 'point’. Applicable only for points based campaign.
progress_type Progress type can be ‘item’ or ‘spend’.
qualifying_order_spend_amount Minimum value to spend to unlock the reward.
required_item_plural Item name as plural.
required_item_singular Item name as singular.
requires_opt_in Flag to determine if the user needed to opt in to qualify for reward.
goals Goals associated with the campaign.
accomplished Flag to determine if the goal is already accomplished.
description Description of the associated goal.
progress_required Progress required to achieve the goal.
title Title of the associated goal.

Item Based Loyalty cURL Example

curl https://sandbox.thelevelup.com/v15/campaigns/285/item_based_loyalty_v1 \
  -H Accept:application/json \
  -H Content-Type:application/json \
  -H 'Authorization:token 981-64eef337afa90f88bb897160f686dc9c64a4ff5848eeb8410942e0eecd35f1'

Item Based Loyalty Example Response

{
  "campaign": {
    "progress_item_count": 0,
    "required_item_count": 10,
    "required_item_plural": "Coffees",
    "required_item_singular": "Coffee",
    "reward_article": "a",
    "reward_title": "$1 Loyalty Reward"
  }
}

Item Based Loyalty Response Parameters

Parameters Description
progress_item_count Number of qualifying items that have been purchased.
required_item_count Required number of qualifying items that must be purchased.
required_item_plural Plural name of required item.
required_item_singular Singular name of required item.
reward_article Article for displaying reward in a description ('a’ coffee, 'an’ omelet).
reward_title Reward title.

Spend Based Loyalty cURL Example

curl https://sandbox.thelevelup.com/v15/campaigns/286/spend_based_loyalty_v1 \
  -H Accept:application/json \
  -H Content-Type:application/json \
  -H 'Authorization:token 981-64eef337afa90f88bb897160f686dc9c64a4ff5848eeb8410942e0eecd35f1'

Spend Based Loyalty Example Response

{
  "campaign": {
    "earn_amount": 1000,
    "progress_amount": 0,
    "required_spend_amount": 10000
  }
}

Spend Based Loyalty Response Parameters

Parameters Description
earn_amount Amount rewarded when required amount is spent.
progress_amount Amount spent.
required_spend_amount Required amount that must be spent to earn reward.

Visit Based Loyalty cURL Example

curl https://sandbox.thelevelup.com/v15/campaigns/287/visit_based_loyalty_v1 \
  -H Accept:application/json \
  -H Content-Type:application/json \
  -H 'Authorization:token 981-64eef337afa90f88bb897160f686dc9c64a4ff5848eeb8410942e0eecd35f1'

Visit Based Loyalty Example Response

{
  "campaign": {
    "progress_visit_count": 0,
    "required_visit_count": 10,
    "earn_amount": 1000,
    "qualifying_order_spend_amount": 0
  }
}

Visit Based Loyalty Response Parameters

Parameters Description
progress_visit_count Number of eligible visits.
required_visit_count Required number of eligible visits to earn reward.
earn_amount Reward value.
qualifying_order_spend_amount Minimum spend amount for order to be eligibile to count as a visit.

Item Based Gift Card Loyalty cURL Example

curl https://sandbox.thelevelup.com/v15/campaigns/20/item_based_gift_card_loyalty_v1 \
  -H Accept:application/json \
  -H Content-Type:application/json \
  -H 'Authorization:token 981-64eef337afa90f88bb897160f686dc9c64a4ff5848eeb8410942e0eecd35f1'

Item Based Gift Card Loyalty Example Response

HTTP/1.1 200 OK

{
  "campaign": {
    "description": null,
    "progress_item_count": 0,
    "progress_period_resets_at": null,
    "progress_period_starts_at": null,
    "required_item_count": 10,
    "required_item_plural": "gift cards",
    "required_item_singular": "gift card",
    "reward_article": null,
    "reward_title": "$1 Loyalty Reward",
    "title": null
  }
}

Item Based Gift Card Loyalty Response Parameters

Parameters Description
description Campaign description.
title Campaign title.
progress_item_count Campaign overall progress.
progress_period_resets_at Start time of the progress period.
progress_period_starts_at Reset time of the progress period.
required_item_plural Item name as Plural Eg: ‘Gift cards’.
required_item_singular Item name as Singular. Eg: ‘Gift card’
required_item_count Requirement number of items to qualify for reward.
reward_article Claim reward article.
reward_title Claim reward title.

Spend Based Gift Card Loyalty cURL Example

curl https://sandbox.thelevelup.com/v15/campaigns/286/spend_based_gift_card_loyalty_v1 \
  -H Accept:application/json \
  -H Content-Type:application/json \
  -H 'Authorization:token 981-64eef337afa90f88bb897160f686dc9c64a4ff5848eeb8410942e0eecd35f1'

Spend Based Gift Card Loyalty Example Response

{
  "campaign": {
    "currency": "USD",
    "description": null,
    "progress_period_resets_at": null,
    "progress_period_starts_at": null,
    "reward_article": null,
    "reward_title": "$1 Loyalty Reward",
    "title": null,
    "earn_amount": 0,
    "progress_amount": 0,
    "required_spend_amount": 500
  }
}

Spend Based Gift Card Loyalty Response Parameters

Parameters Description
description Campaign description.
title Campaign title.
progress_amount Progress made so far
progress_period_resets_at Start time of the progress period.
progress_period_starts_at Reset time of the progress period.
earn_amount Campaign value.
required_spend_amount Required amount spend to claim reward.
currency Campaign currency. Default value is USD.
reward_article Claim reward article.
reward_title Claim reward title.

Errors

The campaign does not exist or cannot be displayed

HTTP/1.1 404 Not Found