---
title: "Create Reward Assignment"
method: POST
path: "/v1/rewards/{rewardId}/assignments"
tags: ["Rewards"]
---

# Create Reward Assignment

`POST /v1/rewards/{rewardId}/assignments`

## Request

- Base URL: `https://api.voucherify.io`
- URL: `https://api.voucherify.io/v1/rewards/{rewardId}/assignments`
- Auth: one of:
  - API key in header `X-App-Id` and API key in header `X-App-Token`
  - OAuth 2
    - Implicit: `https://api.voucherify.io/v1/oauth/token`
    - Scopes: `api`, `rewards`

Assigns a reward to a specified loyalty campaign.

## Request body

- union: Request body schema for **POST** `v1/rewards/{rewardID}/assignments`.
  - RewardsAssignmentsCreateDigitalOrMaterialRewardRequestBody: Request body schema for **POST** `v1/rewards/{rewardID}/assignments`.
    - `campaign` string, required: The campaign ID of the campaign to which the reward is to be assigned.
    - `parameters` object, required: Defines the cost of the reward.
      - `loyalty` object, required: Defines the equivalent points value of the reward.
        - `points` integer: Number of points that will be subtracted from the loyalty card points balance if the reward is redeemed. Must be positive integer.
        - `auto_redeem` boolean, nullable: Determines if the reward is redeemed automatically when the customer reaches the sufficient number of points to redeem it. Value `true` means that the automatic reward redemption is active. Only one reward can be set to be redeemed automatically in a loyalty campaign, i.e. only one can have the value `true`.
  - RewardsAssignmentsCreateCoinRewardRequestBody: Request body schema for **POST** `v1/rewards/{rewardID}/assignments`.
    - `campaign` string, required: The campaign ID of the campaign to which the reward is to be assigned.
    - `validation_rules` string[]

## Response `200`

Returns a reward assignment object.

- RewardsAssignmentsCreateResponseBody
  - `id` string, required: Unique reward assignment ID, assigned by Voucherify.
  - `reward_id` string, required: Associated reward ID.
  - `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.
  - `updated_at` string, date-time, nullable, required: Timestamp representing the date and time when the reward assignment was updated. The value is shown in the ISO 8601 format.
  - `object` 'reward_assignment', required: The type of the object represented by the JSON. This object stores information about the reward assignment.
  - `related_object_id` string, required: Related object ID to which the reward was assigned.
  - `related_object_type` 'campaign', required: Related object type to which the reward was assigned.
  - `parameters` object: Defines the cost of the reward.
    - `loyalty` object, required: Defines the equivalent points value of the reward.
      - `points` integer: The number of points required to redeem the reward.
      - `auto_redeem` boolean, nullable: Determines if the reward is redeemed automatically when the customer reaches the sufficient number of points to redeem it. Value `true` means that the automatic reward redemption is active. Only one reward can be set to be redeemed automatically in a loyalty campaign, i.e. only one can have the value `true`.

## Other responses

- `400`: Returns an error if request body parameters are missing.
- `404`: Returns an error when creating a reward assignment for a reward that has been deleted or does not exist.
- `409`: Returns an error if a conflict is found, i.e. an assignment for the reward has already been created.

---

[API](https://skmtc.dev/voucherifyio/apis/voucherify-api-async-actions.md) - [All operations](https://skmtc.dev/voucherifyio/apis/voucherify-api-async-actions/llms.txt) - [OpenAPI document](https://skmtc.dev/voucherifyio/apis/voucherify-api-async-actions/revisions/4982266e0494?raw)
