{
  "openapi": "3.0.1",
  "info": {
    "title": "Voucherify API - Rewards",
    "version": "v2018-08-01",
    "description": "Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details.",
    "contact": {
      "name": "Voucherify Team",
      "url": "https://www.voucherify.io/contact-support",
      "email": "support@voucherify.io"
    },
    "termsOfService": "https://www.voucherify.io/legal/subscription-agreement",
    "license": {
      "name": "MIT",
      "url": "https://github.com/voucherifyio/voucherify-js-sdk/blob/main/LICENSE"
    }
  },
  "servers": [
    {
      "url": "https://{cluster}.voucherify.io",
      "description": "Base URL",
      "variables": {
        "cluster": {
          "default": "api",
          "enum": [
            "api",
            "us1.api",
            "as1.api",
            "download",
            "us1.download",
            "as1.download"
          ]
        }
      }
    }
  ],
  "paths": {
    "/v1/rewards": {
      "get": {
        "operationId": "list-rewards",
        "tags": [
          "Rewards"
        ],
        "summary": "List Rewards",
        "description": "Retrieve rewards.",
        "parameters": [
          {
            "$ref": "#/components/parameters/limit"
          },
          {
            "$ref": "#/components/parameters/page"
          },
          {
            "schema": {
              "$ref": "#/components/schemas/ParameterRewardAssignmentId"
            },
            "in": "query",
            "name": "assignment_id",
            "description": "A unique reward assignment ID. Use this parameter to get the reward details in the context of an assignment ID."
          }
        ],
        "security": [
          {
            "X-App-Id": [],
            "X-App-Token": []
          },
          {
            "X-Voucherify-OAuth": [
              "api",
              "rewards"
            ]
          }
        ],
        "responses": {
          "200": {
            "description": "Returns a dictionary of reward objects.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RewardsListResponseBody"
                },
                "examples": {
                  "Example": {
                    "value": {
                      "object": "list",
                      "data_ref": "data",
                      "data": [
                        {
                          "id": "rew_3e7IqghVtTR7L3xQMSCxjFu2",
                          "name": "Get $10",
                          "type": "CAMPAIGN",
                          "parameters": {
                            "campaign": {
                              "id": "camp_FNYR4jhqZBM9xTptxDGgeNBV",
                              "balance": 1000,
                              "type": "GIFT_VOUCHERS"
                            }
                          },
                          "stock": null,
                          "redeemed": null,
                          "attributes": {},
                          "created_at": "2022-03-10T08:40:20.917Z",
                          "updated_at": "2022-08-17T07:52:56.965Z",
                          "metadata": null,
                          "object": "reward"
                        },
                        {
                          "id": "rew_nIy4gHpQHle2c3pNMwuj7G6j",
                          "name": "Get 100 Points",
                          "type": "CAMPAIGN",
                          "parameters": {
                            "campaign": {
                              "id": "camp_E87CubZLZ8eoQt3c4kAEZsx0",
                              "balance": 100,
                              "type": "LOYALTY_PROGRAM"
                            }
                          },
                          "stock": null,
                          "redeemed": null,
                          "attributes": {},
                          "created_at": "2022-02-28T11:56:13.764Z",
                          "updated_at": null,
                          "metadata": null,
                          "object": "reward"
                        },
                        {
                          "id": "rew_BNZ3van6AF2AiquWp8Lfw0xq",
                          "name": "30% discount",
                          "type": "CAMPAIGN",
                          "parameters": {
                            "campaign": {
                              "id": "camp_ZtHLATYVpItqmuSqmaz1rZ2Y",
                              "type": "DISCOUNT_COUPONS"
                            }
                          },
                          "stock": null,
                          "redeemed": null,
                          "attributes": {},
                          "created_at": "2022-08-11T09:48:50.609Z",
                          "updated_at": null,
                          "metadata": {},
                          "object": "reward"
                        },
                        {
                          "id": "rew_nlV8bgWU1jNO9YWQ7CdZmzq7",
                          "name": "1 point = $0.01",
                          "type": "COIN",
                          "parameters": {
                            "coin": {
                              "exchange_ratio": 0.01,
                              "points_ratio": 1
                            }
                          },
                          "stock": null,
                          "redeemed": null,
                          "attributes": {},
                          "created_at": "2022-08-11T16:45:21.582Z",
                          "updated_at": null,
                          "metadata": {
                            "Type": "0.01"
                          },
                          "object": "reward"
                        },
                        {
                          "id": "rew_x6FmF1KFdDs06hYPr9lK6ajf",
                          "name": "Material Reward",
                          "type": "MATERIAL",
                          "parameters": {
                            "product": {
                              "id": "prod_0b7d7dfb05cbe5c616",
                              "sku_id": "sku_0b7d7dfb090be5c619"
                            }
                          },
                          "stock": "4",
                          "redeemed": "1",
                          "attributes": {
                            "image_url": "https://voucherify-uploads.s3.amazonaws.com/org_2qt8DYlM/img_wJHdZUAVSpWtYM6ORq4up3I2.png",
                            "description": "Get a Comic Book in Archie's series."
                          },
                          "created_at": "2022-08-17T07:13:32.781Z",
                          "updated_at": null,
                          "metadata": {
                            "Type": "Personal"
                          },
                          "object": "reward"
                        }
                      ],
                      "total": 5
                    }
                  }
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "create-reward",
        "tags": [
          "Rewards"
        ],
        "summary": "Create Reward",
        "description": "Create a new reward.",
        "parameters": [],
        "security": [
          {
            "X-App-Id": [],
            "X-App-Token": []
          },
          {
            "X-Voucherify-OAuth": [
              "api",
              "rewards"
            ]
          }
        ],
        "requestBody": {
          "description": "Define parameters of the new reward.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RewardsCreateRequestBody"
              },
              "examples": {
                "Gift card credits": {
                  "value": {
                    "name": "Digital - Gift Card Reward",
                    "type": "CAMPAIGN",
                    "metadata": {
                      "Type": "Gift"
                    },
                    "parameters": {
                      "campaign": {
                        "id": "camp_hC2GdqYtOmTT45zfhib62cK1",
                        "balance": 3000
                      }
                    }
                  }
                },
                "Discount Coupon": {
                  "value": {
                    "name": "Digital - Discount Coupon",
                    "type": "CAMPAIGN",
                    "metadata": {
                      "Type": "Discount"
                    },
                    "parameters": {
                      "campaign": {
                        "id": "camp_hC2GdqYtOmTT45zfhib62cK1"
                      }
                    }
                  }
                },
                "Loyalty Points": {
                  "value": {
                    "name": "Digital - Loyalty Points Reward",
                    "type": "CAMPAIGN",
                    "metadata": {
                      "Type": "Loyalty Points"
                    },
                    "parameters": {
                      "campaign": {
                        "id": "camp_hC2GdqYtOmTT45zfhib62cK1",
                        "balance": 100
                      }
                    }
                  }
                },
                "Pay with Points": {
                  "value": {
                    "name": "Pay with Points Reward",
                    "type": "COIN",
                    "metadata": {
                      "Type": "Coin"
                    },
                    "parameters": {
                      "coin": {
                        "exchange_ratio": 900,
                        "points_ratio": 8000
                      }
                    }
                  }
                },
                "Material Reward": {
                  "value": {
                    "name": "Get a Comic Book",
                    "metadata": {
                      "Type": "Material"
                    },
                    "type": "MATERIAL",
                    "parameters": {
                      "product": {
                        "id": "prod_0b15f6b9f650c16990",
                        "sku_id": "sku_0b1621b319d248b79f"
                      }
                    },
                    "stock": 2,
                    "attributes": {
                      "image_url": "https://www.website.com/img_fPHsk9Ob.png",
                      "description": "Archie's Series"
                    }
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Returns a reward object.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RewardsCreateResponseBody"
                },
                "examples": {
                  "Material": {
                    "value": {
                      "id": "rew_Crmu3hu2FKZWZIML59AeAs1n",
                      "name": "Material Reward",
                      "type": "MATERIAL",
                      "parameters": {
                        "product": {
                          "id": "prod_0b15f6b9f650c16990",
                          "sku_id": "sku_0b1621b319d248b79f"
                        }
                      },
                      "stock": "2",
                      "redeemed": null,
                      "attributes": {
                        "image_url": "{{internalVoucherifyURL}}",
                        "description": "Archie's Series"
                      },
                      "created_at": "2022-08-25T11:20:58.172Z",
                      "updated_at": null,
                      "metadata": {
                        "Type": "Material"
                      },
                      "object": "reward"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/rewards/{rewardId}": {
      "parameters": [
        {
          "schema": {
            "$ref": "#/components/schemas/ParameterRewardId"
          },
          "name": "rewardId",
          "in": "path",
          "required": true,
          "description": "A unique reward ID."
        }
      ],
      "get": {
        "operationId": "get-reward",
        "tags": [
          "Rewards"
        ],
        "summary": "Get Reward",
        "description": "Retrieve a reward by the reward ID.",
        "parameters": [],
        "security": [
          {
            "X-App-Id": [],
            "X-App-Token": []
          },
          {
            "X-Voucherify-OAuth": [
              "api",
              "rewards"
            ]
          }
        ],
        "responses": {
          "200": {
            "description": "Returns a reward object if a valid identifier was provided. ",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Reward"
                }
              }
            }
          },
          "404": {
            "description": "Not Found. When requesting a reward that has been deleted or does not exist, the resource will not be returned.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "Not found": {
                    "value": {
                      "code": 404,
                      "key": "not_found",
                      "message": "Resource not found",
                      "details": "Cannot find reward with id rew_C7wS9eHFDN4CIbXI5PpLSkG",
                      "request_id": "v-0b8c77bcc890215e35",
                      "resource_id": "rew_C7wS9eHFDN4CIbXI5PpLSkG",
                      "resource_type": "reward"
                    }
                  }
                }
              }
            }
          }
        }
      },
      "put": {
        "operationId": "update-reward",
        "tags": [
          "Rewards"
        ],
        "summary": "Update Reward",
        "description": "Update the details of a reward.",
        "parameters": [],
        "security": [
          {
            "X-App-Id": [],
            "X-App-Token": []
          },
          {
            "X-Voucherify-OAuth": [
              "api",
              "rewards"
            ]
          }
        ],
        "requestBody": {
          "description": "Define the parameters to be updated for the reward.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RewardsUpdateRequestBody"
              },
              "examples": {
                "Gift card credits": {
                  "value": {
                    "name": "Digital - Gift Card Reward",
                    "metadata": {
                      "Type": "Gift"
                    },
                    "parameters": {
                      "campaign": {
                        "id": "camp_hC2GdqYtOmTT45zfhib62cK1",
                        "balance": 3000
                      }
                    }
                  }
                },
                "Discount Coupon": {
                  "value": {
                    "name": "Digital - Discount Coupon",
                    "metadata": {
                      "Type": "Discount"
                    },
                    "parameters": {
                      "campaign": {
                        "id": "camp_hC2GdqYtOmTT45zfhib62cK1"
                      }
                    }
                  }
                },
                "Loyalty points": {
                  "value": {
                    "name": "Digital - Loyalty Points Reward",
                    "metadata": {
                      "Type": "Loyalty Points"
                    },
                    "parameters": {
                      "campaign": {
                        "id": "camp_hC2GdqYtOmTT45zfhib62cK1",
                        "balance": 100
                      }
                    }
                  }
                },
                "Pay with Points": {
                  "value": {
                    "name": "Pay with Points Reward",
                    "metadata": {
                      "Type": "Coin"
                    },
                    "parameters": {
                      "coin": {
                        "exchange_ratio": 900,
                        "points_ratio": 8000
                      }
                    }
                  }
                },
                "Material Reward": {
                  "value": {
                    "name": "Get a Comic Book",
                    "metadata": {
                      "Type": "Physical product"
                    },
                    "parameters": {
                      "product": {
                        "id": "prod_0b15f6b9f650c16990",
                        "sku_id": "sku_0b1621b319d248b79f"
                      }
                    },
                    "stock": 2,
                    "attributes": {
                      "image_url": "{{internalVoucherifyURL}}",
                      "description": "Comic book"
                    }
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Returns an updated reward object.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RewardsUpdateResponseBody"
                },
                "examples": {
                  "Material": {
                    "value": {
                      "id": "rew_wg2pvCr5LDhCq4uVQZ9LhuZm",
                      "name": "Get a Comic Book",
                      "type": "MATERIAL",
                      "parameters": {
                        "product": {
                          "id": "prod_0b15f6b9f650c16990",
                          "sku_id": "sku_0b1621b319d248b79f"
                        }
                      },
                      "stock": "2",
                      "redeemed": null,
                      "attributes": {
                        "image_url": "{{internalVoucherifyURL}}",
                        "description": "Comic book"
                      },
                      "created_at": "2022-08-25T10:00:12.794Z",
                      "updated_at": "2022-08-25T10:06:30.655Z",
                      "metadata": {
                        "Type": "Physical product"
                      },
                      "object": "reward"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Returns an error if the balance parameter is not defined correctly.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/e_400_invalid_balance"
                },
                "examples": {
                  "Invalid Balance": {
                    "value": {
                      "code": 400,
                      "key": "invalid_balance",
                      "message": "Property 'parameters.campaign.balance' is invalid",
                      "details": "Property 'parameters.campaign.balance' must be greater than zero for campaign type: GIFT_VOUCHERS",
                      "request_id": "v-0b96d2b90dce48855f"
                    }
                  }
                }
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "delete-reward",
        "tags": [
          "Rewards"
        ],
        "summary": "Delete Reward",
        "description": "Delete a reward.",
        "parameters": [],
        "security": [
          {
            "X-App-Id": [],
            "X-App-Token": []
          },
          {
            "X-Voucherify-OAuth": [
              "api",
              "rewards"
            ]
          }
        ],
        "responses": {
          "204": {
            "description": "Returns no content if deletion is successful."
          },
          "400": {
            "description": "Bad Request. Returns an error indicating that the reward with given ID is assigned to a resource.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResourceInUseError"
                },
                "examples": {
                  "Example": {
                    "value": {
                      "code": 400,
                      "key": "resource_in_use",
                      "message": "Resource in use",
                      "details": "Resource reward with id rew_fcYALROsORec6cP0VBItCVfq is in use by reward_assignments with ids [rewa_5WV7H3y2lT3GGl03Xjw29IEc]",
                      "request_id": "v-0b8c7b967950216291",
                      "related_object_ids": [
                        "rewa_5WV7H3y2lT3GGl03Xjw29IEc"
                      ],
                      "related_object_type": "reward_assignment"
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Returns an error indicating that the reward with given ID was not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "Reward Not Found": {
                    "value": {
                      "code": 404,
                      "key": "not_found",
                      "message": "Resource not found",
                      "details": "Cannot find reward with id rew_2erjvECLs92GYzKbak3QkyT",
                      "request_id": "v-0ae29895e8c6b7781a",
                      "resource_id": "rew_2erjvECLs92GYzKbak3QkyT",
                      "resource_type": "reward"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/rewards/{rewardId}/assignments": {
      "parameters": [
        {
          "schema": {
            "$ref": "#/components/schemas/ParameterRewardId"
          },
          "name": "rewardId",
          "in": "path",
          "required": true,
          "description": "A unique reward ID."
        }
      ],
      "get": {
        "operationId": "list-reward-assignments",
        "tags": [
          "Rewards"
        ],
        "summary": "List Reward Assignments",
        "description": "Retrieve reward assignments by the reward ID.",
        "parameters": [
          {
            "$ref": "#/components/parameters/limit"
          },
          {
            "$ref": "#/components/parameters/page"
          }
        ],
        "security": [
          {
            "X-App-Id": [],
            "X-App-Token": []
          },
          {
            "X-Voucherify-OAuth": [
              "api",
              "rewards"
            ]
          }
        ],
        "responses": {
          "200": {
            "description": "Returns a dictionary of reward assignment objects. Each object contains information regarding the resource to which the reward was assigned and the cost in loyalty points for the reward.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RewardsAssignmentsListResponseBody"
                },
                "examples": {
                  "Example": {
                    "value": {
                      "object": "list",
                      "data_ref": "data",
                      "data": [
                        {
                          "id": "rewa_PbIRoMXpwe5QhobW4JKu0VjH",
                          "reward_id": "rew_C7wS9eHFDN4CIbXI5PpLSkGY",
                          "related_object_id": "camp_wciTvaOfYmAa3EmIIW3QpXXZ",
                          "related_object_type": "campaign",
                          "parameters": {
                            "loyalty": {
                              "points": 15
                            }
                          },
                          "created_at": "2022-08-17T08:13:02.507Z",
                          "updated_at": null,
                          "object": "reward_assignment"
                        },
                        {
                          "id": "rewa_pJYQBXSitK2OVPK3XMXZK76X",
                          "reward_id": "rew_C7wS9eHFDN4CIbXI5PpLSkGY",
                          "related_object_id": "camp_jcErmtGAOmHUAy0oUgkwKnPZ",
                          "related_object_type": "campaign",
                          "parameters": {
                            "loyalty": {
                              "points": 20
                            }
                          },
                          "created_at": "2022-08-24T11:40:22.418Z",
                          "updated_at": null,
                          "object": "reward_assignment"
                        }
                      ],
                      "total": 2
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Returns an error if the given reward is missing, does not exist or was deleted.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "Not Found": {
                    "value": {
                      "code": 404,
                      "key": "not_found",
                      "message": "Resource not found",
                      "details": "Cannot find reward with id rew_C7wS9eHFDN4CIbXI5PpLSkGYi",
                      "request_id": "v-0b95a68c678ad5c765",
                      "resource_id": "rew_C7wS9eHFDN4CIbXI5PpLSkGYi",
                      "resource_type": "reward"
                    }
                  }
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "create-reward-assignment",
        "tags": [
          "Rewards"
        ],
        "summary": "Create Reward Assignment",
        "description": "Assigns a reward to a specified loyalty campaign.",
        "parameters": [],
        "security": [
          {
            "X-App-Id": [],
            "X-App-Token": []
          },
          {
            "X-Voucherify-OAuth": [
              "api",
              "rewards"
            ]
          }
        ],
        "requestBody": {
          "description": "Provide the campaign ID of the campaign to which the reward is to be assigned and define the cost of the reward in terms of loyalty points.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RewardsAssignmentsCreateRequestBody"
              },
              "examples": {
                "Example": {
                  "value": {
                    "campaign": "camp_OTuGGP90PivbvROsRvfM65El",
                    "parameters": {
                      "loyalty": {
                        "points": 39
                      }
                    }
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Returns a reward assignment object.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RewardsAssignmentsCreateResponseBody"
                },
                "examples": {
                  "Example": {
                    "value": {
                      "id": "rewa_cqD2XE5x8LcD2c1FLlvqikti",
                      "reward_id": "rew_C7wS9eHFDN4CIbXI5PpLSkGY",
                      "related_object_id": "camp_OTuGGP90PivbvROsRvfM65El",
                      "related_object_type": "campaign",
                      "parameters": {
                        "loyalty": {
                          "points": 39
                        }
                      },
                      "created_at": "2022-08-24T13:44:42.610Z",
                      "updated_at": null,
                      "object": "reward_assignment"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Returns an error if request body parameters are missing.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/e_400_missing_param"
                },
                "examples": {
                  "Missing Parameter": {
                    "value": {
                      "code": 400,
                      "key": "missing_param",
                      "message": "Missing required parameter",
                      "details": "Parameter 'parameters.loyalty' is required",
                      "request_id": "v-0b95c7f3684ad5f06d"
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Returns an error when creating a reward assignment for a reward that has been deleted or does not exist.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "Reward Not Found": {
                    "value": {
                      "code": 404,
                      "key": "not_found",
                      "message": "Resource not found",
                      "details": "Cannot find reward with id rew_C7wS9eHFDN4CIbXI5PpLSkGYi",
                      "request_id": "v-0b95c0bedf46fcbe83",
                      "resource_id": "rew_C7wS9eHFDN4CIbXI5PpLSkGYi",
                      "resource_type": "reward"
                    }
                  },
                  "Missing Campaign": {
                    "value": {
                      "code": 404,
                      "key": "not_found",
                      "message": "Resource not found",
                      "details": "Cannot find campaign with id null",
                      "request_id": "v-0b95c68b12cad5eebb",
                      "resource_id": null,
                      "resource_type": "campaign"
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "Returns an error if a conflict is found, i.e. an assignment for the reward has already been created.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "Duplicate Found": {
                    "value": {
                      "code": 409,
                      "key": "duplicate_found",
                      "message": "Duplicated resource found",
                      "details": "Duplicated reward_assignment exists with id rewa_q1Ad955TUZS4nVIxplOw9pL3",
                      "request_id": "v-0b95c78daa06fcc6bb",
                      "resource_id": "rewa_q1Ad955TUZS4nVIxplOw9pL3",
                      "resource_type": "reward_assignment"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/rewards/{rewardId}/assignments/{assignmentId}": {
      "parameters": [
        {
          "schema": {
            "$ref": "#/components/schemas/ParameterRewardId"
          },
          "name": "rewardId",
          "in": "path",
          "required": true,
          "description": "A unique reward ID."
        },
        {
          "schema": {
            "$ref": "#/components/schemas/ParameterRewardAssignmentId"
          },
          "name": "assignmentId",
          "in": "path",
          "required": true,
          "description": "A unique reward assignment ID."
        }
      ],
      "put": {
        "operationId": "update-reward-assignment",
        "tags": [
          "Rewards"
        ],
        "summary": "Update Reward Assignment",
        "description": "Update the number of points needed to successfully redeem the reward.",
        "parameters": [],
        "security": [
          {
            "X-App-Id": [],
            "X-App-Token": []
          },
          {
            "X-Voucherify-OAuth": [
              "api",
              "rewards"
            ]
          }
        ],
        "requestBody": {
          "description": "Define the number of points required to exchange for the reward.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RewardsAssignmentsUpdateRequestBody"
              },
              "examples": {
                "Example": {
                  "value": {
                    "parameters": {
                      "loyalty": {
                        "points": 35
                      }
                    }
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Returns the updated reward assignment object.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RewardsAssignmentsUpdateResponseBody"
                },
                "examples": {
                  "Example": {
                    "value": {
                      "id": "rewa_pJYQBXSitK2OVPK3XMXZK76X",
                      "reward_id": "rew_C7wS9eHFDN4CIbXI5PpLSkGY",
                      "related_object_id": "camp_jcErmtGAOmHUAy0oUgkwKnPZ",
                      "related_object_type": "campaign",
                      "parameters": {
                        "loyalty": {
                          "points": 35
                        }
                      },
                      "created_at": "2022-08-24T11:40:22.418Z",
                      "updated_at": "2022-08-24T13:02:32.262Z",
                      "object": "reward_assignment"
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Returns an error indicating that the reward assignment with given ID was not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "Not Found": {
                    "value": {
                      "code": 404,
                      "key": "not_found",
                      "message": "Resource not found",
                      "details": "Cannot find reward_assignment with id rewa_pJYQBXSitK2OVPK3XMXZK76XI",
                      "request_id": "v-0b95b8760a4ad5dda1",
                      "resource_id": "rewa_pJYQBXSitK2OVPK3XMXZK76XI",
                      "resource_type": "reward_assignment"
                    }
                  }
                }
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "delete-reward-assignment",
        "tags": [
          "Rewards"
        ],
        "summary": "Delete Reward Assignment",
        "description": "This method deletes a reward assignment for a particular reward.",
        "parameters": [],
        "security": [
          {
            "X-App-Id": [],
            "X-App-Token": []
          },
          {
            "X-Voucherify-OAuth": [
              "api",
              "rewards"
            ]
          }
        ],
        "responses": {
          "204": {
            "description": "Returns no content if deletion is successful."
          },
          "404": {
            "description": "Returns an error indicating that the reward or reward assignment with given ID was not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "Reward Not Found": {
                    "value": {
                      "code": 404,
                      "key": "not_found",
                      "message": "Resource not found",
                      "details": "Cannot find reward with id rew_2erjvECLs92GYzKbak3QkyT",
                      "request_id": "v-0ae29f325e1027cde8",
                      "resource_id": "rew_2erjvECLs92GYzKbak3QkyT",
                      "resource_type": "reward"
                    }
                  },
                  "Reward Assignment Not Found": {
                    "value": {
                      "code": 404,
                      "key": "not_found",
                      "message": "Resource not found",
                      "details": "Cannot find reward_assignment with id rewa_YkwQ5ezNYTQV2geodMVhTpy",
                      "request_id": "v-0ae2a0588b9027cf95",
                      "resource_id": "rewa_YkwQ5ezNYTQV2geodMVhTpy",
                      "resource_type": "reward_assignment"
                    }
                  }
                }
              }
            }
          }
        }
      },
      "get": {
        "operationId": "get-reward-assignment",
        "tags": [
          "Rewards"
        ],
        "summary": "Get Reward Assignment",
        "description": "Retrieve a reward assignment.",
        "parameters": [],
        "security": [
          {
            "X-App-Id": [],
            "X-App-Token": []
          },
          {
            "X-Voucherify-OAuth": [
              "api",
              "rewards"
            ]
          }
        ],
        "responses": {
          "200": {
            "description": "Returns a reward assignment object.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RewardsAssignmentsGetResponseBody"
                }
              }
            }
          },
          "404": {
            "description": "Returns an error indicating that the reward assignment with given ID was not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "Reward Assignment Not Found": {
                    "value": {
                      "code": 404,
                      "key": "not_found",
                      "message": "Resource not found",
                      "details": "Cannot find reward_assignment with id rewa_pJYQBXSitK2OVPK3XMXZK76X",
                      "request_id": "v-0b95b596e98ad5da24",
                      "resource_id": "rewa_pJYQBXSitK2OVPK3XMXZK76X",
                      "resource_type": "reward_assignment"
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "parameters": {
      "limit": {
        "name": "limit",
        "in": "query",
        "required": false,
        "schema": {
          "$ref": "#/components/schemas/ParameterLimit"
        },
        "description": "Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items."
      },
      "page": {
        "name": "page",
        "in": "query",
        "required": false,
        "schema": {
          "$ref": "#/components/schemas/ParameterPage"
        },
        "description": "Which page of results to return. The lowest value is `1`."
      }
    },
    "schemas": {
      "ParameterRewardAssignmentId": {
        "type": "string",
        "example": "rewa_m9hEAu10KsPcLhGXiHG85aY0"
      },
      "RewardsListResponseBody": {
        "title": "Rewards List Response Body",
        "type": "object",
        "description": "Response body schema for **GET** `v1/rewards`.",
        "properties": {
          "object": {
            "type": "string",
            "default": "list",
            "description": "The type of the object represented by JSON."
          },
          "data_ref": {
            "type": "string",
            "default": "data",
            "description": "Identifies the name of the attribute that contains the array of transaction objects."
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Reward"
            },
            "description": "A dictionary that contains an array of rewards. Each entry in the array is a separate transaction object."
          },
          "total": {
            "type": "integer",
            "example": 20,
            "description": "Returns how many rewards in the project meet the limits defined by the query parameter definitions."
          }
        },
        "required": [
          "object",
          "data_ref",
          "data",
          "total"
        ]
      },
      "RewardsCreateRequestBody": {
        "title": "Rewards Create Request Body",
        "description": "Request body schema for **POST** `v1/rewards`.",
        "oneOf": [
          {
            "$ref": "#/components/schemas/RewardsCreateRequestBodyDigital"
          },
          {
            "$ref": "#/components/schemas/RewardsCreateRequestBodyMaterial"
          },
          {
            "$ref": "#/components/schemas/RewardsCreateRequestBodyPayWithPoints"
          }
        ]
      },
      "RewardsCreateResponseBody": {
        "title": "Rewards Create Response Body",
        "description": "Response body schema for **POST** `v1/rewards`.",
        "allOf": [
          {
            "$ref": "#/components/schemas/Reward"
          }
        ]
      },
      "Reward": {
        "type": "object",
        "title": "Reward",
        "properties": {
          "id": {
            "type": "string",
            "example": "rew_nIy4gHpQHle2c3pNMwuj7G6j",
            "description": "Unique reward ID, assigned by Voucherify."
          },
          "name": {
            "type": "string",
            "description": "Reward name."
          },
          "stock": {
            "type": "integer",
            "nullable": true,
            "description": "Configurable for **material rewards**. The number of units of the product that you want to share as a reward. Use this parameter to code a stock-taking logic."
          },
          "redeemed": {
            "type": "integer",
            "nullable": true,
            "description": "Defines the number of already invoked (successful) reward redemptions.\t"
          },
          "attributes": {
            "type": "object",
            "description": "These properties are configurable for **material rewards**.",
            "properties": {
              "image_url": {
                "type": "string",
                "description": "The HTTPS URL pointing to the .png or .jpg file."
              },
              "description": {
                "type": "string",
                "description": "An arbitrary string that you can attach to a material reward."
              }
            }
          },
          "metadata": {
            "type": "object",
            "description": "The metadata object stores all custom attributes assigned to the reward. A set of key/value pairs that you can attach to a reward object. It can be useful for storing additional information about the reward in a structured format."
          },
          "type": {
            "type": "string",
            "enum": [
              "CAMPAIGN",
              "COIN",
              "MATERIAL"
            ],
            "description": "Reward type."
          },
          "parameters": {
            "description": "Defines how the reward is generated.",
            "allOf": [
              {
                "$ref": "#/components/schemas/RewardType"
              }
            ]
          },
          "created_at": {
            "type": "string",
            "description": "Timestamp representing the date and time when the reward was created. The value is shown in the ISO 8601 format.",
            "example": "2022-08-11T14:49:22.586Z",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "nullable": true,
            "description": "Timestamp representing the date and time when the reward was updated. The value is shown in the ISO 8601 format.",
            "example": "2022-08-11T16:01:34.885Z",
            "format": "date-time"
          },
          "object": {
            "description": "The type of the object represented by the JSON. This object stores information about the reward.",
            "default": "reward",
            "enum": [
              "reward"
            ]
          }
        },
        "required": [
          "id",
          "name",
          "type",
          "stock",
          "redeemed",
          "metadata",
          "created_at",
          "updated_at",
          "object"
        ]
      },
      "Error": {
        "title": "Error Object",
        "type": "object",
        "description": "Error details",
        "properties": {
          "code": {
            "type": "integer",
            "description": "Error's HTTP status code."
          },
          "key": {
            "type": "string",
            "description": "Short string describing the kind of error which occurred."
          },
          "message": {
            "type": "string",
            "description": "A human-readable message providing a short description of the error."
          },
          "details": {
            "type": "string",
            "description": "A human-readable message providing more details about the error."
          },
          "request_id": {
            "type": "string",
            "example": "v-0a885062c80375740f",
            "description": "This ID is useful when troubleshooting and/or finding the root cause of an error response by our support team."
          },
          "resource_id": {
            "type": "string",
            "description": "Unique resource ID that can be used in another endpoint to get more details.",
            "example": "rf_0c5d710a87c8a31f86"
          },
          "resource_type": {
            "type": "string",
            "description": "The resource type.",
            "example": "voucher"
          },
          "error": {
            "type": "object",
            "description": "Includes additional information about the error.",
            "properties": {
              "message": {
                "type": "string",
                "description": "The message configured by the user in a validation rule."
              }
            }
          }
        },
        "required": [
          "code",
          "message"
        ]
      },
      "ParameterRewardId": {
        "type": "string",
        "example": "rew_2erjvECLs92GYzKbak3QkyTV"
      },
      "RewardsUpdateRequestBody": {
        "title": "Rewards Update Request Body",
        "description": "Request body schema for **PUT** `v1/rewards/{rewardId}`.",
        "oneOf": [
          {
            "$ref": "#/components/schemas/RewardsUpdateRequestBodyDigital"
          },
          {
            "$ref": "#/components/schemas/RewardsUpdateRequestBodyMaterial"
          },
          {
            "$ref": "#/components/schemas/RewardsUpdateRequestBodyPayWithPoints"
          }
        ]
      },
      "RewardsUpdateResponseBody": {
        "title": "Rewards Update Response Body",
        "description": "Response body schema for **PUT** `v1/rewards/{rewardId}`.",
        "allOf": [
          {
            "$ref": "#/components/schemas/Reward"
          }
        ]
      },
      "e_400_invalid_balance": {
        "title": "Invalid Balance",
        "type": "object",
        "description": "Error: Bad Request &rarr; Invalid Balance",
        "properties": {
          "code": {
            "type": "integer",
            "default": 400,
            "description": "Error's HTTP status code."
          },
          "key": {
            "type": "string",
            "default": "invalid_balance",
            "description": "Short string describing the kind of error which occurred."
          },
          "message": {
            "type": "string",
            "description": "A human-readable message providing a short description of the error."
          },
          "details": {
            "type": "string",
            "description": "A human-readable message providing more details about the error."
          },
          "request_id": {
            "type": "string",
            "example": "v-0a884c6be8c3756f42",
            "description": "This ID is useful when troubleshooting and/or finding the root cause of an error response by our support team."
          }
        }
      },
      "ResourceInUseError": {
        "title": "Resource in Use Error Object",
        "type": "object",
        "description": "Error: Bad Request - Resource in use",
        "allOf": [
          {
            "$ref": "#/components/schemas/Error"
          },
          {
            "properties": {
              "related_object_ids": {
                "type": "array",
                "description": "Name or ID of the resources that are related.",
                "items": {
                  "type": "string",
                  "example": "rewa_5WV7H3y2lT3GGl03Xjw29IEc"
                }
              },
              "related_object_type": {
                "type": "string",
                "description": "Specifies the type of resource that is related."
              },
              "related_object_total": {
                "type": "integer",
                "description": "Specifies the total resource that are related."
              }
            }
          }
        ]
      },
      "RewardsAssignmentsListResponseBody": {
        "type": "object",
        "description": "Response body schema for **GET** `v1/rewards/{rewardID}/assignments`.",
        "title": "Rewards Assignments List Response Body",
        "properties": {
          "object": {
            "type": "string",
            "description": "The type of the object represented by JSON. This object stores information about reward assignments in a dictionary.",
            "default": "list"
          },
          "data_ref": {
            "type": "string",
            "description": "Identifies the name of the attribute that contains the array of reward assignments.",
            "default": "data"
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RewardAssignment"
            }
          },
          "total": {
            "type": "integer",
            "description": "Total number of reward assignments."
          }
        },
        "required": [
          "object",
          "data_ref",
          "data",
          "total"
        ]
      },
      "RewardsAssignmentsCreateRequestBody": {
        "description": "Request body schema for **POST** `v1/rewards/{rewardID}/assignments`.",
        "title": "Rewards Assignments Create Request Body",
        "oneOf": [
          {
            "$ref": "#/components/schemas/RewardsAssignmentsCreateDigitalOrMaterialRewardRequestBody"
          },
          {
            "$ref": "#/components/schemas/RewardsAssignmentsCreateCoinRewardRequestBody"
          }
        ]
      },
      "RewardsAssignmentsCreateResponseBody": {
        "type": "object",
        "title": "Rewards Assignments Create Response Body",
        "description": "Response body schema for **POST** `v1/rewards/{rewardId}/assignments/`.",
        "allOf": [
          {
            "$ref": "#/components/schemas/RewardAssignment"
          }
        ]
      },
      "e_400_missing_param": {
        "description": "Error: Bad Request &rarr; Missing Parameters",
        "type": "object",
        "title": "Missing Parameters",
        "properties": {
          "code": {
            "type": "integer",
            "default": 400,
            "description": "Error's HTTP status code."
          },
          "key": {
            "type": "string",
            "default": "missing_param",
            "description": "Short string describing the kind of error which occurred."
          },
          "message": {
            "type": "string",
            "default": "Missing required parameter",
            "description": "A human-readable message providing a short description of the error."
          },
          "details": {
            "type": "string",
            "example": "Parameter 'custom_event.schema_id' is required",
            "description": "A human-readable message providing more details about the error."
          },
          "request_id": {
            "type": "string",
            "example": "v-0a96c19b1a41c03999",
            "description": "This ID is useful when troubleshooting and/or finding the root cause of an error response by our support team."
          }
        }
      },
      "RewardsAssignmentsUpdateRequestBody": {
        "title": "Rewards Assignments Update Request Body",
        "type": "object",
        "description": "Request body schema for **PUT** `v1/rewards/{rewardId}/assignments/{assignmentId}`.",
        "properties": {
          "parameters": {
            "type": "object",
            "description": "An object that defines the price of the reward in loyalty points.",
            "properties": {
              "loyalty": {
                "type": "object",
                "description": "Stores the points parameter.",
                "properties": {
                  "points": {
                    "type": "integer",
                    "description": "Defines how many points are required to obtain the reward."
                  },
                  "auto_redeem": {
                    "type": "boolean",
                    "nullable": true,
                    "description": "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`."
                  }
                }
              }
            }
          }
        }
      },
      "RewardsAssignmentsUpdateResponseBody": {
        "type": "object",
        "title": "Rewards Assignments Update Response Body",
        "description": "Response body schema for **PUT** `v1/rewards/{rewardId}/assignments/{assignmentId}`.",
        "allOf": [
          {
            "$ref": "#/components/schemas/RewardAssignment"
          }
        ]
      },
      "RewardsAssignmentsGetResponseBody": {
        "type": "object",
        "title": "Rewards Assignments Get Response Body",
        "description": "Response body schema for **GET** `v1/rewards/{rewardId}/assignments/{assignmentId}`.",
        "allOf": [
          {
            "$ref": "#/components/schemas/RewardAssignment"
          }
        ]
      },
      "ParameterLimit": {
        "type": "integer",
        "maximum": 100,
        "minimum": 1
      },
      "ParameterPage": {
        "type": "integer",
        "minimum": 1,
        "maximum": 100
      },
      "RewardsCreateRequestBodyDigital": {
        "title": "Digital Reward",
        "type": "object",
        "description": "Request body schema for creating a digital reward using **POST** `v1/rewards`.",
        "properties": {
          "name": {
            "type": "string",
            "description": "Reward name."
          },
          "parameters": {
            "$ref": "#/components/schemas/RewardsCreateRequestBodyDigitalParameters"
          },
          "metadata": {
            "type": "object",
            "description": "The metadata object stores all custom attributes assigned to the reward. A set of key/value pairs that you can attach to a reward object. It can be useful for storing additional information about the reward in a structured format."
          }
        },
        "required": [
          "parameters"
        ]
      },
      "RewardsCreateRequestBodyMaterial": {
        "title": "Material Reward",
        "type": "object",
        "description": "Request body schema to create a material reward using\n **POST** `v1/rewards`.",
        "properties": {
          "name": {
            "type": "string",
            "description": "Reward name."
          },
          "parameters": {
            "$ref": "#/components/schemas/RewardsCreateRequestBodyMaterialParameters"
          },
          "stock": {
            "type": "integer",
            "description": "The number of units of the product that you want to share as a reward. Use this parameter to code a stock-taking logic."
          },
          "attributes": {
            "type": "object",
            "description": "Attributes of a material reward.",
            "properties": {
              "image_url": {
                "type": "string",
                "description": "HTTPS URL pointing to a .png or .jpg file."
              },
              "description": {
                "type": "string",
                "description": "Description of a material reward."
              }
            }
          },
          "metadata": {
            "type": "object",
            "description": "The metadata object stores all custom attributes assigned to the reward. A set of key/value pairs that you can attach to a reward object. It can be useful for storing additional information about the reward in a structured format."
          }
        },
        "required": [
          "parameters"
        ]
      },
      "RewardsCreateRequestBodyPayWithPoints": {
        "title": "Pay with Points Reward",
        "type": "object",
        "description": "Request body schema for creating a pay with points reward using **POST** `v1/rewards`.",
        "properties": {
          "name": {
            "type": "string",
            "description": "Reward name."
          },
          "parameters": {
            "$ref": "#/components/schemas/RewardsCreateRequestBodyPayWithPointsParameters"
          },
          "metadata": {
            "type": "object",
            "description": "The metadata object stores all custom attributes assigned to the reward. A set of key/value pairs that you can attach to a reward object. It can be useful for storing additional information about the reward in a structured format."
          }
        },
        "required": [
          "parameters"
        ]
      },
      "RewardType": {
        "title": "Reward type",
        "oneOf": [
          {
            "$ref": "#/components/schemas/RewardTypeCampaign"
          },
          {
            "$ref": "#/components/schemas/RewardTypeCoin"
          },
          {
            "$ref": "#/components/schemas/RewardTypeMaterial"
          }
        ]
      },
      "RewardsUpdateRequestBodyDigital": {
        "title": "Digital Reward",
        "type": "object",
        "description": "Request body schema for updating a digital reward using **PUT** `v1/rewards/{rewardId}`.",
        "properties": {
          "name": {
            "type": "string",
            "description": "Reward name."
          },
          "parameters": {
            "$ref": "#/components/schemas/RewardsUpdateRequestBodyDigitalParameters"
          },
          "metadata": {
            "type": "object",
            "description": "The metadata object stores all custom attributes assigned to the reward. A set of key/value pairs that you can attach to a reward object. It can be useful for storing additional information about the reward in a structured format."
          }
        }
      },
      "RewardsUpdateRequestBodyMaterial": {
        "title": "Material Reward",
        "type": "object",
        "description": "Request body schema to update a material reward using **PUT** `v1/rewards/{rewardId}`.",
        "properties": {
          "name": {
            "type": "string",
            "description": "Reward name."
          },
          "parameters": {
            "$ref": "#/components/schemas/RewardsUpdateRequestBodyMaterialParameters"
          },
          "stock": {
            "type": "integer",
            "description": "The number of units of the product that you want to share as a reward.  Use this parameter to code a stock-taking logic."
          },
          "attributes": {
            "type": "object",
            "description": "Attributes of a material reward.",
            "properties": {
              "image_url": {
                "type": "string",
                "description": "HTTPS URL pointing to a .png or .jpg file."
              },
              "description": {
                "type": "string",
                "description": "Description of a material reward."
              }
            }
          },
          "metadata": {
            "type": "object",
            "description": "The metadata object stores all custom attributes assigned to the reward. A set of key/value pairs that you can attach to a reward object. It can be useful for storing additional information about the reward in a structured format."
          }
        }
      },
      "RewardsUpdateRequestBodyPayWithPoints": {
        "title": "Pay with Points Reward",
        "type": "object",
        "description": "Request body schema for updating a pay with points reward using **PUT** `v1/rewards/{rewardId}`.",
        "properties": {
          "name": {
            "type": "string",
            "description": "Reward name."
          },
          "parameters": {
            "$ref": "#/components/schemas/RewardsUpdateRequestBodyPayWithPointsParameters"
          },
          "metadata": {
            "type": "object",
            "description": "The metadata object stores all custom attributes assigned to the reward. A set of key/value pairs that you can attach to a reward object. It can be useful for storing additional information about the reward in a structured format."
          }
        }
      },
      "RewardAssignment": {
        "title": "Reward Assignment",
        "allOf": [
          {
            "$ref": "#/components/schemas/RewardAssignmentBase"
          },
          {
            "$ref": "#/components/schemas/RewardAssignmentParameters"
          }
        ],
        "type": "object"
      },
      "RewardsAssignmentsCreateDigitalOrMaterialRewardRequestBody": {
        "title": "Digital Or Material Reward",
        "description": "Request body schema for **POST** `v1/rewards/{rewardID}/assignments`.",
        "properties": {
          "campaign": {
            "type": "string",
            "description": "The campaign ID of the campaign to which the reward is to be assigned."
          },
          "parameters": {
            "type": "object",
            "description": "Defines the cost of the reward.",
            "required": [
              "loyalty"
            ],
            "properties": {
              "loyalty": {
                "type": "object",
                "description": "Defines the equivalent points value of the reward.",
                "properties": {
                  "points": {
                    "type": "integer",
                    "minimum": 1,
                    "description": "Number of points that will be subtracted from the loyalty card points balance if the reward is redeemed. Must be positive integer."
                  },
                  "auto_redeem": {
                    "type": "boolean",
                    "nullable": true,
                    "description": "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`."
                  }
                }
              }
            }
          }
        },
        "required": [
          "campaign",
          "parameters"
        ]
      },
      "RewardsAssignmentsCreateCoinRewardRequestBody": {
        "title": "Pay with Points Reward",
        "description": "Request body schema for **POST** `v1/rewards/{rewardID}/assignments`.",
        "type": "object",
        "properties": {
          "campaign": {
            "type": "string",
            "description": "The campaign ID of the campaign to which the reward is to be assigned."
          },
          "validation_rules": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        "required": [
          "campaign"
        ]
      },
      "RewardsCreateRequestBodyDigitalParameters": {
        "title": "Digital Reward",
        "type": "object",
        "description": "Configure a digital (CAMPAIGN) reward. These can be in the form of discount coupons, gift card credits, or loyalty point credits.",
        "properties": {
          "campaign": {
            "description": "Objects stores information about the campaign related to the reward.",
            "oneOf": [
              {
                "$ref": "#/components/schemas/RewardsCreateRequestBodyDigitalParametersLoyaltyProgram"
              },
              {
                "$ref": "#/components/schemas/RewardsCreateRequestBodyDigitalParametersGiftVouchers"
              },
              {
                "$ref": "#/components/schemas/RewardsCreateRequestBodyDigitalParametersDiscountCoupons"
              }
            ]
          }
        },
        "required": [
          "campaign"
        ]
      },
      "RewardsCreateRequestBodyMaterialParameters": {
        "title": "Material Reward",
        "type": "object",
        "description": "Configure parameters representing products as a (MATERIAL) reward.",
        "properties": {
          "product": {
            "type": "object",
            "description": "Define the product given as a reward.",
            "properties": {
              "id": {
                "type": "string",
                "example": "prod_0b7d7dfb05cbe5c616",
                "description": "Unique product ID, assigned by Voucherify, given as a reward."
              },
              "sku_id": {
                "type": "string",
                "nullable": true,
                "description": "Unique SKU ID, assigned by Voucherify, of the SKU given as a reward.",
                "example": "sku_0b7d7dfb090be5c619"
              }
            },
            "required": [
              "id"
            ]
          }
        },
        "required": [
          "product"
        ]
      },
      "RewardsCreateRequestBodyPayWithPointsParameters": {
        "title": "Pay with Points Reward",
        "type": "object",
        "description": "Configure parameters representing a Pay with Points (COIN) reward. ",
        "properties": {
          "coin": {
            "type": "object",
            "description": "Define the ratio by mapping the number of loyalty points in `points_ratio` to a predefined cash amount in `exchange_ratio`.",
            "properties": {
              "exchange_ratio": {
                "type": "string",
                "description": "The cash equivalent of the points defined in the `points_ratio` property."
              },
              "points_ratio": {
                "type": "string",
                "description": "The number of loyalty points that will map to the predefined cash amount defined by the `exchange_ratio` property."
              }
            },
            "required": [
              "exchange_ratio"
            ]
          }
        },
        "required": [
          "coin"
        ]
      },
      "RewardTypeCampaign": {
        "title": "Digital",
        "type": "object",
        "properties": {
          "campaign": {
            "type": "object",
            "required": [
              "id",
              "type"
            ],
            "description": "Objects stores information about the campaign related to the reward.",
            "properties": {
              "id": {
                "type": "string",
                "description": "Unique campaign ID, assigned by Voucherify."
              },
              "balance": {
                "type": "integer",
                "description": "The number of points to be added to a loyalty card or the amount to be added to the current balance on the gift card.\n\nFor gift cards, the value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000."
              },
              "type": {
                "type": "string",
                "enum": [
                  "DISCOUNT_COUPONS",
                  "GIFT_VOUCHERS",
                  "LOYALTY_PROGRAM"
                ],
                "description": "Campaign type."
              }
            }
          }
        },
        "required": [
          "campaign"
        ]
      },
      "RewardTypeCoin": {
        "title": "Pay with Points",
        "type": "object",
        "properties": {
          "coin": {
            "type": "object",
            "required": [
              "exchange_ratio"
            ],
            "description": "Defines the ratio by mapping the number of loyalty points in points_ratio to a predefined cash amount in exchange_ratio.",
            "properties": {
              "exchange_ratio": {
                "type": "number",
                "description": "The cash equivalent of the points defined in the points_ratio property."
              },
              "points_ratio": {
                "type": "integer",
                "description": "The number of loyalty points that will map to the predefined cash amount defined by the exchange_ratio property."
              }
            }
          }
        },
        "required": [
          "coin"
        ]
      },
      "RewardTypeMaterial": {
        "title": "Material",
        "type": "object",
        "properties": {
          "product": {
            "type": "object",
            "required": [
              "id"
            ],
            "description": "Contains information about the product given as a reward.",
            "properties": {
              "id": {
                "type": "string",
                "example": "prod_0b7d7dfb05cbe5c616",
                "description": "Unique product ID, assigned by Voucherify."
              },
              "sku_id": {
                "type": "string",
                "nullable": true,
                "example": "sku_0b7d7dfb090be5c619",
                "description": "Unique SKU ID, assigned by Voucherify, of the SKU given as a reward."
              }
            }
          }
        },
        "required": [
          "product"
        ]
      },
      "RewardsUpdateRequestBodyDigitalParameters": {
        "title": "Digital Reward",
        "type": "object",
        "description": "Configure a digital (CAMPAIGN) reward. These can be in the form of discount coupons, gift card credits, or loyalty point credits.",
        "properties": {
          "campaign": {
            "description": "Objects stores information about the campaign related to the reward.",
            "oneOf": [
              {
                "$ref": "#/components/schemas/RewardsUpdateRequestBodyDigitalParametersLoyaltyProgram"
              },
              {
                "$ref": "#/components/schemas/RewardsUpdateRequestBodyDigitalParametersGiftVouchers"
              },
              {
                "$ref": "#/components/schemas/RewardsUpdateRequestBodyDigitalParametersDiscountCoupons"
              }
            ]
          }
        },
        "required": [
          "campaign"
        ]
      },
      "RewardsUpdateRequestBodyMaterialParameters": {
        "title": "Material Reward",
        "type": "object",
        "description": "Configure parameters representing products as a (MATERIAL) reward.",
        "properties": {
          "product": {
            "type": "object",
            "description": "Define the product given as a reward.",
            "properties": {
              "id": {
                "type": "string",
                "example": "prod_0b7d7dfb05cbe5c616",
                "description": "Unique product ID, assigned by Voucherify, given as a reward."
              },
              "sku_id": {
                "type": "string",
                "nullable": true,
                "description": "Unique SKU ID, assigned by Voucherify, of the SKU given as a reward.",
                "example": "sku_0b7d7dfb090be5c619"
              }
            },
            "required": [
              "id"
            ]
          }
        },
        "required": [
          "product"
        ]
      },
      "RewardsUpdateRequestBodyPayWithPointsParameters": {
        "title": "Pay with Points Reward",
        "type": "object",
        "description": "Configure parameters representing a Pay with Points (COIN) reward. ",
        "properties": {
          "coin": {
            "type": "object",
            "description": "Define the ratio by mapping the number of loyalty points in `points_ratio` to a predefined cash amount in `exchange_ratio`.",
            "properties": {
              "exchange_ratio": {
                "type": "string",
                "description": "The cash equivalent of the points defined in the `points_ratio` property."
              },
              "points_ratio": {
                "type": "string",
                "description": "The number of loyalty points that will map to the predefined cash amount defined by the `exchange_ratio` property."
              }
            },
            "required": [
              "exchange_ratio"
            ]
          }
        },
        "required": [
          "coin"
        ]
      },
      "RewardAssignmentBase": {
        "title": "Reward Assignment Base",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "example": "rewa_PbIRoMXpwe5QhobW4JKu0VjH",
            "description": "Unique reward assignment ID, assigned by Voucherify."
          },
          "reward_id": {
            "type": "string",
            "description": "Associated reward ID.",
            "example": "rew_C7wS9eHFDN4CIbXI5PpLSkGY"
          },
          "created_at": {
            "type": "string",
            "description": "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",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "nullable": true,
            "description": "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",
            "format": "date-time"
          },
          "object": {
            "type": "string",
            "description": "The type of the object represented by the JSON. This object stores information about the reward assignment.",
            "default": "reward_assignment",
            "enum": [
              "reward_assignment"
            ]
          },
          "related_object_id": {
            "type": "string",
            "description": "Related object ID to which the reward was assigned.",
            "example": "camp_wciTvaOfYmAa3EmIIW3QpXXZ"
          },
          "related_object_type": {
            "type": "string",
            "description": "Related object type to which the reward was assigned.",
            "default": "campaign",
            "enum": [
              "campaign"
            ]
          }
        },
        "required": [
          "related_object_id",
          "related_object_type",
          "id",
          "reward_id",
          "created_at",
          "updated_at",
          "object"
        ]
      },
      "RewardAssignmentParameters": {
        "title": "Digital or Material Reward - Parameters",
        "type": "object",
        "properties": {
          "parameters": {
            "description": "Defines the cost of the reward.",
            "type": "object",
            "properties": {
              "loyalty": {
                "type": "object",
                "description": "Defines the equivalent points value of the reward.",
                "properties": {
                  "points": {
                    "type": "integer",
                    "description": "The number of points required to redeem the reward."
                  },
                  "auto_redeem": {
                    "type": "boolean",
                    "nullable": true,
                    "description": "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`."
                  }
                }
              }
            },
            "required": [
              "loyalty"
            ]
          }
        }
      },
      "RewardsCreateRequestBodyDigitalParametersLoyaltyProgram": {
        "title": "Points on loyalty card",
        "type": "object",
        "description": "Configure a reward that adds points to a loyalty card. This type of reward is a subset of a Digital (CAMPAIGN) reward.",
        "properties": {
          "id": {
            "type": "string",
            "description": "Assign the reward to the campaign that contains the loyalty cards that will be replenished by the reward. Provide the unique campaign ID, assigned by Voucherify.",
            "example": "camp_13BbZ0kQsNinhqsX3wUts2UP"
          },
          "balance": {
            "type": "integer",
            "description": "The incremental points to be added to the current balance on the loyalty card."
          }
        },
        "required": [
          "id",
          "balance"
        ]
      },
      "RewardsCreateRequestBodyDigitalParametersGiftVouchers": {
        "title": "Gift Vouchers",
        "type": "object",
        "description": "Configure a reward that adds cash to a gift card. This type of reward is a subset of a Digital (CAMPAIGN) reward.",
        "properties": {
          "id": {
            "type": "string",
            "description": "Assign the reward to the campaign that contains the gift cards that will be replenished by the reward. Provide the unique campaign ID, assigned by Voucherify.",
            "example": "camp_13BbZ0kQsNinhqsX3wUts2UP"
          },
          "balance": {
            "type": "integer",
            "description": "The incremental amount to be added to the current balance on the gift card. The value is multiplied by 100 to represent 2 decimal places. For example `10000 cents` for `$100.00`."
          }
        },
        "required": [
          "id",
          "balance"
        ]
      },
      "RewardsCreateRequestBodyDigitalParametersDiscountCoupons": {
        "title": "Discount Coupons",
        "type": "object",
        "description": "Configure a reward that provides a discount coupon. This type of reward is a subset of a Digital (CAMPAIGN) reward.",
        "properties": {
          "id": {
            "type": "string",
            "description": "Assign the reward to the campaign that contains the vouchers that will be the source of the reward. Provide the unique campaign ID, assigned by Voucherify.",
            "example": "camp_13BbZ0kQsNinhqsX3wUts2UP"
          }
        },
        "required": [
          "id"
        ]
      },
      "RewardsUpdateRequestBodyDigitalParametersLoyaltyProgram": {
        "title": "Points on loyalty card",
        "type": "object",
        "description": "Configure a reward that adds points to a loyalty card. This type of reward is a subset of a Digital (CAMPAIGN) reward.",
        "properties": {
          "id": {
            "type": "string",
            "description": "Assign the reward to the campaign that contains the loyalty cards that will be replenished by the reward. Provide the unique campaign ID, assigned by Voucherify.",
            "example": "camp_13BbZ0kQsNinhqsX3wUts2UP"
          },
          "balance": {
            "type": "integer",
            "description": "The incremental points to be added to the current balance on the loyalty card."
          }
        },
        "required": [
          "id",
          "balance"
        ]
      },
      "RewardsUpdateRequestBodyDigitalParametersGiftVouchers": {
        "title": "Gift Vouchers",
        "type": "object",
        "description": "Configure a reward that adds cash to a gift card. This type of reward is a subset of a Digital (CAMPAIGN) reward.",
        "properties": {
          "id": {
            "type": "string",
            "description": "Assign the reward to the campaign that contains the gift cards that will be replenished by the reward. Provide the unique campaign ID, assigned by Voucherify.",
            "example": "camp_13BbZ0kQsNinhqsX3wUts2UP"
          },
          "balance": {
            "type": "integer",
            "description": "The incremental amount to be added to the current balance on the gift card. The value is multiplied by 100 to represent 2 decimal places. For example `10000 cents` for `$100.00`."
          }
        },
        "required": [
          "id",
          "balance"
        ]
      },
      "RewardsUpdateRequestBodyDigitalParametersDiscountCoupons": {
        "title": "Discount Coupons",
        "type": "object",
        "description": "Configure a reward that provides a discount coupon. This type of reward is a subset of a Digital (CAMPAIGN) reward.",
        "properties": {
          "id": {
            "type": "string",
            "description": "Assign the reward to the campaign that contains the vouchers that will be the source of the reward. Provide the unique campaign ID, assigned by Voucherify.",
            "example": "camp_13BbZ0kQsNinhqsX3wUts2UP"
          }
        },
        "required": [
          "id"
        ]
      }
    },
    "securitySchemes": {
      "X-App-Id": {
        "type": "apiKey",
        "name": "X-App-Id",
        "in": "header"
      },
      "X-App-Token": {
        "type": "apiKey",
        "name": "X-App-Token",
        "in": "header"
      },
      "X-Voucherify-OAuth": {
        "type": "oauth2",
        "flows": {
          "implicit": {
            "authorizationUrl": "https://api.voucherify.io/v1/oauth/token",
            "scopes": {
              "api": "Gives access to whole server-side API.",
              "vouchers": "Gives access to all endpoints and methods starting with `v1/vouchers`.",
              "client_api": "Gives access to whole client-side API.",
              "client_vouchers": "Gives access to all endpoints and methods starting with `/client/v1/vouchers`.",
              "promotions": "Gives access to all endpoints and methods starting with `/v1/promotions`.",
              "client_promotions": "Gives access to all endpoints and methods starting with `/client/v1/promotions`",
              "campaigns": "Gives access to all endpoints and methods starting with `v1/campaigns`.",
              "client_publish": "Gives access to all endpoints and methods starting with `/client/v1/publish`.",
              "exports": "Gives access to all endpoints and methods starting with `/v1/exports`.",
              "publications": "Gives access to all endpoints and methods starting with `/v1/publications`.",
              "client_validate": "Gives access to all endpoints and methods starting with `/client/v1/validate`.",
              "validations": "Gives access to all endpoints and methods starting with `/v1/validations`.",
              "client_validations": "Gives access to all endpoints and methods starting with `/client/v1/validations`.",
              "qualifications": "Gives access to all endpoints and methods starting with `/v1/qualifications`.",
              "client_qualifications": "Gives access to all endpoints and methods starting with `/client/v1/qualifications`.",
              "client_redeem": "Gives access to all endpoints and methods starting with `/client/v1/redeem",
              "redemptions": "Gives access to all endpoints and methods starting with `/v1/redemptions`.",
              "client_redemptions": "Gives access to all endpoints and methods starting with `/client/v1/redemptions`",
              "customers": "Gives access to all endpoints and methods starting with `/v1/customers`.",
              "client_customers": "Gives access to all endpoints and methods starting with `/client/v1/customers`.",
              "orders": "Gives access to all endpoints and methods starting with `/v1/orders`.",
              "products": "Gives access to all endpoints and methods starting with `/v1/products`.",
              "skus": "Gives access to all endpoints and methods starting with `/v1/SKUs`.",
              "validation-rules": "Gives access to all endpoints and methods starting with `/v1/validation-rules`.",
              "validation-rules-assignments": "Gives access to all endpoints and methods starting with `/v1/validation-rules-assignments",
              "segments": "Gives access to all endpoints and methods starting with `/v1/segments`.",
              "events": "Gives access to all endpoints and methods starting with `/v1/events`.",
              "client_events": "Gives access to all endpoints and methods starting with `client/v1/events`.",
              "rewards": "Gives access to all endpoints and methods starting with `/v1/rewards`.",
              "assets": "Gives access to all endpoints and methods starting with `/v1/assets`.",
              "task-results": "Gives access to all endpoints and methods starting with `/v1/task-results`.",
              "loyalties": "Gives access to all endpoints and methods starting with `/v1/loyalties`.",
              "client_consents": "Gives access to all endpoints and methods starting with `client/v1/consents`.",
              "consents": "Gives access to all endpoints and methods starting with `/v1/consents`.",
              "async-actions": "Gives access to all endpoints and methods starting with `/v1/async-actions`.",
              "product-collections": "Gives access to all endpoints and methods starting with `/v1/product-collections`.",
              "categories": "Gives access to all endpoints and methods starting with `/v1/categories`.",
              "metadata-schemas": "Gives access to all endpoints and methods starting with `/v1/metadata-schemas`.",
              "locations": "Gives access to all endpoints and methods starting with `/v1/locations`.",
              "referrals": "Gives access to all endpoints and methods starting with `/v1/referrals`.",
              "trash-bin": "Gives access to all endpoints and methods starting with `/v1/trash-bin`.",
              "templates": "Gives access to all endpoints and methods starting with `/v1/templates`."
            }
          }
        }
      }
    }
  }
}