> ## Documentation Index
> Fetch the complete documentation index at: https://docs.voucherify.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Create Reward

> Create a new reward.



## OpenAPI

````yaml /openapi/rewards.json post /v1/rewards
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
security: []
paths:
  /v1/rewards:
    post:
      tags:
        - Rewards
      summary: Create Reward
      description: Create a new reward.
      operationId: create-reward
      parameters: []
      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
      security:
        - X-App-Id: []
          X-App-Token: []
        - X-Voucherify-OAuth:
            - api
            - rewards
components:
  schemas:
    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'
    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
         **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
    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
    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
    RewardType:
      title: Reward type
      oneOf:
        - $ref: '#/components/schemas/RewardTypeCampaign'
        - $ref: '#/components/schemas/RewardTypeCoin'
        - $ref: '#/components/schemas/RewardTypeMaterial'
    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
    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.


                For 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
              description: >-
                Unique SKU ID, assigned by Voucherify, of the SKU given as a
                reward.
              example: sku_0b7d7dfb090be5c619
      required:
        - product
  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`.

````