πŸ”€ Campaign State Management

Visibility and control via campaign states

The Campaign API provides endpoints for working with the state of a campaign. A campaign operates with a dynamic flow governed by various states.

Initially, a campaign can be established in either an active or a draft state (the default is draft). You can transition the campaign among the following states: draft, active, paused, canceled, and completed.

  • Paused campaigns can be resumed. A pause is a temporary halt state.
  • Canceled campaigns cannot be resumed. Cancellation is a terminal state.
  • The completed state is triggered automatically on the campaign end_date.

This diagram shows the progression of campaign states:

Pause a Campaign

To temporarily suspend all campaign activities, make a Pause request (POST) to the Campaign AP. Specify the campaign_id in the path.

While a campaign is paused, users cannot claim rewards from it. Campaign data remains intact during the pause, and the campaign can be resumed at any time.

You might want to pause a campaign for a variety of reasons, including modifying media assets, implementing A/B testing, or making adjustments based on performance.

URI and Parameters

POST /alpha/campaign/{campaign_id}/pause
ParameterType and description
campaign_id
Required
UUID as string
Path parameter

The unique identifier of the campaign you want to pause, specified in the path. Format: 36-character string (including hyphens), following the pattern xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx

Example Request: Pause

curl --request POST \
     --url https://api.testcocrt.xyz/alpha/campaign/109544398-171e-4a81-97f7-9327030d8c1c/pause \
     --header 'Authorization: Bearer <YOUR_API_KEY>' \
     --header 'accept: application/json'

Example Response: Pause

The status field in the response shows that the campaign is in a paused state.

{
  "data": {
    "id": "109544398-171e-4a81-97f7-9327030d8c1c",
    "title": "Acme Sign-Up Campaign",
    "subtitle": "Welcome, new users",
    "description": "Join our sign-up campaign and be a part of a thriving community of creators and innovators. By signing up, you open the door to a world of opportunities, collaboration, and rewards.",
    "media_url": "",
    "status": "paused",
    "action": {
      "type": "mint",
      "token_type": "erc20",
      "id": "02dedcf2-a72b-46d7-b965-80f8fdff8f26",
      "payout_amount": 1
    },
    "condition": {
      "type": "sign_up",
      "name": "Sign Up",
      "description": "Become a part of the growing Acme community by completing the sign-up process. Once this condition is met, you become eligible for the rewards offered in this campaign, among many other benefits."
    }
  }
}

Resume a Campaign

To reactivate a paused campaign, make a Resume request (POST) to he Campaign AP. Specify the campaign_id in the path.

As soon as the campaign re-enters an active state, users can once again participate in the campaign and claim rewards.

URI and Parameters

POST /alpha/campaign/{campaign_id}/resume
ParameterType and description
campaign_id
Required
UUID as string
Path parameter

The unique identifier of the campaign you want to resume, specified in the path. Format: 36-character string (including hyphens), following the pattern xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx

Example Request: Resume

curl --request POST \
     --url https://api.testcocrt.xyz/alpha/campaign/1095344398-171e-4a81-87f7-936270430d8c1c/resume \
     --header 'Authorization: Bearer <YOUR_API_KEY>' \
     --header 'accept: application/json'

Example Response: Resume

The status field in the response shows that the resume operation was successful and the campaign is back to an active state.

{
  "data": {
    "id": "1095344398-171e-4a81-87f7-936270430d8c1c",
    "title": "Acme Sign-Up Campaign",
    "subtitle": "Welcome, new users",
    "description": "Join our sign-up campaign and be a part of a thriving community of creators and innovators. By signing up, you open the door to a world of opportunities, collaboration, and rewards.",
    "media_url": "",
    "status": "active",
    "action": {
      "type": "mint",
      "token_type": "erc20",
      "id": "02dedcf2-a72b-46d7-b965-80f8fdff8f26",
      "payout_amount": 1
    },
    "condition": {
      "type": "sign_up",
      "name": "Sign Up",
      "description": "Become a part of the growing Acme community by completing the sign-up process. Once this condition is met, you become eligible for the rewards offered in this campaign, among many other benefits."
    }
  }
}

Cancel a Campaign

To cancel a campaign, make a Cancel request (POST) to the Campaign AP. Specify the campaign_id in the path.

Canceling stops all activities from this point forward. Campaign data is retained until you delete the campaign.

🚧

Cancellation is a terminal state. Canceled campaigns cannot be resumed.

You might want to cancel a campaign for a variety of reasons, such as the planned end of a promotion or a shift in strategy. You might also need to cancel a campaign if you find a bug. But cancellation is not necessarily a negative action; it can often be a proactive step based on data (e.g., inefficient resource usage).

URI and Parameters

POST /alpha/campaign/{campaign_id}/cancel
ParameterType and description
campaign_id
Required
UUID as string
Path parameter

The unique identifier of the campaign you want to cancel, specified in the path. Format: 36-character string (including hyphens), following the pattern xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx

Example Request: Cancel

curl --request POST \
     --url https://api.testcocrt.xyz/alpha/campaign/19844898-121e-4a71-97e7-9027030ddc1c/cancel \
     --header 'Authorization: Bearer <YOUR-API-KEY>' \
     --header 'accept: application/json'

Example Response: Cancel

The status field in the response shows that the cancellation operation was successful

and the campaign is canceled.

{
  "data": {
    "id": "109544398-171e-4a81-97f7-9327030d8c1c",
    "title": "Acme Sign-Up Campaign",
    "subtitle": "Welcome, new users",
    "description": "Join our sign-up campaign and be a part of a thriving community of creators and innovators. By signing up, you open the door to a world of opportunities, collaboration, and rewards.",
    "media_url": "",
    "status": "canceled",
    "action": {
      "type": "mint",
      "token_type": "erc20",
      "id": "02dedcf2-a72b-46d7-b965-80f8fdff8f26",
      "payout_amount": 1
    },
    "condition": {
      "type": "sign_up",
      "name": "Sign Up",
      "description": "Become a part of the growing Acme community by completing the sign-up process. Once this condition is met, you become eligible for the rewards offered in this campaign, among many other benefits."
    }