Skip to main content
POST
/
v1
/
loyalties
/
{campaignId}
/
rewards
Create Reward Assignment
curl --request POST \
  --url https://{cluster}.voucherify.io/v1/loyalties/{campaignId}/rewards \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --header 'X-App-Id: <api-key>' \
  --header 'X-App-Token: <api-key>' \
  --data '[
  {
    "reward": "rew_wg2pvCr5LDhCq4uVQZ9LhuZm",
    "parameters": {
      "loyalty": {
        "points": 2
      }
    }
  },
  {
    "reward": "rew_z35ffKoH0tCcck8EL56p6SIs",
    "parameters": {
      "loyalty": {
        "points": 2
      }
    }
  }
]'
[
  {
    "id": "rewa_Iw9VopmlLm0topBG17ZH1gp5",
    "reward_id": "rew_wg2pvCr5LDhCq4uVQZ9LhuZm",
    "related_object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N",
    "related_object_type": "campaign",
    "parameters": {
      "loyalty": {
        "points": 2
      }
    },
    "created_at": "2022-11-28T18:54:19.747Z",
    "updated_at": null,
    "object": "reward_assignment"
  },
  {
    "id": "rewa_tAFZ7cHiTwZyOg1QaWHt6yYv",
    "reward_id": "rew_z35ffKoH0tCcck8EL56p6SIs",
    "related_object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N",
    "related_object_type": "campaign",
    "parameters": {
      "loyalty": {
        "points": 2
      }
    },
    "created_at": "2022-11-28T18:54:19.747Z",
    "updated_at": null,
    "object": "reward_assignment"
  }
]

Authorizations

X-App-Id
string
header
required
X-App-Token
string
header
required
Authorization
string
header
required

The access token received from the authorization server in the OAuth 2.0 flow.

Path Parameters

campaignId
string
required

Unique campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign.

Example:

"camp_rRsfatlwN7unSeUIJDCYedal"

Body

application/json · Loyalties Rewards Create Assignment Request Body · array

Define the cost of the rewards in loyalty points.

Request body schema for POST v1/loyalties/{campaignId}/rewards.

  • Loyalties Rewards Create Assignment Item Request Body
  • Loyalties Rewards Create Assignment Item Coin Request Body
reward
string
required

The ID of the reward that will be assigned to the campaign.

parameters
object
required

Defines the cost of the reward.

Response

Returns a list of reward assignment objects.

Response body schema for POST v1/v1/loyalties/{campaignId}/rewards.

id
string
required

Unique reward assignment ID, assigned by Voucherify.

Example:

"rewa_PbIRoMXpwe5QhobW4JKu0VjH"

reward_id
string
required

Associated reward ID.

Example:

"rew_C7wS9eHFDN4CIbXI5PpLSkGY"

created_at
string<date-time>
required

Timestamp representing the date and time when the reward assignment was created. The value is shown in the ISO 8601 format.

Example:

"2022-08-11T14:49:22.586Z"

updated_at
string<date-time> | null
required

Timestamp representing the date and time when the reward assignment was updated. The value is shown in the ISO 8601 format.

Example:

"2022-08-11T16:01:34.885Z"

object
enum<string>
default:reward_assignment
required

The type of the object represented by the JSON. This object stores information about the reward assignment.

Available options:
reward_assignment

Related object ID to which the reward was assigned.

Example:

"camp_wciTvaOfYmAa3EmIIW3QpXXZ"

Related object type to which the reward was assigned.

Available options:
campaign
parameters
object

Defines the cost of the reward.

I