openapi: 3.0.0
paths:
  /version:
    get:
      description: Retrieve version of API server
      operationId: AppController_getVersion
      parameters: []
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: Get version
      tags:
        - General
  /v1/accounts/campaigns/batch:
    post:
      description: >-
        <span style="background-color:#28a745; color:white; padding:2px 8px;
        border-radius:4px; font-weight:600;">Operations</span><br ><br >Add an
        account identifier to multiple campaigns.
      operationId: AccountsController_batchAdditionOfAccountToCampaigns_v1
      parameters: []
      requestBody:
        required: true
        description: Payload for adding an account to multiple campaigns.
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/BatchCreateAccountCampaignsDTO'
      responses:
        '201':
          description: Account added to campaigns successfully.
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/DataResponseDTO'
                  - properties:
                      data:
                        $ref: '#/components/schemas/BatchCreateAccountCampaignsEntity'
        '400':
          description: >-
            The request could not be processed due to invalid or missing
            parameters, or issues with the request body.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
              example:
                error:
                  reasonCode: validation_error
                  description: >-
                    The request could not be processed due to invalid or missing
                    parameters, or issues with the request body.
                  details:
                    - property: fieldA
                      message: >-
                        Must be between 1 and 35 characters and must not contain
                        any invalid characters
                    - property: items.2.fieldB
                      message: >-
                        Must be between 1 and 35 characters and must not contain
                        any invalid characters
                requestId: 064afbca-5c14-4e27-a92b-b1f76a6d14d3
        '401':
          description: Access to the requested resource is unauthorized.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
        '409':
          description: >-
            A conflict occurred while attempting to fulfill your request. The
            resource you are trying to create already exists.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
      security:
        - bearer: []
      summary: Add an account identifier to multiple campaigns
      tags:
        - Accounts
  /v1/accounts/retrieve:
    post:
      description: >-
        <span style="background-color:#28a745; color:white; padding:2px 8px;
        border-radius:4px; font-weight:600;">Operations</span><br ><br >Retrieve
        account details for all or one campaigns.
      operationId: AccountsController_retrieveAccountDetails_v1
      parameters:
        - name: offset
          required: false
          in: query
          description: >-
            The number of records to skip before selecting records. Defaults to
            0.
          schema: {}
        - name: limit
          required: false
          in: query
          description: >-
            The maximum number of records to return. Value must be in the range
            0 - 100. Defaults to 10. 
          schema: {}
        - name: campaignId
          required: false
          in: query
          description: Campaign ID
          schema: {}
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RetrieveAccountDTO'
      responses:
        '200':
          description: All account details retrieved successfully.
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/PaginatedDataResponseDTO'
                  - properties:
                      data:
                        $ref: '#/components/schemas/AccountDetailsEntity'
        '400':
          description: >-
            The request could not be processed due to invalid or missing
            parameters, or issues with the request body.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
              example:
                error:
                  reasonCode: validation_error
                  description: >-
                    The request could not be processed due to invalid or missing
                    parameters, or issues with the request body.
                  details:
                    - property: fieldA
                      message: >-
                        Must be between 1 and 35 characters and must not contain
                        any invalid characters
                    - property: items.2.fieldB
                      message: >-
                        Must be between 1 and 35 characters and must not contain
                        any invalid characters
                requestId: 064afbca-5c14-4e27-a92b-b1f76a6d14d3
        '401':
          description: Access to the requested resource is unauthorized.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
        '404':
          description: The requested account could not be found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
        '501':
          description: >-
            The request could not be processed due to functionality not
            implemented.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
      security:
        - bearer: []
      summary: List account details for all or one campaigns
      tags:
        - Accounts
  /v1/campaigns/accounts/actions:
    get:
      description: >-
        <span style="background-color:#28a745; color:white; padding:2px 8px;
        border-radius:4px; font-weight:600;">Operations</span><br ><br >Retrieve
        all actions
      operationId: AccountActionsController_getAllActions_v1
      parameters:
        - name: campaignId
          required: false
          in: query
          description: The identifier of the campaign
          schema:
            example: f39854be-46f2-492f-9dd8-042e5719f05f
            type: string
        - name: status
          required: false
          in: query
          description: >-
            Indicates the current status of the evaluation process, with
            detailed reasons available in the 'evaluationReason' field. Possible
            values include:
              
            - **PENDING**: The evaluation has started and the system is still
            processing the necessary rules and actions.

            - **PROCESSED**: The evaluation has been successfully completed, and
            the outcome is finalized.

            - **FAILED**: The evaluation could not be completed due to an error
            or issue.
          schema:
            example: PENDING
            type: string
            enum:
              - PROCESSED
              - FAILED
              - PENDING
        - name: evaluationReason
          required: false
          in: query
          description: >-
            The reason for the evaluation result. Possible values include:


            **PROCESSED:**

            - **null**: The evaluation was successful and points were allotted.

            - **RULES_NOT_FOUND**: The evaluation was processed but no rules
            were found to evaluate against.

            - **INVALID_ACTION**: The evaluation was processed but the action
            did not meet any criteria. No points were allotted.

            - **MAX_TRIES_HIT**: The evaluation was processed but the maximum
            number of allowed attempts for the specified participant was
            reached. No points were allotted.

            - **NO_VALID_OUTCOMES**: The evaluation was processed but none of
            the conditions resulted in a valid outcome. No points were allotted.


            **FAILED:**

            - **OBJECTIVE_NOT_FOUND**: The evaluation failed because objective
            could not be found using the provided objectiveId.

            - **RULES_PARSING_ERROR**: The evaluation failed because the
            campaign's rule was missing a ruleId, preventing proper parsing.

            - **INVALID_ACTION**: The evaluation failed as the campaign's rule
            has undefined points and objectiveId.

            - **ERROR_OCCURRED**: The evaluation failed due to an unexpected
            error.
          schema:
            nullable: true
            example: MAX_TRIES_HIT
            type: string
            enum:
              - RULES_NOT_FOUND
              - OBJECTIVE_NOT_FOUND
              - RULES_PARSING_ERROR
              - INVALID_ACTION
              - MAX_TRIES_HIT
              - NO_VALID_OUTCOMES
              - ERROR_OCCURRED
              - null
        - name: fromDate
          required: false
          in: query
          description: >-
            The start date and time for filtering actions by their creation
            timestamp. Only actions created on or after this date will be
            included in the results.
          schema:
            example: '2023-11-23T00:00:00+08:00'
            type: string
        - name: toDate
          required: false
          in: query
          description: >-
            The end date and time for filtering actions by their creation
            timestamp. Only actions created before or on this date will be
            included in the results.
          schema:
            example: '2023-11-23T23:59:59+08:00'
            type: string
        - name: offset
          required: false
          in: query
          description: >-
            The number of records to skip before selecting records. Defaults to
            0.
          schema: {}
        - name: limit
          required: false
          in: query
          description: >-
            The maximum number of records to return. Value must be in the range
            0 - 100. Defaults to 10. 
          schema: {}
      responses:
        '200':
          description: All actions retrieved successfully.
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/PaginatedDataResponseDTO'
                  - properties:
                      data:
                        type: array
                        items:
                          $ref: >-
                            #/components/schemas/AccountActionWithIdentifierEntity
        '401':
          description: Access to the requested resource is unauthorized.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
      security:
        - bearer: []
      summary: Retrieve all actions
      tags:
        - Account Actions
  /v1/campaigns/{campaignId}/accounts/actions:
    post:
      description: >-
        <span style="background-color:#28a745; color:white; padding:2px 8px;
        border-radius:4px; font-weight:600;">Operations</span><br ><br >Register
        action for an account in a campaign.
      operationId: AccountActionsController_registerAction_v1
      parameters:
        - name: campaignId
          required: true
          in: path
          description: Campaign ID
          schema: {}
        - name: x-idempotency-key
          in: header
          description: >-
            Idempotency Key. Must be a valid uuid. Refer to the section
            "Idempotency" for more information.
          required: true
          schema:
            type: string
      requestBody:
        required: true
        description: Payload for registering action for an account in a campaign.
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RegisterActionDTO'
      responses:
        '201':
          description: Action registered successfully.
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/DataResponseDTO'
                  - properties:
                      data:
                        $ref: '#/components/schemas/AccountActionWithIdentifierEntity'
        '400':
          description: >-
            The request could not be processed due to invalid or missing
            parameters, or issues with the request body.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
              example:
                error:
                  reasonCode: validation_error
                  description: >-
                    The request could not be processed due to invalid or missing
                    parameters, or issues with the request body.
                  details:
                    - property: fieldA
                      message: >-
                        Must be between 1 and 35 characters and must not contain
                        any invalid characters
                    - property: items.2.fieldB
                      message: >-
                        Must be between 1 and 35 characters and must not contain
                        any invalid characters
                requestId: 064afbca-5c14-4e27-a92b-b1f76a6d14d3
        '401':
          description: Access to the requested resource is unauthorized.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
        '404':
          description: The requested campaign could not be found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
        '501':
          description: >-
            The request could not be processed due to functionality not
            implemented.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
      security:
        - bearer: []
      summary: Register action
      tags:
        - Account Actions
  /v1/campaigns/{campaignId}/accounts/actions/register/batch:
    post:
      description: >-
        <span style="background-color:#28a745; color:white; padding:2px 8px;
        border-radius:4px; font-weight:600;">Operations</span><br ><br >Register
        actions in a campaign.
      operationId: AccountActionsController_batchRegisterActions_v1
      parameters:
        - name: campaignId
          required: true
          in: path
          description: Campaign ID
          schema: {}
        - name: x-idempotency-key
          in: header
          description: >-
            Idempotency Key. Must be a valid uuid. Refer to the section
            "Idempotency" for more information.
          required: true
          schema:
            type: string
      requestBody:
        required: true
        description: Payload for registering actions in a campaign.
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/BatchRegisterActionsDTO'
      responses:
        '201':
          description: Actions processed.
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/DataResponseDTO'
                  - properties:
                      data:
                        $ref: >-
                          #/components/schemas/BatchAccountActionWithIdentifierEntity
        '400':
          description: >-
            The request could not be processed due to invalid or missing
            parameters, or issues with the request body.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
              example:
                error:
                  reasonCode: validation_error
                  description: >-
                    The request could not be processed due to invalid or missing
                    parameters, or issues with the request body.
                  details:
                    - property: fieldA
                      message: >-
                        Must be between 1 and 35 characters and must not contain
                        any invalid characters
                    - property: items.2.fieldB
                      message: >-
                        Must be between 1 and 35 characters and must not contain
                        any invalid characters
                requestId: 064afbca-5c14-4e27-a92b-b1f76a6d14d3
        '401':
          description: Access to the requested resource is unauthorized.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
        '404':
          description: The requested campaign could not be found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
      security:
        - bearer: []
      summary: Register actions
      tags:
        - Account Actions
      x-feature-flag: enable_batch_action_register
  /v1/campaigns/{campaignId}/accounts/actions/retrieve:
    post:
      description: >-
        <span style="background-color:#28a745; color:white; padding:2px 8px;
        border-radius:4px; font-weight:600;">Operations</span><br ><br >Retrieve
        account actions for specific campaign.
      operationId: AccountActionsController_listActions_v1
      parameters:
        - name: includeAdditionalDetails
          required: false
          in: query
          description: >-
            To indicate if additional details should be fetched and included in
            the response. If set to true, the response will include the related
            objectives and transactions under the accountObjectives field.
            Defaults to false.
          schema:
            default: false
            type: boolean
        - name: offset
          required: false
          in: query
          description: >-
            The number of records to skip before selecting records. Defaults to
            0.
          schema: {}
        - name: limit
          required: false
          in: query
          description: >-
            The maximum number of records to return. Value must be in the range
            0 - 100. Defaults to 10. 
          schema: {}
        - name: campaignId
          required: true
          in: path
          description: Campaign ID
          schema: {}
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RetrieveAccountDTO'
      responses:
        '200':
          description: Account actions history retrieved successfully.
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/PaginatedDataResponseDTO'
                  - properties:
                      data:
                        $ref: '#/components/schemas/AccountActionsEntity'
        '400':
          description: >-
            The request could not be processed due to invalid or missing
            parameters, or issues with the request body.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
              example:
                error:
                  reasonCode: validation_error
                  description: >-
                    The request could not be processed due to invalid or missing
                    parameters, or issues with the request body.
                  details:
                    - property: fieldA
                      message: >-
                        Must be between 1 and 35 characters and must not contain
                        any invalid characters
                    - property: items.2.fieldB
                      message: >-
                        Must be between 1 and 35 characters and must not contain
                        any invalid characters
                requestId: 064afbca-5c14-4e27-a92b-b1f76a6d14d3
        '401':
          description: Access to the requested resource is unauthorized.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
        '404':
          description: The requested campaign could not be found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
        '501':
          description: >-
            The request could not be processed due to functionality not
            implemented.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
      security:
        - bearer: []
      summary: List account actions for specific campaign
      tags:
        - Account Actions
  /v1/campaigns/{campaignId}/accounts/actions/{externalReferenceId}:
    get:
      description: >-
        <span style="background-color:#28a745; color:white; padding:2px 8px;
        border-radius:4px; font-weight:600;">Operations</span><br ><br >Retrieve
        actions with their associated objectives
      operationId: AccountActionsController_getActionByRefId_v1
      parameters:
        - name: externalReferenceId
          required: true
          in: path
          schema:
            type: string
        - name: campaignId
          required: true
          in: path
          description: Campaign ID
          schema: {}
      responses:
        '200':
          description: Actions details retrieved successfully.
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/DataResponseDTO'
                  - properties:
                      data:
                        $ref: >-
                          #/components/schemas/AccountActionWithObjectivesAndIdentifierEntity
        '401':
          description: Access to the requested resource is unauthorized.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
        '404':
          description: The requested campaign could not be found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
      security:
        - bearer: []
      summary: Get actions details by external reference Id
      tags:
        - Account Actions
  /v1/campaigns/{campaignId}/accounts/objectives/retrieve:
    post:
      description: >-
        <span style="background-color:#28a745; color:white; padding:2px 8px;
        border-radius:4px; font-weight:600;">Operations</span><br ><br >List all
        completed objectives for an account by campaign.
      operationId: AccountObjectivesController_listCompletedObjectives_v1
      parameters:
        - name: offset
          required: false
          in: query
          description: >-
            The number of records to skip before selecting records. Defaults to
            0.
          schema: {}
        - name: limit
          required: false
          in: query
          description: >-
            The maximum number of records to return. Value must be in the range
            0 - 100. Defaults to 10. 
          schema: {}
        - name: campaignId
          required: true
          in: path
          description: Campaign ID
          schema: {}
      requestBody:
        required: true
        description: >-
          Payload for retrieving all completed objective for an account by
          campaign.
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RetrieveAccountDTO'
      responses:
        '200':
          description: All completed objectives retrieved successfully.
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/PaginatedDataResponseDTO'
                  - properties:
                      data:
                        $ref: >-
                          #/components/schemas/AccountObjectivesWithPointsAndActionsEntity
        '400':
          description: >-
            The request could not be processed due to invalid or missing
            parameters, or issues with the request body.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
              example:
                error:
                  reasonCode: validation_error
                  description: >-
                    The request could not be processed due to invalid or missing
                    parameters, or issues with the request body.
                  details:
                    - property: fieldA
                      message: >-
                        Must be between 1 and 35 characters and must not contain
                        any invalid characters
                    - property: items.2.fieldB
                      message: >-
                        Must be between 1 and 35 characters and must not contain
                        any invalid characters
                requestId: 064afbca-5c14-4e27-a92b-b1f76a6d14d3
        '401':
          description: Access to the requested resource is unauthorized.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
        '404':
          description: The requested campaign could not be found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
      security:
        - bearer: []
      summary: List all completed objective
      tags:
        - Account Objectives
  /v1/campaigns/{campaignId}/accounts/transactions/retrieve:
    post:
      description: >-
        <span style="background-color:#28a745; color:white; padding:2px 8px;
        border-radius:4px; font-weight:600;">Operations</span><br ><br >Retrieve
        account transactions for specific campaign.
      operationId: AccountTransactionsController_retrieveAccountTransactionHistory_v1
      parameters:
        - name: type
          required: false
          in: query
          description: The type of transaction
          schema:
            example: ALLOT
            type: string
            enum:
              - ALLOT
              - REDEEM
              - EXPIRE
              - TRANSFER_IN
              - TRANSFER_OUT
              - DEDUCT
        - name: offset
          required: false
          in: query
          description: >-
            The number of records to skip before selecting records. Defaults to
            0.
          schema: {}
        - name: limit
          required: false
          in: query
          description: >-
            The maximum number of records to return. Value must be in the range
            0 - 100. Defaults to 10. 
          schema: {}
        - name: campaignId
          required: true
          in: path
          description: Campaign ID
          schema: {}
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RetrieveAccountDTO'
      responses:
        '200':
          description: Account transaction history retrieved successfully.
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/PaginatedDataResponseDTO'
                  - properties:
                      data:
                        $ref: '#/components/schemas/AccountTransactionsEntity'
        '400':
          description: >-
            The request could not be processed due to invalid or missing
            parameters, or issues with the request body.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
              example:
                error:
                  reasonCode: validation_error
                  description: >-
                    The request could not be processed due to invalid or missing
                    parameters, or issues with the request body.
                  details:
                    - property: fieldA
                      message: >-
                        Must be between 1 and 35 characters and must not contain
                        any invalid characters
                    - property: items.2.fieldB
                      message: >-
                        Must be between 1 and 35 characters and must not contain
                        any invalid characters
                requestId: 064afbca-5c14-4e27-a92b-b1f76a6d14d3
        '401':
          description: Access to the requested resource is unauthorized.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
        '404':
          description: The requested account could not be found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
        '501':
          description: >-
            The request could not be processed due to functionality not
            implemented.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
      security:
        - bearer: []
      summary: List account transactions for specific campaign
      tags:
        - Account Transactions
  /v1/campaigns/{campaignId}/accounts/transactions-actions/retrieve:
    post:
      description: >-
        <span style="background-color:#28a745; color:white; padding:2px 8px;
        border-radius:4px; font-weight:600;">Operations</span><br ><br >Retrieve
        account transactions actions for specific campaign.
      operationId: AccountTransactionsController_retrieveTransactionsActions_v1
      parameters:
        - name: type
          required: false
          in: query
          description: The type of transaction
          schema:
            example: ALLOT
            type: string
            enum:
              - ALLOT
              - REDEEM
              - EXPIRE
              - TRANSFER_IN
              - TRANSFER_OUT
              - DEDUCT
        - name: fromDate
          required: false
          in: query
          description: >-
            The start date and time for filtering transactions or actions by
            their creation timestamp. Only transactions or actions created on or
            after this date will be included in the results.
          schema:
            example: '2023-11-23T00:00:00+08:00'
            type: string
        - name: toDate
          required: false
          in: query
          description: >-
            The end date and time for filtering transactions or actions by their
            creation timestamp. Only transactions or actions created before or
            on this date will be included in the results.
          schema:
            example: '2023-11-23T23:59:59+08:00'
            type: string
        - name: offset
          required: false
          in: query
          description: >-
            The number of records to skip before selecting records. Defaults to
            0.
          schema: {}
        - name: limit
          required: false
          in: query
          description: >-
            The maximum number of records to return. Value must be in the range
            0 - 100. Defaults to 10. 
          schema: {}
        - name: campaignId
          required: true
          in: path
          description: Campaign ID
          schema: {}
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RetrieveAccountDTO'
      responses:
        '200':
          description: Account transactions and actions retrieved successfully.
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/PaginatedDataResponseDTO'
                  - properties:
                      data:
                        $ref: '#/components/schemas/TransactionsActionsEntity'
        '400':
          description: >-
            The request could not be processed due to invalid or missing
            parameters, or issues with the request body.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
              example:
                error:
                  reasonCode: validation_error
                  description: >-
                    The request could not be processed due to invalid or missing
                    parameters, or issues with the request body.
                  details:
                    - property: fieldA
                      message: >-
                        Must be between 1 and 35 characters and must not contain
                        any invalid characters
                    - property: items.2.fieldB
                      message: >-
                        Must be between 1 and 35 characters and must not contain
                        any invalid characters
                requestId: 064afbca-5c14-4e27-a92b-b1f76a6d14d3
        '401':
          description: Access to the requested resource is unauthorized.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
        '404':
          description: The requested account could not be found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
      security:
        - bearer: []
      summary: List account transactions actions for specific campaign
      tags:
        - Account Transactions
  /v1/campaigns/{campaignId}/actions/providers:
    post:
      description: >-
        <span style="background-color:#007bff; color:white; padding:2px 8px;
        border-radius:4px; font-weight:600;">Management</span><br ><br >Add an
        action provider
      operationId: ActionProviderController_addActionProvider_v1
      parameters:
        - name: campaignId
          required: true
          in: path
          description: Campaign ID
          schema: {}
      requestBody:
        required: true
        description: Payload for adding an action provider
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AddActionProviderDTO'
      responses:
        '201':
          description: Action provider added successfully
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/DataResponseDTO'
                  - properties:
                      data:
                        $ref: '#/components/schemas/ActionProviderEntity'
        '400':
          description: >-
            The request could not be processed due to invalid or missing
            parameters, or issues with the request body.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
              example:
                error:
                  reasonCode: validation_error
                  description: >-
                    The request could not be processed due to invalid or missing
                    parameters, or issues with the request body.
                  details:
                    - property: fieldA
                      message: >-
                        Must be between 1 and 35 characters and must not contain
                        any invalid characters
                    - property: items.2.fieldB
                      message: >-
                        Must be between 1 and 35 characters and must not contain
                        any invalid characters
                requestId: 064afbca-5c14-4e27-a92b-b1f76a6d14d3
        '401':
          description: Access to the requested resource is unauthorized.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
        '404':
          description: The requested campaign could not be found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
        '409':
          description: >-
            A conflict occurred while attempting to fulfill your request. The
            resource you are trying to create already exists.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
      security:
        - bearer: []
      summary: Add an action provider
      tags:
        - Action Providers
    get:
      description: >-
        <span style="background-color:#007bff; color:white; padding:2px 8px;
        border-radius:4px; font-weight:600;">Management</span><br ><br >Retrieve
        all action providers for a campaign.
      operationId: ActionProviderController_listActionProviders_v1
      parameters:
        - name: offset
          required: false
          in: query
          description: >-
            The number of records to skip before selecting records. Defaults to
            0.
          schema: {}
        - name: limit
          required: false
          in: query
          description: >-
            The maximum number of records to return. Value must be in the range
            0 - 100. Defaults to 10. 
          schema: {}
        - name: campaignId
          required: true
          in: path
          description: Campaign ID
          schema: {}
      responses:
        '200':
          description: All action providers retrieved successfully.
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/PaginatedDataResponseDTO'
                  - properties:
                      data:
                        type: array
                        items:
                          $ref: '#/components/schemas/ActionProviderEntity'
        '400':
          description: >-
            The request could not be processed due to invalid or missing
            parameters, or issues with the request body.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
              example:
                error:
                  reasonCode: validation_error
                  description: >-
                    The request could not be processed due to invalid or missing
                    parameters, or issues with the request body.
                  details:
                    - property: fieldA
                      message: >-
                        Must be between 1 and 35 characters and must not contain
                        any invalid characters
                    - property: items.2.fieldB
                      message: >-
                        Must be between 1 and 35 characters and must not contain
                        any invalid characters
                requestId: 064afbca-5c14-4e27-a92b-b1f76a6d14d3
        '401':
          description: Access to the requested resource is unauthorized.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
        '404':
          description: The requested campaign could not be found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
      security:
        - bearer: []
      summary: List all action providers for a campaign
      tags:
        - Action Providers
  /v1/campaigns/{campaignId}/actions/providers/{providerId}:
    patch:
      description: >-
        <span style="background-color:#007bff; color:white; padding:2px 8px;
        border-radius:4px; font-weight:600;">Management</span><br ><br >Update
        action provider for a campaign.
      operationId: ActionProviderController_updateActionProvider_v1
      parameters:
        - name: providerId
          required: true
          in: path
          description: Action Provider ID
          schema: {}
        - name: campaignId
          required: true
          in: path
          description: Campaign ID
          schema: {}
      requestBody:
        required: true
        description: >-
          Payload for updating an action provider for a campaign. Available
          fields for update: description, providerConfig
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateActionProviderDTO'
      responses:
        '200':
          description: Action provider updated successfully.
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/DataResponseDTO'
                  - properties:
                      data:
                        $ref: '#/components/schemas/ActionProviderEntity'
        '400':
          description: >-
            The request could not be processed due to invalid or missing
            parameters, or issues with the request body.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
              example:
                error:
                  reasonCode: validation_error
                  description: >-
                    The request could not be processed due to invalid or missing
                    parameters, or issues with the request body.
                  details:
                    - property: fieldA
                      message: >-
                        Must be between 1 and 35 characters and must not contain
                        any invalid characters
                    - property: items.2.fieldB
                      message: >-
                        Must be between 1 and 35 characters and must not contain
                        any invalid characters
                requestId: 064afbca-5c14-4e27-a92b-b1f76a6d14d3
        '401':
          description: Access to the requested resource is unauthorized.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
        '404':
          description: The requested campaign could not be found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
      security:
        - bearer: []
      summary: Update action provider
      tags:
        - Action Providers
  /v1/campaigns:
    post:
      description: >-
        <span style="background-color:#007bff; color:white; padding:2px 8px;
        border-radius:4px; font-weight:600;">Management</span><br ><br >Create a
        new campaign for a tenant.
      operationId: CampaignsController_createCampaign_v1
      parameters: []
      requestBody:
        required: true
        description: Payload for creating a campaign.
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateCampaignDTO'
      responses:
        '201':
          description: Campaign created successfully.
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/DataResponseDTO'
                  - properties:
                      data:
                        $ref: '#/components/schemas/CampaignsEntity'
        '400':
          description: >-
            The request could not be processed due to invalid or missing
            parameters, or issues with the request body.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
              example:
                error:
                  reasonCode: validation_error
                  description: >-
                    The request could not be processed due to invalid or missing
                    parameters, or issues with the request body.
                  details:
                    - property: fieldA
                      message: >-
                        Must be between 1 and 35 characters and must not contain
                        any invalid characters
                    - property: items.2.fieldB
                      message: >-
                        Must be between 1 and 35 characters and must not contain
                        any invalid characters
                requestId: 064afbca-5c14-4e27-a92b-b1f76a6d14d3
        '401':
          description: Access to the requested resource is unauthorized.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
        '409':
          description: >-
            A conflict occurred while attempting to fulfill your request. The
            resource you are trying to create already exists.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
      security:
        - bearer: []
      summary: Create campaign
      tags:
        - Campaigns
    get:
      description: >-
        <span style="background-color:#007bff; color:white; padding:2px 8px;
        border-radius:4px; font-weight:600;">Management</span><br ><br >Retrieve
        details for all campaigns associated to a specific tenant.
      operationId: CampaignsController_listCampaigns_v1
      parameters:
        - name: offset
          required: false
          in: query
          description: >-
            The number of records to skip before selecting records. Defaults to
            0.
          schema: {}
        - name: limit
          required: false
          in: query
          description: >-
            The maximum number of records to return. Value must be in the range
            0 - 100. Defaults to 10. 
          schema: {}
      responses:
        '200':
          description: All campaigns details retrieved successfully.
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/PaginatedDataResponseDTO'
                  - properties:
                      data:
                        type: array
                        items:
                          $ref: '#/components/schemas/CampaignsEntity'
        '401':
          description: Access to the requested resource is unauthorized.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
      security:
        - bearer: []
      summary: List all campaigns
      tags:
        - Campaigns
  /v1/campaigns/{campaignId}:
    get:
      description: >-
        <span style="background-color:#007bff; color:white; padding:2px 8px;
        border-radius:4px; font-weight:600;">Management</span><br ><br >Retrieve
        details for a specific campaign
      operationId: CampaignsController_getCampaignById_v1
      parameters:
        - name: campaignId
          required: true
          in: path
          description: Campaign ID
          schema: {}
      responses:
        '200':
          description: Campaign details retrieved successfully.
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/DataResponseDTO'
                  - properties:
                      data:
                        $ref: '#/components/schemas/CampaignsEntity'
        '401':
          description: Access to the requested resource is unauthorized.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
        '404':
          description: The requested campaign could not be found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
      security:
        - bearer: []
      summary: Get campaign details
      tags:
        - Campaigns
    patch:
      description: >-
        <span style="background-color:#007bff; color:white; padding:2px 8px;
        border-radius:4px; font-weight:600;">Management</span><br ><br >Update
        an existing campaign for a tenant.
      operationId: CampaignsController_updateCampaign_v1
      parameters:
        - name: campaignId
          required: true
          in: path
          description: Campaign ID
          schema: {}
      requestBody:
        required: true
        description: >-
          Payload for updating a campaign. Either name or description should be
          provided.
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateCampaignDTO'
      responses:
        '200':
          description: Campaign updated successfully.
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/DataResponseDTO'
                  - properties:
                      data:
                        $ref: '#/components/schemas/CampaignsEntity'
        '400':
          description: >-
            The request could not be processed due to invalid or missing
            parameters, or issues with the request body.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
              example:
                error:
                  reasonCode: validation_error
                  description: >-
                    The request could not be processed due to invalid or missing
                    parameters, or issues with the request body.
                  details:
                    - property: fieldA
                      message: >-
                        Must be between 1 and 35 characters and must not contain
                        any invalid characters
                    - property: items.2.fieldB
                      message: >-
                        Must be between 1 and 35 characters and must not contain
                        any invalid characters
                requestId: 064afbca-5c14-4e27-a92b-b1f76a6d14d3
        '401':
          description: Access to the requested resource is unauthorized.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
        '404':
          description: The requested campaign could not be found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
      security:
        - bearer: []
      summary: Update campaign
      tags:
        - Campaigns
  /v1/campaigns/{campaignId}/accounts:
    post:
      description: >-
        <span style="background-color:#28a745; color:white; padding:2px 8px;
        border-radius:4px; font-weight:600;">Operations</span><br ><br >Create
        an account for a specified campaign. The account created will
        automatically be whitelisted for the campaign.
      operationId: CampaignsController_addAccountToCampaign_v1
      parameters:
        - name: campaignId
          required: true
          in: path
          description: Campaign ID
          schema: {}
      requestBody:
        required: true
        description: Payload for creating an account for a specified campaign.
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateAccountDTO'
      responses:
        '201':
          description: Account created and whitelisted successfully.
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/DataResponseDTO'
                  - properties:
                      data:
                        $ref: '#/components/schemas/AccountDetailsEntity'
        '400':
          description: >-
            The request could not be processed due to invalid or missing
            parameters, or issues with the request body.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
              example:
                error:
                  reasonCode: validation_error
                  description: >-
                    The request could not be processed due to invalid or missing
                    parameters, or issues with the request body.
                  details:
                    - property: fieldA
                      message: >-
                        Must be between 1 and 35 characters and must not contain
                        any invalid characters
                    - property: items.2.fieldB
                      message: >-
                        Must be between 1 and 35 characters and must not contain
                        any invalid characters
                requestId: 064afbca-5c14-4e27-a92b-b1f76a6d14d3
        '401':
          description: Access to the requested resource is unauthorized.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
        '404':
          description: The requested campaign could not be found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
        '409':
          description: >-
            A conflict occurred while attempting to fulfill your request. The
            resource you are trying to create already exists.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
        '501':
          description: >-
            The request could not be processed due to functionality not
            implemented.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
      security:
        - bearer: []
      summary: Create an account for a specified campaign
      tags:
        - Campaigns
    patch:
      description: >-
        <span style="background-color:#28a745; color:white; padding:2px 8px;
        border-radius:4px; font-weight:600;">Operations</span><br ><br >Update
        an account for a specified campaign. Currently only the account metadata
        can be updated.
      operationId: CampaignsController_updateCampaignAccount_v1
      parameters:
        - name: campaignId
          required: true
          in: path
          description: Campaign ID
          schema: {}
      requestBody:
        required: true
        description: Payload for updating an account for a specified campaign.
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateAccountDTO'
      responses:
        '200':
          description: Account updated successfully.
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/DataResponseDTO'
                  - properties:
                      data:
                        $ref: '#/components/schemas/AccountDetailsEntity'
        '400':
          description: >-
            The request could not be processed due to invalid or missing
            parameters, or issues with the request body.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
              example:
                error:
                  reasonCode: validation_error
                  description: >-
                    The request could not be processed due to invalid or missing
                    parameters, or issues with the request body.
                  details:
                    - property: fieldA
                      message: >-
                        Must be between 1 and 35 characters and must not contain
                        any invalid characters
                    - property: items.2.fieldB
                      message: >-
                        Must be between 1 and 35 characters and must not contain
                        any invalid characters
                requestId: 064afbca-5c14-4e27-a92b-b1f76a6d14d3
        '401':
          description: Access to the requested resource is unauthorized.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
        '404':
          description: The requested account could not be found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
      security:
        - bearer: []
      summary: Update an account for a specified campaign
      tags:
        - Campaigns
    get:
      description: Retrieve all accounts for a specific campaign.
      operationId: CampaignsController_listAccountsInCampaign_v1
      parameters:
        - name: q
          required: false
          in: query
          description: Search via query string
          schema:
            type: string
        - name: isActive
          required: false
          in: query
          description: Filter accounts by active status
          schema:
            type: boolean
        - name: offset
          required: false
          in: query
          description: >-
            The number of records to skip before selecting records. Defaults to
            0.
          schema: {}
        - name: limit
          required: false
          in: query
          description: >-
            The maximum number of records to return. Value must be in the range
            0 - 100. Defaults to 10. 
          schema: {}
        - name: campaignId
          required: true
          in: path
          description: Campaign ID
          schema: {}
      responses:
        '200':
          description: >-
            <span style="background-color:#007bff; color:white; padding:2px 8px;
            border-radius:4px; font-weight:600;">Management</span><br ><br
            >Retrieve all accounts successfully.
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/PaginatedDataResponseDTO'
                  - properties:
                      data:
                        type: array
                        items:
                          $ref: '#/components/schemas/AccountEntity'
        '401':
          description: Access to the requested resource is unauthorized.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
        '404':
          description: The requested campaign could not be found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
      security:
        - bearer: []
      summary: List all accounts in a campaign
      tags:
        - Campaigns
  /v1/campaigns/{campaignId}/accounts/batch:
    post:
      description: >-
        <span style="background-color:#28a745; color:white; padding:2px 8px;
        border-radius:4px; font-weight:600;">Operations</span><br ><br >Create a
        list of accounts for a specified campaign. The accounts created will
        automatically be whitelisted for the campaign.
      operationId: CampaignsController_addAccountsToCampaign_v1
      parameters:
        - name: campaignId
          required: true
          in: path
          description: Campaign ID
          schema: {}
      requestBody:
        required: true
        description: Payload for creating accounts for a specified campaign.
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/BatchCreateCampaignAccountsDTO'
      responses:
        '201':
          description: Accounts created and whitelisted successfully.
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/DataResponseDTO'
                  - properties:
                      data:
                        $ref: '#/components/schemas/BatchCreateCampaignAccountsEntity'
        '400':
          description: >-
            The request could not be processed due to invalid or missing
            parameters, or issues with the request body.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
              example:
                error:
                  reasonCode: validation_error
                  description: >-
                    The request could not be processed due to invalid or missing
                    parameters, or issues with the request body.
                  details:
                    - property: fieldA
                      message: >-
                        Must be between 1 and 35 characters and must not contain
                        any invalid characters
                    - property: items.2.fieldB
                      message: >-
                        Must be between 1 and 35 characters and must not contain
                        any invalid characters
                requestId: 064afbca-5c14-4e27-a92b-b1f76a6d14d3
        '401':
          description: Access to the requested resource is unauthorized.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
        '404':
          description: The requested campaign could not be found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
        '409':
          description: >-
            A conflict occurred while attempting to fulfill your request. The
            resource you are trying to create already exists.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
        '501':
          description: >-
            The request could not be processed due to functionality not
            implemented.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
      security:
        - bearer: []
      summary: Create a list of accounts for a specified campaign
      tags:
        - Campaigns
  /v1/campaigns/{campaignId}/accounts/deactivate:
    patch:
      description: >-
        <span style="background-color:#007bff; color:white; padding:2px 8px;
        border-radius:4px; font-weight:600;">Management</span><br ><br
        >Deactivate an account for a specified campaign.
      operationId: CampaignsController_deactivateAccount_v1
      parameters:
        - name: campaignId
          required: true
          in: path
          description: Campaign ID
          schema: {}
      requestBody:
        required: true
        description: Payload to deactivate an account for a specified campaign.
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RetrieveAccountDTO'
      responses:
        '200':
          description: Account deactivated successfully.
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/DataResponseDTO'
                  - properties:
                      data:
                        $ref: '#/components/schemas/AccountCampaignStatusEntity'
        '400':
          description: >-
            The request could not be processed due to invalid or missing
            parameters, or issues with the request body.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
              example:
                error:
                  reasonCode: validation_error
                  description: >-
                    The request could not be processed due to invalid or missing
                    parameters, or issues with the request body.
                  details:
                    - property: fieldA
                      message: >-
                        Must be between 1 and 35 characters and must not contain
                        any invalid characters
                    - property: items.2.fieldB
                      message: >-
                        Must be between 1 and 35 characters and must not contain
                        any invalid characters
                requestId: 064afbca-5c14-4e27-a92b-b1f76a6d14d3
        '401':
          description: Access to the requested resource is unauthorized.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
        '404':
          description: The requested account could not be found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
      security:
        - bearer: []
      summary: Deactivate an account for a specified campaign
      tags:
        - Campaigns
  /v1/campaigns/{campaignId}/accounts/activate:
    patch:
      description: >-
        <span style="background-color:#007bff; color:white; padding:2px 8px;
        border-radius:4px; font-weight:600;">Management</span><br ><br >Activate
        an account for a specified campaign.
      operationId: CampaignsController_activateAccount_v1
      parameters:
        - name: campaignId
          required: true
          in: path
          description: Campaign ID
          schema: {}
      requestBody:
        required: true
        description: Payload to activate an account for a specified campaign.
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RetrieveAccountDTO'
      responses:
        '200':
          description: Account activated successfully.
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/DataResponseDTO'
                  - properties:
                      data:
                        $ref: '#/components/schemas/AccountCampaignStatusEntity'
        '400':
          description: >-
            The request could not be processed due to invalid or missing
            parameters, or issues with the request body.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
              example:
                error:
                  reasonCode: validation_error
                  description: >-
                    The request could not be processed due to invalid or missing
                    parameters, or issues with the request body.
                  details:
                    - property: fieldA
                      message: >-
                        Must be between 1 and 35 characters and must not contain
                        any invalid characters
                    - property: items.2.fieldB
                      message: >-
                        Must be between 1 and 35 characters and must not contain
                        any invalid characters
                requestId: 064afbca-5c14-4e27-a92b-b1f76a6d14d3
        '401':
          description: Access to the requested resource is unauthorized.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
        '404':
          description: The requested account could not be found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
      security:
        - bearer: []
      summary: Activate an account for a specified campaign
      tags:
        - Campaigns
  /v1/campaigns/{campaignId}/leaderboard/points:
    get:
      description: >-
        <span style="background-color:#28a745; color:white; padding:2px 8px;
        border-radius:4px; font-weight:600;">Operations</span><br ><br >Retrieve
        the leaderboard of active users for a specific campaign based on total
        points credited to the account.
          This only includes `ALLOT` and `TRANSFER_IN` transactions.
            
          Cache behaviors:
          - The leaderboard data is cached for **5 minutes** to improve performance.
          - The response includes a `x-cache-expire-at` header, which indicates when the cache will expire. Clients can use this to decide whether to wait for the next refresh or invalidate the cache manually.
            
          **Note**: Deactivated accounts will not be included in the leaderboard.
      operationId: CampaignsController_getPointsLeaderboard_v1
      parameters:
        - name: offset
          required: false
          in: query
          description: >-
            The number of records to skip before selecting records. Defaults to
            0.
          schema: {}
        - name: limit
          required: false
          in: query
          description: >-
            The maximum number of records to return. Value must be in the range
            0 - 100. Defaults to 10. 
          schema: {}
        - name: campaignId
          required: true
          in: path
          description: Campaign ID
          schema: {}
      responses:
        '200':
          description: >-
            Leaderboard of active users based on credited points was retrieved
            successfully.
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/PaginatedDataResponseDTO'
                  - properties:
                      data:
                        type: array
                        items:
                          $ref: '#/components/schemas/PointsLeaderboardEntity'
        '400':
          description: >-
            The request could not be processed due to invalid or missing
            parameters, or issues with the request body.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
              example:
                error:
                  reasonCode: validation_error
                  description: >-
                    The request could not be processed due to invalid or missing
                    parameters, or issues with the request body.
                  details:
                    - property: fieldA
                      message: >-
                        Must be between 1 and 35 characters and must not contain
                        any invalid characters
                    - property: items.2.fieldB
                      message: >-
                        Must be between 1 and 35 characters and must not contain
                        any invalid characters
                requestId: 064afbca-5c14-4e27-a92b-b1f76a6d14d3
        '401':
          description: Access to the requested resource is unauthorized.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
        '404':
          description: The requested campaign could not be found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
      security:
        - bearer: []
      summary: >-
        List the leaderboard of active users for a specific campaign based on
        total points credited to the account
      tags:
        - Campaigns
  /v1/campaigns/{campaignId}/leaderboard/points/retrieve:
    post:
      description: >-
        <span style="background-color:#28a745; color:white; padding:2px 8px;
        border-radius:4px; font-weight:600;">Operations</span><br ><br >Retrieve
        the leaderboard of active users based on a set of identifiers for a
        specific campaign based on total points credited to the account.
          This only includes `ALLOT` and `TRANSFER_IN` transactions.
          
          Cache behaviors:
          - The leaderboard data is cached for **5 minutes** to improve performance.
          - The response includes a `x-cache-expire-at` header, which indicates when the cache will expire. Clients can use this to decide whether to wait for the next refresh or invalidate the cache manually.
          
          **Note**: Deactivated accounts will not be included in the leaderboard.
      operationId: CampaignsController_getPointsLeaderboardByIdentifiers_v1
      parameters:
        - name: campaignId
          required: true
          in: path
          description: Campaign ID
          schema: {}
      requestBody:
        required: true
        description: Payload with list of account identifiers to query leaderboard rank
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RetrieveLeaderboardDTO'
      responses:
        '200':
          description: >-
            Leaderboard of active users based on credited points and set of
            identifiers was retrieved successfully.
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/DataResponseDTO'
                  - properties:
                      data:
                        $ref: >-
                          #/components/schemas/PointsLeaderboardIdentifiersEnitity
              examples:
                success:
                  summary: Success
                  value:
                    data:
                      accounts:
                        - identifier: test@example.com
                          rank: 1
                          totalPointsCredited: 100
                          updatedAt: '2023-11-22T00:00:00+08:00'
                          error: null
                error:
                  summary: Error - Account not found
                  value:
                    data:
                      accounts:
                        - identifier: test@example.com
                          rank: null
                          totalPointsCredited: null
                          updatedAt: null
                          error:
                            reasonCode: account_not_found
                            description: The requested account could not be found.
                            details: []
        '400':
          description: >-
            The request could not be processed due to invalid or missing
            parameters, or issues with the request body.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
              example:
                error:
                  reasonCode: validation_error
                  description: >-
                    The request could not be processed due to invalid or missing
                    parameters, or issues with the request body.
                  details:
                    - property: fieldA
                      message: >-
                        Must be between 1 and 35 characters and must not contain
                        any invalid characters
                    - property: items.2.fieldB
                      message: >-
                        Must be between 1 and 35 characters and must not contain
                        any invalid characters
                requestId: 064afbca-5c14-4e27-a92b-b1f76a6d14d3
        '401':
          description: Access to the requested resource is unauthorized.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
        '404':
          description: The requested campaign could not be found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
      security:
        - bearer: []
      summary: >-
        List the leaderboard of active users for a specific campaign based on
        total points credited to the account and a set of identifiers
      tags:
        - Campaigns
  /v1/campaigns/points/transfer:
    post:
      description: >-
        <span style="background-color:#28a745; color:white; padding:2px 8px;
        border-radius:4px; font-weight:600;">Operations</span><br ><br
        >Transfers points from the sender account to the receiver account,
        provided both accounts belong to the same tenant.
          
          **Note**: Points transferred from the sender to the receiver will not have expiry date and the transfer will take immediate effect.
      operationId: CampaignsController_transferPoints_v1
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TransferPointsDTO'
      responses:
        '201':
          description: Points transferred and transactions recorded successfully.
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/DataResponseDTO'
                  - properties:
                      data:
                        $ref: '#/components/schemas/TransferPointsEntity'
        '400':
          description: >-
            The request could not be processed due to invalid or missing
            parameters, or issues with the request body.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
              example:
                error:
                  reasonCode: validation_error
                  description: >-
                    The request could not be processed due to invalid or missing
                    parameters, or issues with the request body.
                  details:
                    - property: fieldA
                      message: >-
                        Must be between 1 and 35 characters and must not contain
                        any invalid characters
                    - property: items.2.fieldB
                      message: >-
                        Must be between 1 and 35 characters and must not contain
                        any invalid characters
                requestId: 064afbca-5c14-4e27-a92b-b1f76a6d14d3
        '401':
          description: Access to the requested resource is unauthorized.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
        '404':
          description: The requested account could not be found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
        '409':
          description: >-
            The request failed because the sender and receiver accounts cannot
            be the same if they are from the same campaign.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
        '422':
          description: The request failed because of insufficient points.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
      security:
        - bearer: []
      summary: Transfer points between accounts
      tags:
        - Campaigns
  /v1/campaigns/{campaignId}/metrics/retrieve:
    post:
      description: >-
        <span style="background-color:#007bff; color:white; padding:2px 8px;
        border-radius:4px; font-weight:600;">Management</span><br ><br >Retrieve
        metrics for a campaign.
      operationId: CampaignsController_getCampaignMetrics_v1
      parameters:
        - name: campaignId
          required: true
          in: path
          description: Campaign ID
          schema: {}
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RetriveCampaignMetricsDTO'
      responses:
        '200':
          description: Campaign metrics retrieved successfully.
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/DataResponseDTO'
                  - properties:
                      data:
                        $ref: '#/components/schemas/CampaignMetrics'
        '401':
          description: Access to the requested resource is unauthorized.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
        '404':
          description: The requested campaign could not be found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
      security:
        - bearer: []
      summary: Get metrics for a campaign
      tags:
        - Campaigns
  /v1/campaigns/{campaignId}/tiers:
    post:
      description: >-
        <span style="background-color:#007bff; color:white; padding:2px 8px;
        border-radius:4px; font-weight:600;">Management</span><br ><br >Create a
        campaign tier
      operationId: CampaignTiersController_createCampaignTier_v1
      parameters:
        - name: campaignId
          required: true
          in: path
          description: Campaign ID
          schema: {}
      requestBody:
        required: true
        description: Payload for adding a campaign tier
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AddCampaignTierDTO'
      responses:
        '201':
          description: Campaign tier added successfully.
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/DataResponseDTO'
                  - properties:
                      data:
                        $ref: '#/components/schemas/CampaignTierEntity'
        '400':
          description: >-
            The request could not be processed due to invalid or missing
            parameters, or issues with the request body.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
              example:
                error:
                  reasonCode: validation_error
                  description: >-
                    The request could not be processed due to invalid or missing
                    parameters, or issues with the request body.
                  details:
                    - property: fieldA
                      message: >-
                        Must be between 1 and 35 characters and must not contain
                        any invalid characters
                    - property: items.2.fieldB
                      message: >-
                        Must be between 1 and 35 characters and must not contain
                        any invalid characters
                requestId: 064afbca-5c14-4e27-a92b-b1f76a6d14d3
        '401':
          description: Access to the requested resource is unauthorized.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
        '404':
          description: The requested campaign could not be found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
        '409':
          description: >-
            A conflict occurred while attempting to fulfill your request. The
            resource you are trying to create already exists.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
      security:
        - bearer: []
      summary: Create a campaign tier
      tags:
        - Campaign Tiers
      x-feature-flag: enable_campaign_tiers
    get:
      description: >-
        <span style="background-color:#007bff; color:white; padding:2px 8px;
        border-radius:4px; font-weight:600;">Management</span><br ><br >Retrieve
        all campaign tiers for a campaign.
      operationId: CampaignTiersController_listCampaignTiers_v1
      parameters:
        - name: offset
          required: false
          in: query
          description: >-
            The number of records to skip before selecting records. Defaults to
            0.
          schema: {}
        - name: limit
          required: false
          in: query
          description: >-
            The maximum number of records to return. Value must be in the range
            0 - 100. Defaults to 10. 
          schema: {}
        - name: campaignId
          required: true
          in: path
          description: Campaign ID
          schema: {}
      responses:
        '200':
          description: All campaign tiers retrieved successfully.
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/PaginatedDataResponseDTO'
                  - properties:
                      data:
                        type: array
                        items:
                          $ref: '#/components/schemas/CampaignTierEntity'
        '400':
          description: >-
            The request could not be processed due to invalid or missing
            parameters, or issues with the request body.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
              example:
                error:
                  reasonCode: validation_error
                  description: >-
                    The request could not be processed due to invalid or missing
                    parameters, or issues with the request body.
                  details:
                    - property: fieldA
                      message: >-
                        Must be between 1 and 35 characters and must not contain
                        any invalid characters
                    - property: items.2.fieldB
                      message: >-
                        Must be between 1 and 35 characters and must not contain
                        any invalid characters
                requestId: 064afbca-5c14-4e27-a92b-b1f76a6d14d3
        '401':
          description: Access to the requested resource is unauthorized.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
        '404':
          description: The requested campaign could not be found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
      security:
        - bearer: []
      summary: List all campaign tiers for a campaign
      tags:
        - Campaign Tiers
      x-feature-flag: enable_campaign_tiers
  /v1/campaigns/{campaignId}/tiers/{tierId}:
    patch:
      description: >-
        <span style="background-color:#007bff; color:white; padding:2px 8px;
        border-radius:4px; font-weight:600;">Management</span><br ><br >Update
        campaign tier for a campaign.
      operationId: CampaignTiersController_updateCampaignTier_v1
      parameters:
        - name: tierId
          required: true
          in: path
          description: Campaign Tier ID
          schema: {}
        - name: campaignId
          required: true
          in: path
          description: Campaign ID
          schema: {}
      requestBody:
        required: true
        description: >-
          Payload for updating a campaign tier for a campaign. Available fields
          for update: name, description, isActive, conditions
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateCampaignTierDTO'
      responses:
        '200':
          description: Campaign tier updated successfully.
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/DataResponseDTO'
                  - properties:
                      data:
                        $ref: '#/components/schemas/CampaignTierEntity'
        '400':
          description: >-
            The request could not be processed due to invalid or missing
            parameters, or issues with the request body.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
              example:
                error:
                  reasonCode: validation_error
                  description: >-
                    The request could not be processed due to invalid or missing
                    parameters, or issues with the request body.
                  details:
                    - property: fieldA
                      message: >-
                        Must be between 1 and 35 characters and must not contain
                        any invalid characters
                    - property: items.2.fieldB
                      message: >-
                        Must be between 1 and 35 characters and must not contain
                        any invalid characters
                requestId: 064afbca-5c14-4e27-a92b-b1f76a6d14d3
        '401':
          description: Access to the requested resource is unauthorized.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
        '404':
          description: The requested campaign could not be found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
      security:
        - bearer: []
      summary: Update campaign tier
      tags:
        - Campaign Tiers
      x-feature-flag: enable_campaign_tiers
  /v1/campaigns/{campaignId}/tiers/priorities:
    patch:
      description: >-
        <span style="background-color:#007bff; color:white; padding:2px 8px;
        border-radius:4px; font-weight:600;">Management</span><br ><br >Update
        priority of campaign tiers for a campaign
      operationId: CampaignTiersController_updateCampaignTierPriorities_v1
      parameters:
        - name: campaignId
          required: true
          in: path
          description: Campaign ID
          schema: {}
      requestBody:
        required: true
        description: Payload for updating the priority of campaign tiers for a campaign.
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateCampaignTierPrioritiesDTO'
      responses:
        '200':
          description: Campaign tier priorities updated successfully.
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/DataResponseDTO'
                  - properties:
                      data:
                        $ref: '#/components/schemas/UpdateCampaignTierPrioritiesDTO'
        '400':
          description: >-
            The request could not be processed due to invalid or missing
            parameters, or issues with the request body.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
              example:
                error:
                  reasonCode: validation_error
                  description: >-
                    The request could not be processed due to invalid or missing
                    parameters, or issues with the request body.
                  details:
                    - property: fieldA
                      message: >-
                        Must be between 1 and 35 characters and must not contain
                        any invalid characters
                    - property: items.2.fieldB
                      message: >-
                        Must be between 1 and 35 characters and must not contain
                        any invalid characters
                requestId: 064afbca-5c14-4e27-a92b-b1f76a6d14d3
        '401':
          description: Access to the requested resource is unauthorized.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
        '404':
          description: The requested campaign could not be found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
      security:
        - bearer: []
      summary: Update priority of campaign tiers
      tags:
        - Campaign Tiers
      x-feature-flag: enable_campaign_tiers
  /v1/internal-events:
    get:
      description: |2-

          <span style="background-color:#007bff; color:white; padding:2px 8px; border-radius:4px; font-weight:600;">Management</span><br ><br >Retrieve internal events for a tenant for triaging. Currently, internal events only include the following events:
        - webhook.send.failed
        - redemption.provider_request.failed
        - formsg.webhook.received.failed
        - goventry.webhook.received.failed
        - account.tier_evaluation.failed

          
          Note: Internal events are available for up to 90 days only.
            
      operationId: InternalEventsController_listInternalEvents_v1
      parameters:
        - name: campaignId
          required: false
          in: query
          description: The identifier of the campaign
          schema:
            example: f39854be-46f2-492f-9dd8-042e5719f05f
            type: string
        - name: fromDate
          required: true
          in: query
          description: >-
            The start date and time for filtering internal events by their
            creation timestamp. Only internal events created on or after this
            date will be included in the results.
          schema:
            example: '2023-11-23T00:00:00+08:00'
            type: string
        - name: toDate
          required: true
          in: query
          description: >-
            The end date and time for filtering internal events by their
            creation timestamp. Only internal events created before or on this
            date will be included in the results.
          schema:
            example: '2023-11-23T23:59:59+08:00'
            type: string
        - name: type
          required: false
          in: query
          schema:
            example: redemption.provider_request.failed
            type: string
            enum:
              - webhook.send.failed
              - redemption.provider_request.failed
              - formsg.webhook.received.failed
              - goventry.webhook.received.failed
              - account.tier_evaluation.failed
        - name: offset
          required: false
          in: query
          description: >-
            The number of records to skip before selecting records. Defaults to
            0.
          schema: {}
        - name: limit
          required: false
          in: query
          description: >-
            The maximum number of records to return. Value must be in the range
            0 - 100. Defaults to 10. 
          schema: {}
      responses:
        '200':
          description: Internal events retrieved successfully.
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/PaginatedDataResponseDTO'
                  - properties:
                      data:
                        type: array
                        items:
                          $ref: '#/components/schemas/InternalEventEntity'
        '401':
          description: Access to the requested resource is unauthorized.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
      security:
        - bearer: []
      summary: List all internal events
      tags:
        - Internal Events
      x-feature-flag: enable_internal_events
  /v1/campaigns/{campaignId}/objectives:
    post:
      description: >-
        <span style="background-color:#007bff; color:white; padding:2px 8px;
        border-radius:4px; font-weight:600;">Management</span><br ><br >Create a
        new objectives for a campaign.
      operationId: ObjectivesController_createObjective_v1
      parameters:
        - name: campaignId
          required: true
          in: path
          description: Campaign ID
          schema: {}
      requestBody:
        required: true
        description: Payload for creating a objective for a campaign.
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateObjectiveDTO'
      responses:
        '201':
          description: Objective created successfully.
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/DataResponseDTO'
                  - properties:
                      data:
                        $ref: '#/components/schemas/ObjectiveEntity'
        '400':
          description: >-
            The request could not be processed due to invalid or missing
            parameters, or issues with the request body.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
              example:
                error:
                  reasonCode: validation_error
                  description: >-
                    The request could not be processed due to invalid or missing
                    parameters, or issues with the request body.
                  details:
                    - property: fieldA
                      message: >-
                        Must be between 1 and 35 characters and must not contain
                        any invalid characters
                    - property: items.2.fieldB
                      message: >-
                        Must be between 1 and 35 characters and must not contain
                        any invalid characters
                requestId: 064afbca-5c14-4e27-a92b-b1f76a6d14d3
        '401':
          description: Access to the requested resource is unauthorized.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
        '404':
          description: The requested campaign could not be found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
        '409':
          description: >-
            A conflict occurred while attempting to fulfill your request. The
            resource you are trying to create already exists.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
      security:
        - bearer: []
      summary: Create objective
      tags:
        - Objectives
    get:
      description: >-
        <span style="background-color:#007bff; color:white; padding:2px 8px;
        border-radius:4px; font-weight:600;">Management</span><br ><br >Retrieve
        all objectives for a campaign.
      operationId: ObjectivesController_listObjectives_v1
      parameters:
        - name: includeRules
          required: false
          in: query
          description: >-
            To indicate if rules linked to the objective should be fetched and
            included in the response. If set to true, the response will include
            the linked rules under the `rules` field. Defaults to false.
          schema:
            default: false
            type: boolean
        - name: q
          required: false
          in: query
          description: Search query
          schema: {}
        - name: offset
          required: false
          in: query
          description: >-
            The number of records to skip before selecting records. Defaults to
            0.
          schema: {}
        - name: limit
          required: false
          in: query
          description: >-
            The maximum number of records to return. Value must be in the range
            0 - 100. Defaults to 10. 
          schema: {}
        - name: campaignId
          required: true
          in: path
          description: Campaign ID
          schema: {}
      responses:
        '200':
          description: All campaign objectives retrieved successfully.
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/PaginatedDataResponseDTO'
                  - properties:
                      data:
                        type: array
                        items:
                          $ref: '#/components/schemas/ObjectiveWithRulesEntity'
        '400':
          description: >-
            The request could not be processed due to invalid or missing
            parameters, or issues with the request body.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
              example:
                error:
                  reasonCode: validation_error
                  description: >-
                    The request could not be processed due to invalid or missing
                    parameters, or issues with the request body.
                  details:
                    - property: fieldA
                      message: >-
                        Must be between 1 and 35 characters and must not contain
                        any invalid characters
                    - property: items.2.fieldB
                      message: >-
                        Must be between 1 and 35 characters and must not contain
                        any invalid characters
                requestId: 064afbca-5c14-4e27-a92b-b1f76a6d14d3
        '401':
          description: Access to the requested resource is unauthorized.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
        '404':
          description: The requested campaign could not be found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
      security:
        - bearer: []
      summary: List all objectives for a campaign
      tags:
        - Objectives
  /v1/campaigns/{campaignId}/objectives/{objectiveId}:
    patch:
      description: >-
        <span style="background-color:#007bff; color:white; padding:2px 8px;
        border-radius:4px; font-weight:600;">Management</span><br ><br >Update
        objectives name/description for a campaign.
      operationId: ObjectivesController_updateObjective_v1
      parameters:
        - name: objectiveId
          required: true
          in: path
          description: Objective ID
          schema: {}
        - name: campaignId
          required: true
          in: path
          description: Campaign ID
          schema: {}
      requestBody:
        required: true
        description: >-
          Payload for updating an objective for a campaign. Either name or
          objective should be provided.
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateObjectiveDTO'
      responses:
        '200':
          description: Objective updated successfully.
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/DataResponseDTO'
                  - properties:
                      data:
                        $ref: '#/components/schemas/ObjectiveEntity'
        '400':
          description: >-
            The request could not be processed due to invalid or missing
            parameters, or issues with the request body.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
              example:
                error:
                  reasonCode: validation_error
                  description: >-
                    The request could not be processed due to invalid or missing
                    parameters, or issues with the request body.
                  details:
                    - property: fieldA
                      message: >-
                        Must be between 1 and 35 characters and must not contain
                        any invalid characters
                    - property: items.2.fieldB
                      message: >-
                        Must be between 1 and 35 characters and must not contain
                        any invalid characters
                requestId: 064afbca-5c14-4e27-a92b-b1f76a6d14d3
        '401':
          description: Access to the requested resource is unauthorized.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
        '404':
          description: The requested campaign could not be found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
      security:
        - bearer: []
      summary: Update objective
      tags:
        - Objectives
    get:
      description: >-
        <span style="background-color:#007bff; color:white; padding:2px 8px;
        border-radius:4px; font-weight:600;">Management</span><br ><br >Retrieve
        objective and its linked rules for a campaign.
      operationId: ObjectivesController_getObjective_v1
      parameters:
        - name: objectiveId
          required: true
          in: path
          description: Objective ID
          schema: {}
        - name: campaignId
          required: true
          in: path
          description: Campaign ID
          schema: {}
      responses:
        '200':
          description: Objective retrieve successfully.
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/DataResponseDTO'
                  - properties:
                      data:
                        $ref: '#/components/schemas/ObjectiveWithRulesEntity'
        '401':
          description: Access to the requested resource is unauthorized.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
        '404':
          description: The requested campaign could not be found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
      security:
        - bearer: []
      summary: Get objective for a campaign
      tags:
        - Objectives
  /v1/campaigns/{campaignId}/points/allot:
    post:
      description: >-
        <span style="background-color:#28a745; color:white; padding:2px 8px;
        border-radius:4px; font-weight:600;">Operations</span><br ><br >Allot
        points to corresponding account with effective date and expiry date.
      operationId: PointsController_allotPointToAccount_v1
      parameters:
        - name: campaignId
          required: true
          in: path
          description: Campaign ID
          schema: {}
      requestBody:
        required: true
        description: Payload to allot points.
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AllotPointsDTO'
      responses:
        '201':
          description: Points allotted and transaction recorded successfully.
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/DataResponseDTO'
                  - properties:
                      data:
                        $ref: '#/components/schemas/PointsAllotmentEntity'
        '400':
          description: >-
            The request could not be processed due to invalid or missing
            parameters, or issues with the request body.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
              example:
                error:
                  reasonCode: validation_error
                  description: >-
                    The request could not be processed due to invalid or missing
                    parameters, or issues with the request body.
                  details:
                    - property: fieldA
                      message: >-
                        Must be between 1 and 35 characters and must not contain
                        any invalid characters
                    - property: items.2.fieldB
                      message: >-
                        Must be between 1 and 35 characters and must not contain
                        any invalid characters
                requestId: 064afbca-5c14-4e27-a92b-b1f76a6d14d3
        '401':
          description: Access to the requested resource is unauthorized.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
        '404':
          description: The requested campaign could not be found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
      security:
        - bearer: []
      summary: Allot points to a specific account
      tags:
        - Points
  /v1/campaigns/{campaignId}/points/deduct:
    post:
      description: >-
        <span style="background-color:#28a745; color:white; padding:2px 8px;
        border-radius:4px; font-weight:600;">Operations</span><br ><br >Deduct
        points from a corresponding account
      operationId: PointsController_deductPointsFromAccount_v1
      parameters:
        - name: campaignId
          required: true
          in: path
          description: Campaign ID
          schema: {}
      requestBody:
        required: true
        description: Payload to deduct points.
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DeductPointsDTO'
      responses:
        '201':
          description: Points deducted and transaction recorded successfully.
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/DataResponseDTO'
                  - properties:
                      data:
                        $ref: '#/components/schemas/PointsDeductionEntity'
        '400':
          description: >-
            The request could not be processed due to invalid or missing
            parameters, or issues with the request body.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
              example:
                error:
                  reasonCode: validation_error
                  description: >-
                    The request could not be processed due to invalid or missing
                    parameters, or issues with the request body.
                  details:
                    - property: fieldA
                      message: >-
                        Must be between 1 and 35 characters and must not contain
                        any invalid characters
                    - property: items.2.fieldB
                      message: >-
                        Must be between 1 and 35 characters and must not contain
                        any invalid characters
                requestId: 064afbca-5c14-4e27-a92b-b1f76a6d14d3
        '401':
          description: Access to the requested resource is unauthorized.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
        '404':
          description: The requested campaign could not be found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
      security:
        - bearer: []
      summary: Deduct points from a specific account
      tags:
        - Points
  /v1/campaigns/{campaignId}/points/allot/batch:
    post:
      description: >-
        <span style="background-color:#28a745; color:white; padding:2px 8px;
        border-radius:4px; font-weight:600;">Operations</span><br ><br >Allot
        points to corresponding accounts with effective date and expiry date.
      operationId: PointsController_batchAllotPointToAccount_v1
      parameters:
        - name: campaignId
          required: true
          in: path
          description: Campaign ID
          schema: {}
      requestBody:
        required: true
        description: Payload to allot points for a list of accounts
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/BatchAllotPointsDTO'
      responses:
        '201':
          description: Points allotted and transaction recorded successfully.
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/DataResponseDTO'
                  - properties:
                      data:
                        $ref: '#/components/schemas/BatchPointsAllotmentEntity'
        '400':
          description: >-
            The request could not be processed due to invalid or missing
            parameters, or issues with the request body.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
              example:
                error:
                  reasonCode: validation_error
                  description: >-
                    The request could not be processed due to invalid or missing
                    parameters, or issues with the request body.
                  details:
                    - property: fieldA
                      message: >-
                        Must be between 1 and 35 characters and must not contain
                        any invalid characters
                    - property: items.2.fieldB
                      message: >-
                        Must be between 1 and 35 characters and must not contain
                        any invalid characters
                requestId: 064afbca-5c14-4e27-a92b-b1f76a6d14d3
        '401':
          description: Access to the requested resource is unauthorized.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
        '404':
          description: The requested campaign could not be found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
      security:
        - bearer: []
      summary: Allot point to a list of accounts
      tags:
        - Points
  /v1/campaigns/{campaignId}/points/transactions/{transactionId}:
    get:
      description: >-
        <span style="background-color:#28a745; color:white; padding:2px 8px;
        border-radius:4px; font-weight:600;">Operations</span><br ><br >Retrieve
        a single transaction details for a specific campaign. This also includes
        any account objective of account redemption item that is linked to this
        transaction.
      operationId: PointsController_getTransactionById_v1
      parameters:
        - name: transactionId
          required: true
          in: path
          schema:
            type: string
        - name: campaignId
          required: true
          in: path
          description: Campaign ID
          schema: {}
      responses:
        '200':
          description: Transaction details retrieved successfully.
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/DataResponseDTO'
                  - properties:
                      data:
                        $ref: '#/components/schemas/PointsTransactionDetailsEntity'
        '401':
          description: Access to the requested resource is unauthorized.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
        '404':
          description: The requested campaign could not be found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
      security:
        - bearer: []
      summary: Get details from a specified transaction
      tags:
        - Points
  /v1/campaigns/{campaignId}/redemptions/items:
    post:
      description: >-
        <span style="background-color:#007bff; color:white; padding:2px 8px;
        border-radius:4px; font-weight:600;">Management</span><br ><br >Create a
        new redemption item for a campaign. The provider specified needs to be
        configured first before creating the redemption item
      operationId: RedemptionsController_createItem_v1
      parameters:
        - name: campaignId
          required: true
          in: path
          description: Campaign ID
          schema: {}
      requestBody:
        required: true
        description: Payload for creating a redemption item for a campaign.
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateRedemptionItemDTO'
      responses:
        '201':
          description: Redemption item created successfully.
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/DataResponseDTO'
                  - properties:
                      data:
                        $ref: '#/components/schemas/RedemptionItemEntity'
        '400':
          description: >-
            The request could not be processed due to invalid or missing
            parameters, or issues with the request body.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
              example:
                error:
                  reasonCode: validation_error
                  description: >-
                    The request could not be processed due to invalid or missing
                    parameters, or issues with the request body.
                  details:
                    - property: fieldA
                      message: >-
                        Must be between 1 and 35 characters and must not contain
                        any invalid characters
                    - property: items.2.fieldB
                      message: >-
                        Must be between 1 and 35 characters and must not contain
                        any invalid characters
                requestId: 064afbca-5c14-4e27-a92b-b1f76a6d14d3
        '401':
          description: Access to the requested resource is unauthorized.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
        '404':
          description: The requested campaign could not be found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
        '409':
          description: >-
            A conflict occurred while attempting to fulfill your request. The
            resource you are trying to create already exists.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
      security:
        - bearer: []
      summary: Create redemption item
      tags:
        - Redemptions
    get:
      description: >-
        <span style="background-color:#28a745; color:white; padding:2px 8px;
        border-radius:4px; font-weight:600;">Operations</span><br ><br >Retrieve
        all redemption items for a campaign.
      operationId: RedemptionsController_listItems_v1
      parameters:
        - name: isActive
          required: false
          in: query
          description: Filter redemption items by active status
          schema:
            type: boolean
        - name: provider
          required: false
          in: query
          description: Filter redemption items by provider
          schema:
            type: string
            enum:
              - GOVWALLET
              - GOVSUPPLY
              - DISBURSE_PLUS
        - name: offset
          required: false
          in: query
          description: >-
            The number of records to skip before selecting records. Defaults to
            0.
          schema: {}
        - name: limit
          required: false
          in: query
          description: >-
            The maximum number of records to return. Value must be in the range
            0 - 100. Defaults to 10. 
          schema: {}
        - name: campaignId
          required: true
          in: path
          description: Campaign ID
          schema: {}
      responses:
        '200':
          description: Redemption items retrieved successfully.
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/PaginatedDataResponseDTO'
                  - properties:
                      data:
                        type: array
                        items:
                          $ref: '#/components/schemas/RedemptionItemEntity'
        '401':
          description: Access to the requested resource is unauthorized.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
        '404':
          description: The requested campaign could not be found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
      security:
        - bearer: []
      summary: List all redemption items
      tags:
        - Redemptions
  /v1/campaigns/{campaignId}/redemptions/items/{redemptionItemId}:
    patch:
      description: >-
        <span style="background-color:#007bff; color:white; padding:2px 8px;
        border-radius:4px; font-weight:600;">Management</span><br ><br >Update
        redemption item for a campaign.
      operationId: RedemptionsController_updateItem_v1
      parameters:
        - name: campaignId
          required: true
          in: path
          description: Campaign ID
          schema: {}
        - name: redemptionItemId
          required: true
          in: path
          description: Redemption Item ID
          schema: {}
      requestBody:
        required: true
        description: Payload for updating a redemption item.
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PatchRedemptionItemDTO'
      responses:
        '200':
          description: Redemption item updated successfully.
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/DataResponseDTO'
                  - properties:
                      data:
                        $ref: '#/components/schemas/RedemptionItemEntity'
        '400':
          description: >-
            The request could not be processed due to invalid or missing
            parameters, or issues with the request body.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
              example:
                error:
                  reasonCode: validation_error
                  description: >-
                    The request could not be processed due to invalid or missing
                    parameters, or issues with the request body.
                  details:
                    - property: fieldA
                      message: >-
                        Must be between 1 and 35 characters and must not contain
                        any invalid characters
                    - property: items.2.fieldB
                      message: >-
                        Must be between 1 and 35 characters and must not contain
                        any invalid characters
                requestId: 064afbca-5c14-4e27-a92b-b1f76a6d14d3
        '401':
          description: Access to the requested resource is unauthorized.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
        '404':
          description: The requested redemption item could not be found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
      security:
        - bearer: []
      summary: Update redemption item
      tags:
        - Redemptions
    get:
      description: >-
        <span style="background-color:#28a745; color:white; padding:2px 8px;
        border-radius:4px; font-weight:600;">Operations</span><br ><br >Retrieve
        redemption item details by its specific id
      operationId: RedemptionsController_getItem_v1
      parameters:
        - name: redemptionItemId
          required: true
          in: path
          description: Redemption Item ID
          schema: {}
        - name: campaignId
          required: true
          in: path
          description: Campaign ID
          schema: {}
      responses:
        '200':
          description: Redemption Item retrieved successfully
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/DataResponseDTO'
                  - properties:
                      data:
                        $ref: '#/components/schemas/RedemptionItemEntity'
        '401':
          description: Access to the requested resource is unauthorized.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
        '404':
          description: The requested campaign could not be found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
      security:
        - bearer: []
      summary: Get redemption item details
      tags:
        - Redemptions
  /v1/campaigns/{campaignId}/redemptions/providers:
    post:
      description: >-
        <span style="background-color:#007bff; color:white; padding:2px 8px;
        border-radius:4px; font-weight:600;">Management</span><br ><br >

        Configure a redemption item provider for a specified campaign. Only one
        configuration per redemption item provider per campaign. 
            
        Note: Not all tenants can use the `DISBURSE_PLUS` provider. If you would
        like to use it, you will need to contact us, if not, you will receive an
        error.
      operationId: RedemptionsController_createCampaignRedemptionItemProviderConfig_v1
      parameters:
        - name: campaignId
          required: true
          in: path
          description: Campaign ID
          schema: {}
      requestBody:
        required: true
        description: Payload for configuring a redemption item provider for a campaign.
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateRedemptionItemProviderConfigDTO'
      responses:
        '201':
          description: Redemption item provider configured successfully.
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/DataResponseDTO'
                  - properties:
                      data:
                        $ref: >-
                          #/components/schemas/RedemptionItemProviderConfigEntity
        '400':
          description: >-
            The request could not be processed due to invalid or missing
            parameters, or issues with the request body.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
              example:
                error:
                  reasonCode: validation_error
                  description: >-
                    The request could not be processed due to invalid or missing
                    parameters, or issues with the request body.
                  details:
                    - property: fieldA
                      message: >-
                        Must be between 1 and 35 characters and must not contain
                        any invalid characters
                    - property: items.2.fieldB
                      message: >-
                        Must be between 1 and 35 characters and must not contain
                        any invalid characters
                requestId: 064afbca-5c14-4e27-a92b-b1f76a6d14d3
        '401':
          description: Access to the requested resource is unauthorized.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
        '404':
          description: The requested campaign could not be found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
        '409':
          description: >-
            A conflict occurred while attempting to fulfill your request. The
            resource you are trying to create already exists.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
      security:
        - bearer: []
      summary: Create redemption item provider
      tags:
        - Redemptions
    get:
      description: >-
        <span style="background-color:#007bff; color:white; padding:2px 8px;
        border-radius:4px; font-weight:600;">Management</span><br ><br >Retrieve
        all redemption item providers for a campaign.
      operationId: RedemptionsController_listCampaignRedemptionItemProviderConfig_v1
      parameters:
        - name: offset
          required: false
          in: query
          description: >-
            The number of records to skip before selecting records. Defaults to
            0.
          schema: {}
        - name: limit
          required: false
          in: query
          description: >-
            The maximum number of records to return. Value must be in the range
            0 - 100. Defaults to 10. 
          schema: {}
        - name: campaignId
          required: true
          in: path
          description: Campaign ID
          schema: {}
      responses:
        '200':
          description: Redemption item provider list retrieved successfully.
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/PaginatedDataResponseDTO'
                  - properties:
                      data:
                        type: array
                        items:
                          $ref: >-
                            #/components/schemas/RedemptionItemProviderConfigEntity
        '401':
          description: Access to the requested resource is unauthorized.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
        '404':
          description: The requested campaign could not be found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
      security:
        - bearer: []
      summary: List all redemption item providers for a specified campaign
      tags:
        - Redemptions
  /v1/campaigns/{campaignId}/redemptions/providers/{providerId}:
    patch:
      description: >-
        <span style="background-color:#007bff; color:white; padding:2px 8px;
        border-radius:4px; font-weight:600;">Management</span><br ><br >Update
        redemption item provider configuration for a specified campaign.
      operationId: RedemptionsController_updateCampaignRedemptionItemProviderConfig_v1
      parameters:
        - name: providerId
          required: true
          in: path
          description: Provider ID
          schema: {}
        - name: campaignId
          required: true
          in: path
          description: Campaign ID
          schema: {}
      requestBody:
        required: true
        description: Payload for updating a redemption item provider configuration.
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateRedemptionItemProviderConfigDTO'
      responses:
        '200':
          description: Redemption item provider configuration updated successfully.
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/DataResponseDTO'
                  - properties:
                      data:
                        $ref: >-
                          #/components/schemas/RedemptionItemProviderConfigEntity
        '400':
          description: >-
            The request could not be processed due to invalid or missing
            parameters, or issues with the request body.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
              example:
                error:
                  reasonCode: validation_error
                  description: >-
                    The request could not be processed due to invalid or missing
                    parameters, or issues with the request body.
                  details:
                    - property: fieldA
                      message: >-
                        Must be between 1 and 35 characters and must not contain
                        any invalid characters
                    - property: items.2.fieldB
                      message: >-
                        Must be between 1 and 35 characters and must not contain
                        any invalid characters
                requestId: 064afbca-5c14-4e27-a92b-b1f76a6d14d3
        '401':
          description: Access to the requested resource is unauthorized.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
        '404':
          description: The requested campaign could not be found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
      security:
        - bearer: []
      summary: Update redemption item provider configuration for a specified campaign
      tags:
        - Redemptions
  /v1/campaigns/{campaignId}/redemptions/redeem:
    post:
      description: >-
        <span style="background-color:#28a745; color:white; padding:2px 8px;
        border-radius:4px; font-weight:600;">Operations</span><br ><br >Process
        the redemption of items using the user accumulated points. The operation
        checks the eligibility and handles any business rule validations before
        completing the redemption.
      operationId: RedemptionsController_redeemItem_v1
      parameters:
        - name: campaignId
          required: true
          in: path
          description: Campaign ID
          schema: {}
        - name: x-idempotency-key
          in: header
          description: >-
            Idempotency Key. Must be a valid uuid. Refer to the section
            "Idempotency" for more information.
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RedeemRedemptionItemDTO'
      responses:
        '201':
          description: Items redeemed successfully.
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/DataResponseDTO'
                  - properties:
                      data:
                        $ref: '#/components/schemas/AccountRedemptionItemEntity'
        '400':
          description: >-
            The request could not be processed due to invalid or missing
            parameters, or issues with the request body.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
              example:
                error:
                  reasonCode: validation_error
                  description: >-
                    The request could not be processed due to invalid or missing
                    parameters, or issues with the request body.
                  details:
                    - property: fieldA
                      message: >-
                        Must be between 1 and 35 characters and must not contain
                        any invalid characters
                    - property: items.2.fieldB
                      message: >-
                        Must be between 1 and 35 characters and must not contain
                        any invalid characters
                requestId: 064afbca-5c14-4e27-a92b-b1f76a6d14d3
        '401':
          description: Access to the requested resource is unauthorized.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
        '404':
          description: The requested campaign could not be found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
        '422':
          description: >-
            The request was well-formed but was unable to process the contained
            instructions.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
      security:
        - bearer: []
      summary: Redeem items
      tags:
        - Redemptions
      x-client-feature-flags:
        - redeem_rollback
  /v1/campaigns/{campaignId}/rules:
    get:
      description: >-
        <span style="background-color:#007bff; color:white; padding:2px 8px;
        border-radius:4px; font-weight:600;">Management</span><br ><br >Retrieve
        rules for a campaign.
      operationId: RulesController_listRules_v1
      parameters:
        - name: offset
          required: false
          in: query
          description: >-
            The number of records to skip before selecting records. Defaults to
            0.
          schema: {}
        - name: limit
          required: false
          in: query
          description: >-
            The maximum number of records to return. Value must be in the range
            0 - 100. Defaults to 10. 
          schema: {}
        - name: campaignId
          required: true
          in: path
          description: Campaign ID
          schema: {}
      responses:
        '200':
          description: Campaign rules retrieved successfully.
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/PaginatedDataResponseDTO'
                  - properties:
                      data:
                        type: array
                        items:
                          $ref: '#/components/schemas/RuleEntity'
        '400':
          description: >-
            The request could not be processed due to invalid or missing
            parameters, or issues with the request body.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
              example:
                error:
                  reasonCode: validation_error
                  description: >-
                    The request could not be processed due to invalid or missing
                    parameters, or issues with the request body.
                  details:
                    - property: fieldA
                      message: >-
                        Must be between 1 and 35 characters and must not contain
                        any invalid characters
                    - property: items.2.fieldB
                      message: >-
                        Must be between 1 and 35 characters and must not contain
                        any invalid characters
                requestId: 064afbca-5c14-4e27-a92b-b1f76a6d14d3
        '401':
          description: Access to the requested resource is unauthorized.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
        '404':
          description: The requested campaign could not be found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
      security:
        - bearer: []
      summary: List all campaign rules
      tags:
        - Rules
    post:
      description: >-
        <span style="background-color:#007bff; color:white; padding:2px 8px;
        border-radius:4px; font-weight:600;">Management</span><br ><br >Create a
        new rule for a campaign.
            
            
          ### How to set maxTriesResetStrategy

          The `recurrenceType` field determines the frequency of resetting `maxTries`, with the reset period starting at 00:00:00 and ending at 23:59:59 Singapore time:
          - `DAILY`: `maxTries` will be reset daily, allowing you to continue attempting to meet the objective each day.
          - `WEEKLY`: `maxTries` will be reset weekly. You can specify `dayOfWeek` (0 for Sunday through 6 for Saturday) in the `recurrenceSchedule`.
          - `MONTHLY`: `maxTries` will be reset monthly. You can specify `dayOfMonth` (1 through 31) in the `recurrenceSchedule`.
          
          Example usage:
          - For a daily reset of `maxTries`, set `recurrenceType` to `DAILY` and leave `recurrenceSchedule` empty.
          - For a weekly reset on Wednesdays, set `recurrenceType` to `WEEKLY` and `recurrenceSchedule.dayOfWeek` to `3`.
          - For a monthly reset on the 15th, set `recurrenceType` to `MONTHLY` and `recurrenceSchedule.dayOfMonth` to `15`.
          
          ### How to set pointsExpiryStrategy
          
          The `pointsExpiryStrategy` field determines when earned points will expire:
          - `expireAt`: Set a specific date and time for points to expire. The time must always be set to 00:00:00 (start of day) Singapore time.
          - `relativeExpiryDuration`: Set a duration for points to expire relative to when they were earned. Use ISO 8601 duration format. The expiry time will be calculated and then rounded up to the next start of day in Singapore time.

          Example usage for:
          - To set points to expire on November 23, 2023 at midnight Singapore time:
            ```
            "pointsExpiryStrategy": {
              "expireAt": "2023-11-23T00:00:00+08:00"
            }
            ```
          - To set points to expire 1 day after they are earned:
            ```
            "pointsExpiryStrategy": {
              "relativeExpiryDuration": "P1D"
            }
            ```
            
          Concrete examples for relativeExpiryDuration:
          
          Assume points are allotted on 2025-01-24T10:00:00+08:00
          
          1. `P1D` (1 day):
             Points will expire on 2025-01-26T00:00:00+08:00

          2. `P1W` (1 week):
             Points will expire on 2025-02-01T00:00:00+08:00

          3. `P1M` (1 month):
             Points will expire on 2025-02-25T00:00:00+08:00

          4. `P1Y` (1 year):
             Points will expire on 2026-01-25T00:00:00+08:00

          Note: For `relativeExpiryDuration`, the expiry time is always rounded up to the next Singapore Time (SGT) start of day (00:00:00). This ensures that even if points are earned late in the day (e.g., at 11:59 PM), they will still be valid for the full specified duration plus the remainder of that day. For example, points earned at 11:59 PM with a `P1D` duration will expire at 00:00:00 two days later, giving slightly more than 24 hours of validity.

          You should use either `expireAt` or `relativeExpiryDuration`, not both. The `relativeExpiryDuration` only supports whole number values for date components (years, months, weeks, days).
          
      operationId: RulesController_createRules_v1
      parameters:
        - name: campaignId
          required: true
          in: path
          description: Campaign ID
          schema: {}
      requestBody:
        required: true
        description: Payload for creating a rule for a campaign.
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateRuleDTO'
      responses:
        '201':
          description: Rule created successfully.
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/DataResponseDTO'
                  - properties:
                      data:
                        $ref: '#/components/schemas/RuleEntity'
        '400':
          description: >-
            The request could not be processed due to invalid or missing
            parameters, or issues with the request body.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
              example:
                error:
                  reasonCode: validation_error
                  description: >-
                    The request could not be processed due to invalid or missing
                    parameters, or issues with the request body.
                  details:
                    - property: fieldA
                      message: >-
                        Must be between 1 and 35 characters and must not contain
                        any invalid characters
                    - property: items.2.fieldB
                      message: >-
                        Must be between 1 and 35 characters and must not contain
                        any invalid characters
                requestId: 064afbca-5c14-4e27-a92b-b1f76a6d14d3
        '401':
          description: Access to the requested resource is unauthorized.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
        '404':
          description: The requested campaign could not be found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
        '409':
          description: >-
            A conflict occurred while attempting to fulfill your request. The
            resource you are trying to create already exists.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
      security:
        - bearer: []
      summary: Create rule
      tags:
        - Rules
  /v1/campaigns/{campaignId}/rules/{ruleId}:
    patch:
      description: >-
        <span style="background-color:#007bff; color:white; padding:2px 8px;
        border-radius:4px; font-weight:600;">Management</span><br ><br >Update
        rule for a campaign.
            
            
          ### How to set maxTriesResetStrategy

          The `recurrenceType` field determines the frequency of resetting `maxTries`, with the reset period starting at 00:00:00 and ending at 23:59:59 Singapore time:
          - `DAILY`: `maxTries` will be reset daily, allowing you to continue attempting to meet the objective each day.
          - `WEEKLY`: `maxTries` will be reset weekly. You can specify `dayOfWeek` (0 for Sunday through 6 for Saturday) in the `recurrenceSchedule`.
          - `MONTHLY`: `maxTries` will be reset monthly. You can specify `dayOfMonth` (1 through 31) in the `recurrenceSchedule`.
          
          Example usage:
          - For a daily reset of `maxTries`, set `recurrenceType` to `DAILY` and leave `recurrenceSchedule` empty.
          - For a weekly reset on Wednesdays, set `recurrenceType` to `WEEKLY` and `recurrenceSchedule.dayOfWeek` to `3`.
          - For a monthly reset on the 15th, set `recurrenceType` to `MONTHLY` and `recurrenceSchedule.dayOfMonth` to `15`.
          
          ### How to set pointsExpiryStrategy
          
          The `pointsExpiryStrategy` field determines when earned points will expire:
          - `expireAt`: Set a specific date and time for points to expire. The time must always be set to 00:00:00 (start of day) Singapore time.
          - `relativeExpiryDuration`: Set a duration for points to expire relative to when they were earned. Use ISO 8601 duration format. The expiry time will be calculated and then rounded up to the next start of day in Singapore time.

          Example usage for:
          - To set points to expire on November 23, 2023 at midnight Singapore time:
            ```
            "pointsExpiryStrategy": {
              "expireAt": "2023-11-23T00:00:00+08:00"
            }
            ```
          - To set points to expire 1 day after they are earned:
            ```
            "pointsExpiryStrategy": {
              "relativeExpiryDuration": "P1D"
            }
            ```
            
          Concrete examples for relativeExpiryDuration:
          
          Assume points are allotted on 2025-01-24T10:00:00+08:00
          
          1. `P1D` (1 day):
             Points will expire on 2025-01-26T00:00:00+08:00

          2. `P1W` (1 week):
             Points will expire on 2025-02-01T00:00:00+08:00

          3. `P1M` (1 month):
             Points will expire on 2025-02-25T00:00:00+08:00

          4. `P1Y` (1 year):
             Points will expire on 2026-01-25T00:00:00+08:00

          Note: For `relativeExpiryDuration`, the expiry time is always rounded up to the next Singapore Time (SGT) start of day (00:00:00). This ensures that even if points are earned late in the day (e.g., at 11:59 PM), they will still be valid for the full specified duration plus the remainder of that day. For example, points earned at 11:59 PM with a `P1D` duration will expire at 00:00:00 two days later, giving slightly more than 24 hours of validity.

          You should use either `expireAt` or `relativeExpiryDuration`, not both. The `relativeExpiryDuration` only supports whole number values for date components (years, months, weeks, days).
          
      operationId: RulesController_updateRules_v1
      parameters:
        - name: ruleId
          required: true
          in: path
          description: Rule ID
          schema: {}
        - name: campaignId
          required: true
          in: path
          description: Campaign ID
          schema: {}
      requestBody:
        required: true
        description: Payload for updating a rule.
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PatchRuleDTO'
      responses:
        '200':
          description: Rule updated successfully.
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/DataResponseDTO'
                  - properties:
                      data:
                        $ref: '#/components/schemas/RuleEntity'
        '400':
          description: >-
            The request could not be processed due to invalid or missing
            parameters, or issues with the request body.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
              example:
                error:
                  reasonCode: validation_error
                  description: >-
                    The request could not be processed due to invalid or missing
                    parameters, or issues with the request body.
                  details:
                    - property: fieldA
                      message: >-
                        Must be between 1 and 35 characters and must not contain
                        any invalid characters
                    - property: items.2.fieldB
                      message: >-
                        Must be between 1 and 35 characters and must not contain
                        any invalid characters
                requestId: 064afbca-5c14-4e27-a92b-b1f76a6d14d3
        '401':
          description: Access to the requested resource is unauthorized.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
        '404':
          description: The requested rule could not be found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
      security:
        - bearer: []
      summary: Update rule
      tags:
        - Rules
  /v1/campaigns/{campaignId}/rules/{ruleId}/history:
    get:
      description: >-
        <span style="background-color:#007bff; color:white; padding:2px 8px;
        border-radius:4px; font-weight:600;">Management</span><br ><br >Retrieve
        history of changes for a rule of a campaign.
      operationId: RulesController_getAllRuleHistory_v1
      parameters:
        - name: offset
          required: false
          in: query
          description: >-
            The number of records to skip before selecting records. Defaults to
            0.
          schema: {}
        - name: limit
          required: false
          in: query
          description: >-
            The maximum number of records to return. Value must be in the range
            0 - 100. Defaults to 10. 
          schema: {}
        - name: ruleId
          required: true
          in: path
          description: Rule ID
          schema: {}
        - name: campaignId
          required: true
          in: path
          description: Campaign ID
          schema: {}
      responses:
        '200':
          description: Campaign rules change history retrieved successfully.
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/PaginatedDataResponseDTO'
                  - properties:
                      data:
                        type: array
                        items:
                          $ref: '#/components/schemas/RuleEntity'
        '400':
          description: >-
            The request could not be processed due to invalid or missing
            parameters, or issues with the request body.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
              example:
                error:
                  reasonCode: validation_error
                  description: >-
                    The request could not be processed due to invalid or missing
                    parameters, or issues with the request body.
                  details:
                    - property: fieldA
                      message: >-
                        Must be between 1 and 35 characters and must not contain
                        any invalid characters
                    - property: items.2.fieldB
                      message: >-
                        Must be between 1 and 35 characters and must not contain
                        any invalid characters
                requestId: 064afbca-5c14-4e27-a92b-b1f76a6d14d3
        '401':
          description: Access to the requested resource is unauthorized.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
        '404':
          description: The requested campaign could not be found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
      security:
        - bearer: []
      summary: List all campaign rule change history
      tags:
        - Rules
  /v1/tenants/access/partners:
    post:
      description: >-
        <span style="background-color:#007bff; color:white; padding:2px 8px;
        border-radius:4px; font-weight:600;">Management</span><br ><br >Grant
        access of a specified tenant resources to a partner
      operationId: TenantsController_grantTenantAccessToPartner_v1
      parameters: []
      requestBody:
        required: true
        description: Payload for granting tenant access to a partner.
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TenantPartnerDTO'
      responses:
        '201':
          description: Tenant access granted to partner successfully.
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/DataResponseDTO'
                  - properties:
                      data:
                        $ref: '#/components/schemas/TenantPartnerAssignmentEntity'
        '400':
          description: >-
            The request could not be processed due to invalid or missing
            parameters, or issues with the request body.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
              example:
                error:
                  reasonCode: validation_error
                  description: >-
                    The request could not be processed due to invalid or missing
                    parameters, or issues with the request body.
                  details:
                    - property: fieldA
                      message: >-
                        Must be between 1 and 35 characters and must not contain
                        any invalid characters
                    - property: items.2.fieldB
                      message: >-
                        Must be between 1 and 35 characters and must not contain
                        any invalid characters
                requestId: 064afbca-5c14-4e27-a92b-b1f76a6d14d3
        '401':
          description: Access to the requested resource is unauthorized.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
        '409':
          description: >-
            A conflict occurred while attempting to fulfill your request. The
            resource you are trying to create already exists.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
      security:
        - bearer: []
      summary: Grant tenant access to partner
      tags:
        - Tenants
    delete:
      description: >-
        <span style="background-color:#007bff; color:white; padding:2px 8px;
        border-radius:4px; font-weight:600;">Management</span><br ><br >Revoke
        access of a specified tenant resources from a partner.
      operationId: TenantsController_revokeTenantAccessFromPartner_v1
      parameters: []
      requestBody:
        required: true
        description: Payload for revoking tenant access from a partner.
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TenantPartnerDTO'
      responses:
        '204':
          description: Tenant access revoked from partner successfully.
        '400':
          description: >-
            The request could not be processed due to invalid or missing
            parameters, or issues with the request body.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
              example:
                error:
                  reasonCode: validation_error
                  description: >-
                    The request could not be processed due to invalid or missing
                    parameters, or issues with the request body.
                  details:
                    - property: fieldA
                      message: >-
                        Must be between 1 and 35 characters and must not contain
                        any invalid characters
                    - property: items.2.fieldB
                      message: >-
                        Must be between 1 and 35 characters and must not contain
                        any invalid characters
                requestId: 064afbca-5c14-4e27-a92b-b1f76a6d14d3
        '401':
          description: Access to the requested resource is unauthorized.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
      security:
        - bearer: []
      summary: Revoke tenant access from partner
      tags:
        - Tenants
    get:
      description: >-
        <span style="background-color:#007bff; color:white; padding:2px 8px;
        border-radius:4px; font-weight:600;">Management</span><br ><br >Retrieve
        all partners that can access this specified tenant.
      operationId: TenantsController_listTenantPartnersById_v1
      parameters:
        - name: offset
          required: false
          in: query
          description: >-
            The number of records to skip before selecting records. Defaults to
            0.
          schema: {}
        - name: limit
          required: false
          in: query
          description: >-
            The maximum number of records to return. Value must be in the range
            0 - 100. Defaults to 10. 
          schema: {}
      responses:
        '200':
          description: All partners which has access to this tenant retrieved successfully.
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/PaginatedDataResponseDTO'
                  - properties:
                      data:
                        type: array
                        items:
                          $ref: '#/components/schemas/TenantPartnerAssignmentEntity'
        '401':
          description: Access to the requested resource is unauthorized.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
      security:
        - bearer: []
      summary: List all partners that can access this specified tenant.
      tags:
        - Tenants
  /v1/tenants/me:
    get:
      description: >-
        <span style="background-color:#007bff; color:white; padding:2px 8px;
        border-radius:4px; font-weight:600;">Management</span><br ><br >Retrieve
        details for this tenant.
      operationId: TenantsController_getTenantById_v1
      parameters: []
      responses:
        '200':
          description: Tenant details retrieved successfully.
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/DataResponseDTO'
                  - properties:
                      data:
                        $ref: '#/components/schemas/TenantWithCredentialsEntity'
        '401':
          description: Access to the requested resource is unauthorized.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
        '404':
          description: The requested tenant could not be found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
      security:
        - bearer: []
      summary: Get tenant details
      tags:
        - Tenants
  /v1/tenants/credentials:
    post:
      description: >-
        <span style="background-color:#007bff; color:white; padding:2px 8px;
        border-radius:4px; font-weight:600;">Management</span><br ><br >Generate
        new credential for specified tenant.
      operationId: TenantsController_generateTenantCredential_v1
      parameters: []
      responses:
        '201':
          description: Credential created successfully.
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/DataResponseDTO'
                  - properties:
                      data:
                        $ref: '#/components/schemas/CredentialEntity'
        '401':
          description: Access to the requested resource is unauthorized.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
        '404':
          description: The requested tenant could not be found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
        '422':
          description: >-
            The request failed because the maximum number of allowed credentials
            have been reached.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
      security:
        - bearer: []
      summary: Generate new credential for specified tenant
      tags:
        - Tenants
    delete:
      description: >-
        <span style="background-color:#007bff; color:white; padding:2px 8px;
        border-radius:4px; font-weight:600;">Management</span><br ><br >Delete
        existing credential for specified tenant.
      operationId: TenantsController_deleteTenantCredential_v1
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DeleteCredentialDTO'
      responses:
        '204':
          description: Credential deleted from tenant successfully.
        '400':
          description: >-
            The request could not be processed due to invalid or missing
            parameters, or issues with the request body.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
              example:
                error:
                  reasonCode: validation_error
                  description: >-
                    The request could not be processed due to invalid or missing
                    parameters, or issues with the request body.
                  details:
                    - property: fieldA
                      message: >-
                        Must be between 1 and 35 characters and must not contain
                        any invalid characters
                    - property: items.2.fieldB
                      message: >-
                        Must be between 1 and 35 characters and must not contain
                        any invalid characters
                requestId: 064afbca-5c14-4e27-a92b-b1f76a6d14d3
        '401':
          description: Access to the requested resource is unauthorized.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
        '404':
          description: The requested tenant could not be found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
      security:
        - bearer: []
      summary: Delete existing credential for specified tenant
      tags:
        - Tenants
  /v1/campaigns/{campaignId}/webhooks-endpoints:
    post:
      description: >-
        <span style="background-color:#007bff; color:white; padding:2px 8px;
        border-radius:4px; font-weight:600;">Management</span><br ><br >Register
        a webhook
      operationId: WebhooksController_registerWebhook_v1
      parameters:
        - name: campaignId
          required: true
          in: path
          description: Campaign ID
          schema: {}
      requestBody:
        required: true
        description: Payload for registering a webhook
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RegisterWebhookDTO'
      responses:
        '201':
          description: Webhook registered successfully.
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/DataResponseDTO'
                  - properties:
                      data:
                        $ref: '#/components/schemas/WebhookEntity'
        '400':
          description: >-
            The request could not be processed due to invalid or missing
            parameters, or issues with the request body.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
              example:
                error:
                  reasonCode: validation_error
                  description: >-
                    The request could not be processed due to invalid or missing
                    parameters, or issues with the request body.
                  details:
                    - property: fieldA
                      message: >-
                        Must be between 1 and 35 characters and must not contain
                        any invalid characters
                    - property: items.2.fieldB
                      message: >-
                        Must be between 1 and 35 characters and must not contain
                        any invalid characters
                requestId: 064afbca-5c14-4e27-a92b-b1f76a6d14d3
        '401':
          description: Access to the requested resource is unauthorized.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
        '404':
          description: The requested webhook could not be found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
        '409':
          description: >-
            A conflict occurred while attempting to fulfill your request. The
            resource you are trying to create already exists.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
        '422':
          description: >-
            The request failed because the maximum number of webhooks for this
            campaign has been reached.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
      security:
        - bearer: []
      summary: Register a webhook
      tags:
        - Webhooks
    get:
      description: >-
        <span style="background-color:#007bff; color:white; padding:2px 8px;
        border-radius:4px; font-weight:600;">Management</span><br ><br >Retrieve
        all webhooks for a campaign.
      operationId: WebhooksController_listWebhooks_v1
      parameters:
        - name: offset
          required: false
          in: query
          description: >-
            The number of records to skip before selecting records. Defaults to
            0.
          schema: {}
        - name: limit
          required: false
          in: query
          description: >-
            The maximum number of records to return. Value must be in the range
            0 - 100. Defaults to 10. 
          schema: {}
        - name: campaignId
          required: true
          in: path
          description: Campaign ID
          schema: {}
      responses:
        '200':
          description: All webhooks retrieved successfully.
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/PaginatedDataResponseDTO'
                  - properties:
                      data:
                        type: array
                        items:
                          $ref: '#/components/schemas/WebhookEntity'
        '400':
          description: >-
            The request could not be processed due to invalid or missing
            parameters, or issues with the request body.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
              example:
                error:
                  reasonCode: validation_error
                  description: >-
                    The request could not be processed due to invalid or missing
                    parameters, or issues with the request body.
                  details:
                    - property: fieldA
                      message: >-
                        Must be between 1 and 35 characters and must not contain
                        any invalid characters
                    - property: items.2.fieldB
                      message: >-
                        Must be between 1 and 35 characters and must not contain
                        any invalid characters
                requestId: 064afbca-5c14-4e27-a92b-b1f76a6d14d3
        '401':
          description: Access to the requested resource is unauthorized.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
        '404':
          description: The requested campaign could not be found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
      security:
        - bearer: []
      summary: List all webhooks for a campaign
      tags:
        - Webhooks
  /v1/campaigns/{campaignId}/webhooks-endpoints/{webhookId}:
    get:
      description: >-
        <span style="background-color:#007bff; color:white; padding:2px 8px;
        border-radius:4px; font-weight:600;">Management</span><br ><br >Retrieve
        webhook for a campaign.
      operationId: WebhooksController_getWebhook_v1
      parameters:
        - name: webhookId
          required: true
          in: path
          description: Webhook ID
          schema: {}
        - name: campaignId
          required: true
          in: path
          description: Campaign ID
          schema: {}
      responses:
        '200':
          description: Retrieved webhook successfully.
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/DataResponseDTO'
                  - properties:
                      data:
                        $ref: '#/components/schemas/WebhookEntity'
        '401':
          description: Access to the requested resource is unauthorized.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
        '404':
          description: The requested campaign could not be found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
      security:
        - bearer: []
      summary: Get webhook for a campaign
      tags:
        - Webhooks
    patch:
      description: >-
        <span style="background-color:#007bff; color:white; padding:2px 8px;
        border-radius:4px; font-weight:600;">Management</span><br ><br >Update
        webhook for a campaign.
      operationId: WebhooksController_updateWebhook_v1
      parameters:
        - name: webhookId
          required: true
          in: path
          description: Webhook ID
          schema: {}
        - name: campaignId
          required: true
          in: path
          description: Campaign ID
          schema: {}
      requestBody:
        required: true
        description: >-
          Payload for updating a Webhook for a campaign. Available fields for
          update: url, description, enabledEvents, isActive
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateWebhookDTO'
      responses:
        '200':
          description: Webhook updated successfully.
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/DataResponseDTO'
                  - properties:
                      data:
                        $ref: '#/components/schemas/WebhookEntity'
        '400':
          description: >-
            The request could not be processed due to invalid or missing
            parameters, or issues with the request body.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
              example:
                error:
                  reasonCode: validation_error
                  description: >-
                    The request could not be processed due to invalid or missing
                    parameters, or issues with the request body.
                  details:
                    - property: fieldA
                      message: >-
                        Must be between 1 and 35 characters and must not contain
                        any invalid characters
                    - property: items.2.fieldB
                      message: >-
                        Must be between 1 and 35 characters and must not contain
                        any invalid characters
                requestId: 064afbca-5c14-4e27-a92b-b1f76a6d14d3
        '401':
          description: Access to the requested resource is unauthorized.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
        '404':
          description: The requested campaign could not be found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
      security:
        - bearer: []
      summary: Update webhook
      tags:
        - Webhooks
  /v1/webhooks/signatures/public-keys:
    get:
      description: >-
        <span style="background-color:#007bff; color:white; padding:2px 8px;
        border-radius:4px; font-weight:600;">Management</span><br ><br >Retrieve
        public key to verify webhook signature.
      operationId: WebhooksController_getGovRewardsPublicKey_v1
      parameters: []
      responses:
        '200':
          description: Retrieved webhook signature successfully.
          content:
            application/json:
              schema:
                type: array
                items:
                  type: object
                  properties:
                    version:
                      type: number
                      example: 1
                      description: >-
                        Version of public key. Currently only version 1 is
                        available.
                    publicKey:
                      type: string
                      example: >-
                        7a957d7a51937cee04ee2bd57468351751df69a2a8c279df3e414c573ca92123
                      description: >-
                        Public key used to verify the signature in the webhook
                        header.
        '401':
          description: Access to the requested resource is unauthorized.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
      security:
        - bearer: []
      summary: Get public key to verify webhook signature
      tags:
        - Webhooks
info:
  title: GovRewards Tenant API Specifications
  description: >-
    GovRewards Tenant API Specifications


      ## Authentication & Authorization

    For all endpoints, you will need to authenticate requests using the OAuth2.0
    Client Credentials Grant flow.


    First, you need to obtain an access token by authenticating with the
    OAuth2.0 authorization server using your client credentials (client ID and
    client secret). This token is short-lived and must be used to sign your
    requests. The process involves the following steps:


    **1. Obtain Access Token**
       - Send a POST request to the token endpoint of the authorization server (`https://apps.auth.rewards.gov.sg/oauth2/token`) with your client credentials.
       - Refer to the [AWS Cognito OAuth2.0 Client Credentials Grant flow documentation](https://docs.aws.amazon.com/cognito/latest/developerguide/token-endpoint.html#post-token) for detailed instructions on obtaining an access token using the Token Endpoint.
       
    **2. Use Access Token**

    - Once you have the access token, include it in the `Authorization` header
    of your HTTP requests to the API endpoints. 

    - The token should be prefixed with the type `Bearer`.


    **Example Request to Obtain Access Token**


    ```bash

    POST /oauth2/token HTTP/2

    Host: apps.auth.rewards.gov.sg

    Content-Type: application/x-www-form-urlencoded


    grant_type=client_credentials&client_id=YOUR_CLIENT_ID&client_secret=YOUR_CLIENT_SECRET

    ```


    **Example Response**

    ```json

    {
      "access_token": "YOUR_ACCESS_TOKEN",
      "token_type": "Bearer",
      "expires_in": 3600
    }

    ```
      

    ___


    ## Idempotency


    Idempotency ensures repeated identical requests produce the same result
    without causing unintended side effects. This is particularly vital for
    operations where network issues or client retries might lead to multiple
    identical requests being sent. By adhering to idempotency, our API
    guarantees that actions such as creating or updating resources can be
    performed safely multiple times without altering the final outcome beyond
    the first successful request. Implementing idempotency enhances the
    reliability, predictability, and robustness of our API, providing a
    consistent and dependable user experience.


    Only POST endpoints which accept the header `x-idempotency-key` can have
    idempotent requests. DELETE and GET are idempotent by design so they do not
    require the header.


    Including an `x-idempotency-key` header makes request idempotent. It has
    several properties:


    - The `x-idempotency-key` is required for endpoints that accepts this
    header.


    - Each idempotency key is valid for 24 hours.


    - The idempotency key has to be a valid UUID.


    - Calling subsequent requests with the same `x-idempotency-key` within the
    24-hour window will return an `idempotent-replayed` header. These subsequent
    requests will not cause duplicate transactions.


    - When the `idempotent-replayed` header is returned, the HTTP status code of
    the response will match the first request's response HTTP status code.


    ___



    ## Rate Limiting


    To ensure fair use and maintain system stability, the **GovRewards API**
    implements rate limiting at the **tenant** level.


    ### Rate Limit Configuration


    | Plan    | Requests per Second | Time Window (TTL) | Block Duration
    (Seconds) | Description                       |

    |------------------|----------------------|--------------------|--------------------------|-----------------------------------|

    | tenant-basic     | 1000                 | 1 second           | 5
    seconds               | Default tenant-level throttling   |


    *Note: Additional throttlers and adjustments to the rate limits may be
    introduced as the platform evolves.*  


    ### Response Headers for Rate Limiting


    Every API response will include the following headers:


    | Header                                   |
    Description                                              | Example Value |

    |------------------------------------------|----------------------------------------------------------|---------------|

    | `X-RateLimit-Limit-<PLAN>`         | The maximum number of requests
    allowed in the time window. Only shown when the rate limit has not been
    exceeded. | `1000`        |

    | `X-RateLimit-Remaining-<PLAN>`     | The number of requests remaining in
    the current window. Only shown when the rate limit has not been exceeded.   
    | `0`           |

    | `X-RateLimit-Reset-<PLAN>`         | The number of seconds until the rate
    limit resets. Only shown when the rate limit has not been exceeded.        
    | `1`           |

    | `Retry-After-<PLAN>`               | The number of seconds to wait before
    retrying after a block. Only shown when the rate limit has been exceeded. |
    `5`           |


    ### Rate Limit Exceeded Response


    If the rate limit is exceeded, the API will respond with:


    **HTTP Status:** `429 Too Many Requests`  

    **Example Response:**


    ```json

    {
      "error": {
        "reasonCode": "too_many_requests",
        "description": "The request failed because the rate limit for this endpoint has been exceeded.",
        "details": []
      },
      "requestId": "88fcd476-e3a2-43c1-b290-31fbdb91aebe"
    }

    ```
      

    ___



    ## Client-Toggled Feature Flags


    Client-toggled feature flags are feature flags that can be enabled by the
    API client per request. This allows tenants to test and enable a new feature
    at their own timing. These feature flags will only be available for a period
    of time, after which, the feature will be enabled by default.


    ### Usage


    To enable a client-toggled feature flag, add the header `x-feature-flags:
    feature_flag_1,feature_flag_2` to the request. If the feature flag is
    supported for the API endpoint, it will be added to the response header.
    Otherwise, it will be ignored.
     
    For example, if `feature_flag_1` and `feature_flag_2` are passed in, but
    only `feature_flag_1` is supported by the API endpoint, the response header
    will be `x-feature-flags-enabled: feature_flag_1`.


    **Example Request**

    ```bash

    curl --header "x-feature-flags: feature_flag_1,feature_flag_2"
    https://api.rewards.gov.sg/api/v1/campaigns

    ```


    **Example Response Header** (Only `feature_flag_1` is supported)

    ```bash

    x-feature-flags-enabled: feature_flag_1

    ```


    ### Supported Feature Flags


    There are no supported client-toggled feature flags at the moment.




    ___


    ## Error Reason Codes


    | Reason Codes | Description |

    |-----|-----|

    | validation_error | The request could not be processed due to invalid or
    missing parameters, or issues with the request body. |

    | forbidden | Access to the requested resource is forbidden. |

    | unauthorized | Access to the requested resource is unauthorized. |

    | resource_already_exists | A conflict occurred while attempting to fulfill
    your request. The resource you are trying to create already exists. |

    | internal_server_error | An unexpected error occurred on the server while
    processing your request. |

    | not_found_error | The requested resource could not be found. |

    | partner_not_found | The requested partner could not be found. |

    | campaign_not_found | The requested campaign could not be found. |

    | tenant_not_found | The requested tenant could not be found. |

    | non_disburseplus_tenant | The requested tenant is not allowed to use
    Disburse Plus |

    | account_not_found | The requested account could not be found. |

    | rule_not_found | The requested rule could not be found. |

    | objective_not_found | The requested objective could not be found. |

    | action_not_found | The requested action could not be found. |

    | transaction_not_found | The requested points transaction could not be
    found. |

    | redemption_item_not_found | The requested redemption item could not be
    found. |

    | redemption_item_provider_config_not_found | The requested redemption item
    provider config could not be found |

    | not_implemented | The request could not be processed due to functionality
    not implemented. |

    | redemption_rule_violation | The request failed because it did not meet the
    specified redemption rule. |

    | unprocessable_entity | The request was well-formed but was unable to
    process the contained instructions. |

    | insufficient_points | The request failed because of insufficient points. |

    | redemption_item_not_activated | The requested redemption item is not
    active. |

    | redemption_item_provider_not_configured | The requested redemption item
    has no provider configured. |

    | insufficient_quantity_available | The requested redemption item has
    insufficient quantity available for redemption. |

    | db_write_retries_exceeded | The system has exceeded the maximum number of
    retries for writing to the database. This may indicate a persistent issue
    with the database or high contention on the resource. |

    | account_inactive | The requested account is not active. |

    | batch_processing_failed | Batch processing has failed |

    | webhook_not_found | The requested webhook could not be found. |

    | max_webhook_limit_hit | The request failed because the maximum number of
    webhooks for this campaign has been reached. |

    | user_not_found | The requested user could not be found. |

    | same_account_transfer | The request failed because the sender and receiver
    accounts cannot be the same if they are from the same campaign. |

    | tenant_owner_already_assigned | The request failed because the tenant has
    already been assigned to an owner. |

    | max_redemptions_limit_hit | The request failed because the maximum number
    of redemptions for this item and account have been reached. |

    | max_credentials_limit_hit | The request failed because the maximum number
    of allowed credentials have been reached. |

    | user_already_admin | The request failed because this user has already been
    assigned as admin. |

    | action_provider_not_found | The requested action provider could not be
    found. |

    | formsg_already_exists | The request failed because the provided FormSG
    form already exists. |

    | campaign_tier_not_found | The requested campaign tier could not be found.
    |

    | duplicate_campaign_id | The request failed because a duplicate campaign ID
    was found. |

    | duplicate_account_identifiers | The request failed because a duplicate
    account identifier was found. |

    | duplicate_tier_priorities | The list of tiers cannot have duplicate
    priorities. |

    | duplicate_tier_ids | The list of tiers cannot have duplicate ids. |

    | incorrect_tier_count | Incorrect number of tiers provided. |

    | too_many_requests | The request failed because the rate limit for this
    endpoint has been exceeded. |



    ___


      
      ## Conditions
      
      Conditions define the criteria that must be met for an action to be valid, such as redeeming a reward. 
      Each condition consists of a name, an operator, and a value, which are evaluated to determine eligibility.
      
      
    | **Name** | **Details** |

    |--------------------|------------|

    | **account.tier** | **Description:** The value provided should be the ID of
    a campaign tier.<br> **Allowed Rule Types:** REDEMPTION<br> **Allowed
    Operators:** in, notIn |

    | **action** | **Description:** The value provided should be the name of the
    action.<br> **Allowed Rule Types:** ALLOTMENT<br> **Allowed Operators:**
    equal |

    | **formSG.formId** | **Description:** The value provided should be the form
    ID of the FormSG.<br> **Allowed Rule Types:** ALLOTMENT<br> **Allowed
    Operators:** equal |

    | **goventry.venue** | **Description:** The value provided should be the
    name of a GovEntry venue.<br> **Allowed Rule Types:** ALLOTMENT<br>
    **Allowed Operators:** equal |

      

    <sub>build.1.9.21</sub>
  version: '1.0'
  contact: {}
tags:
  - name: Webhook Events
    description: ''
components:
  securitySchemes:
    bearer:
      scheme: bearer
      bearerFormat: JWT
      type: http
  schemas:
    ErrorResponseDetailDTO:
      type: object
      properties:
        reasonCode:
          type: string
          description: The reason codes of the error
        description:
          type: string
          description: A description of the error
        details:
          description: Additional details about the error
          example: []
          properties: {}
          type: array
          items:
            type: object
      required:
        - reasonCode
        - description
        - details
    ErrorResponseDTO:
      type: object
      properties:
        error:
          description: Error details
          allOf:
            - $ref: '#/components/schemas/ErrorResponseDetailDTO'
        requestId:
          type: string
          description: Request ID
          example: 064afbca-5c14-4e27-a92b-b1f76a6d14d3
      required:
        - error
        - requestId
    DataResponseDTO:
      type: object
      properties:
        data:
          type: object
      required:
        - data
    Expiries:
      type: object
      properties:
        remainingPoints:
          type: number
          example: 100
          description: The remaining points for redemption
        initialPoints:
          type: number
          example: 300
          description: The total initial points allotted
        expireAt:
          format: date-time
          type: string
          example: '2024-03-06T00:00:00+08:00'
          description: 'Expiry date of the current point balance '
      required:
        - remainingPoints
        - initialPoints
        - expireAt
    AccountCampaignTier:
      type: object
      properties:
        id:
          type: string
          description: The identifier of the campaign tier
          example: f39854be-46f2-492f-9dd8-042e5719f05f
        name:
          type: string
          description: The name of the campaign tier
          example: Bronze
        updatedAt:
          type: string
          description: The updated timestamp of the campaign tier for the account
          example: '2023-11-22T16:57:12+08:00'
      required:
        - id
        - name
        - updatedAt
    AccountCampaignDetailsEntity:
      type: object
      properties:
        campaignId:
          type: string
          description: The ID of the campaign this account is created for
          example: 8bc8887b-87a0-46d2-b971-3d86b7652ad5
        campaignName:
          type: string
          description: The name of the campaign this account is created for
          example: My Campaign
        campaignDescription:
          type: string
          description: The description of the campaign this account is created for
          example: My Campaign Description
        campaignSid:
          type: string
          description: The Short ID of the campaign this account is created for
          example: my_campaign
        isActive:
          type: boolean
          description: Whether this account is active or not
        metadata:
          type: object
          description: >-
            Metadata for this account for this specified campaign. Metadata must
            be stored as a key-value pair, with both key and value as a valid
            string.
          example:
            team: rocket
        tenantId:
          type: string
          description: The identifier of the tenant.
          example: f0ace06c-ae34-4998-9cbd-6aeb384e7710
        balance:
          type: number
          description: The points balance for this campaign
          example: 100
        expiries:
          description: >-
            A list of points balances and their respective expiry dates. Points
            that do not have an expiry will not be listed here
          type: array
          items:
            $ref: '#/components/schemas/Expiries'
        createdAt:
          type: string
          description: The creation timestamp of the specified account
          example: '2023-11-22T16:57:12+08:00'
        updatedAt:
          type: string
          description: The updated timestamp of the specified account
          example: '2023-11-22T16:57:12+08:00'
        totalPointsCredited:
          type: number
          description: >-
            The total points credited to the account for this campaign. This
            only includes ALLOT and TRANSFER_IN transactions.
          example: 100
        tier:
          description: >-
            The tier of the account. If the account does not belong to any tier,
            it will be null.
          nullable: true
          allOf:
            - $ref: '#/components/schemas/AccountCampaignTier'
      required:
        - campaignId
        - campaignName
        - campaignDescription
        - campaignSid
        - isActive
        - metadata
        - tenantId
        - balance
        - expiries
        - createdAt
        - updatedAt
        - totalPointsCredited
        - tier
    AccountDetailsEntity:
      type: object
      properties:
        identifier:
          type: string
          description: The identifier of this account.
          example: test@example.com
        accountCampaignDetails:
          description: Account campaign details
          type: array
          items:
            $ref: '#/components/schemas/AccountCampaignDetailsEntity'
      required:
        - identifier
        - accountCampaignDetails
    BatchCreateAccountCampaignsFailedRecord:
      type: object
      properties:
        campaignId:
          type: string
          description: The identifier of the campaign
          example: f39854be-46f2-492f-9dd8-042e5719f05f
        error:
          description: Error information related to the failure
          example:
            reasonCode: duplicate_campaign_id
            description: The request failed because a duplicate campaign ID was found.
            details: []
          allOf:
            - $ref: '#/components/schemas/ErrorResponseDetailDTO'
        reason:
          type: string
          deprecated: true
          description: Reason for failure
          example: The request failed because a duplicate campaign ID was found.
      required:
        - campaignId
        - error
        - reason
    BatchCreateAccountCampaignsEntity:
      type: object
      properties:
        totalRecords:
          type: number
          description: Total number of records processed in the batch.
        totalSuccessfulRecords:
          type: number
          description: Total number of successful records processed.
        totalFailedRecords:
          type: number
          description: Total number of failed records processed.
        successRecords:
          description: >-
            List of successfully processed records, each containing the account
            details.
          type: array
          items:
            $ref: '#/components/schemas/AccountDetailsEntity'
        failedRecords:
          description: >-
            List of records that failed to process, each containing the campaign
            id and the reason for failure.
          type: array
          items:
            $ref: '#/components/schemas/BatchCreateAccountCampaignsFailedRecord'
      required:
        - totalRecords
        - totalSuccessfulRecords
        - totalFailedRecords
        - successRecords
        - failedRecords
    CampaignInfoDTO:
      type: object
      properties:
        id:
          type: string
          description: Campaign ID to add this account to.
          example: 477b566e-0199-4f90-8832-d8d3df2eda4b
        accountMetadata:
          type: object
          description: >-
            metadata for this account for this specified campaign. Metadata must
            be stored as a key-value pair, with both `key` and `value` as a
            valid string.


            `key`: Only lowercase alphanumeric and underscores of length 3 to 20
            characters are allowed.


            `value`: Only ASCII printable characters (except `<`, `=` and `>`)
            of length 1 to 250 are allowed. 
                  
            A maximum of 20 metadata key-value pairs are allowed.
          default: {}
          example:
            team: rocket
      required:
        - id
    BatchCreateAccountCampaignsDTO:
      type: object
      properties:
        identifier:
          type: string
          description: >-
            Identifier value. Only ASCII printable characters (except `<` and
            `>`) of length 1 to 255 are allowed.


            Note that this value will be trimmed (i.e. leading and trailing
            whitespaces will be removed).
          example: user@example.com
        campaigns:
          description: List of campaigns to add this account to.
          type: array
          items:
            $ref: '#/components/schemas/CampaignInfoDTO'
      required:
        - identifier
        - campaigns
    PaginationMetadata:
      type: object
      properties:
        count:
          type: number
          example: 1
        limit:
          type: object
          example: 10
        offset:
          type: object
          example: 0
        total:
          type: number
          example: 1
      required:
        - count
        - limit
        - offset
        - total
    PaginatedDataResponseDTO:
      type: object
      properties:
        data:
          type: object
        pagination:
          $ref: '#/components/schemas/PaginationMetadata'
      required:
        - data
        - pagination
    RetrieveAccountDTO:
      type: object
      properties:
        identifier:
          type: string
          description: >-
            Identifier value. Only ASCII printable characters (except `<` and
            `>`) of length 1 to 255 are allowed.


            Note that this value will be trimmed (i.e. leading and trailing
            whitespaces will be removed).
          example: user@example.com
      required:
        - identifier
    AccountActionEntity:
      type: object
      properties:
        campaignId:
          type: string
          description: Campaign ID
          example: 0610a0ee-6ceb-45ef-8255-f25580b12356
        createdAt:
          type: string
          description: The creation timestamp of the specified action
          example: '2023-11-22T16:57:12+08:00'
        externalReferenceId:
          type: string
          description: The reference no of the specified action
          example: 2-0UQYi8RLz4kPjkWZ
        name:
          type: string
          description: The name of the action
          example: action_a
          nullable: true
        updatedAt:
          type: string
          description: The updated timestamp of the specified action
          example: '2023-11-22T16:57:12+08:00'
        status:
          type: string
          enum:
            - PROCESSED
            - FAILED
            - PENDING
          description: >-
            Indicates the current status of the evaluation process, with
            detailed reasons available in the 'evaluationReason' field. Possible
            values include:
              
            - **PENDING**: The evaluation has started and the system is still
            processing the necessary rules and actions.

            - **PROCESSED**: The evaluation has been successfully completed, and
            the outcome is finalized.

            - **FAILED**: The evaluation could not be completed due to an error
            or issue.
          example: PENDING
        evaluationReason:
          type: string
          enum:
            - RULES_NOT_FOUND
            - OBJECTIVE_NOT_FOUND
            - RULES_PARSING_ERROR
            - INVALID_ACTION
            - MAX_TRIES_HIT
            - NO_VALID_OUTCOMES
            - ERROR_OCCURRED
            - null
          nullable: true
          description: >-
            The reason for the evaluation result. Possible values include:


            **PROCESSED:**

            - **null**: The evaluation was successful and points were allotted.

            - **RULES_NOT_FOUND**: The evaluation was processed but no rules
            were found to evaluate against.

            - **INVALID_ACTION**: The evaluation was processed but the action
            did not meet any criteria. No points were allotted.

            - **MAX_TRIES_HIT**: The evaluation was processed but the maximum
            number of allowed attempts for the specified participant was
            reached. No points were allotted.

            - **NO_VALID_OUTCOMES**: The evaluation was processed but none of
            the conditions resulted in a valid outcome. No points were allotted.


            **FAILED:**

            - **OBJECTIVE_NOT_FOUND**: The evaluation failed because objective
            could not be found using the provided objectiveId.

            - **RULES_PARSING_ERROR**: The evaluation failed because the
            campaign's rule was missing a ruleId, preventing proper parsing.

            - **INVALID_ACTION**: The evaluation failed as the campaign's rule
            has undefined points and objectiveId.

            - **ERROR_OCCURRED**: The evaluation failed due to an unexpected
            error.
          example: MAX_TRIES_HIT
        data:
          type: object
          description: The data of the action
          example:
            formSG:
              formId: '1234567890'
      required:
        - campaignId
        - createdAt
        - externalReferenceId
        - name
        - updatedAt
        - status
        - evaluationReason
        - data
    AccountActionWithIdentifierEntity:
      type: object
      properties:
        identifier:
          type: string
          description: The identifier of this account.
          example: test@example.com
        action:
          description: Action registered
          allOf:
            - $ref: '#/components/schemas/AccountActionEntity'
      required:
        - identifier
        - action
    RegisterActionDTO:
      type: object
      properties:
        identifier:
          type: string
          description: >-
            Identifier value. Only ASCII printable characters (except `<` and
            `>`) of length 1 to 255 are allowed.


            Note that this value will be trimmed (i.e. leading and trailing
            whitespaces will be removed).
          example: user@example.com
        name:
          type: string
          description: >-
            Name of the action. Only ASCII printable characters (except `<`, `=`
            and `>`) of length 1 to 250 are allowed.
          example: action_a
      required:
        - identifier
        - name
    AccountActionFailureDetails:
      type: object
      properties:
        identifier:
          type: string
          description: The identifier of this account.
          example: test@example.com
        name:
          type: string
          description: The name of the action
          example: action_a
          nullable: true
        index:
          type: number
          description: Index of the failing action in payload
          example: 0
      required:
        - identifier
        - name
        - index
    AccountActionFailureRecord:
      type: object
      properties:
        action:
          description: Details of the failed action
          allOf:
            - $ref: '#/components/schemas/AccountActionFailureDetails'
        error:
          description: Error information related to the failure
          example:
            reasonCode: account_not_found
            description: The requested account could not be found.
            details: []
          allOf:
            - $ref: '#/components/schemas/ErrorResponseDetailDTO'
      required:
        - action
        - error
    BatchAccountActionWithIdentifierEntity:
      type: object
      properties:
        totalRecords:
          type: number
          description: Total number of records processed in the bulk.
        totalSuccessfulRecords:
          type: number
          description: Total number of successful records processed.
        totalFailedRecords:
          type: number
          description: Total number of failed records processed.
        successRecords:
          description: List of successfully processed records
          type: array
          items:
            $ref: '#/components/schemas/AccountActionWithIdentifierEntity'
        failedRecords:
          description: List of records that failed to process.
          type: array
          items:
            $ref: '#/components/schemas/AccountActionFailureRecord'
      required:
        - totalRecords
        - totalSuccessfulRecords
        - totalFailedRecords
        - successRecords
        - failedRecords
    BatchRegisterActionsDTO:
      type: object
      properties:
        actions:
          description: List of actions to be registered
          type: array
          items:
            $ref: '#/components/schemas/RegisterActionDTO'
      required:
        - actions
    PointsTransactionEntity:
      type: object
      properties:
        campaignId:
          type: string
          description: The ID of the campaign associate to the account
          example: 8bc8887b-87a0-46d2-b971-3d86b7652ad5
        description:
          type: string
          description: The description of the transaction
          example: This transaction is for xxx
          nullable: true
        transactionId:
          type: string
          description: The ID of the transaction
          example: Dz7WaF1Q4QnSrXuq
        type:
          type: string
          enum:
            - ALLOT
            - REDEEM
            - EXPIRE
            - TRANSFER_IN
            - TRANSFER_OUT
            - DEDUCT
          description: Indicate type of transaction
          example: ALLOT
        points:
          type: number
          description: The points credited (+) or debited (-) for the transaction
          example: 100
        updatedAt:
          type: string
          description: The updated timestamp of the specified transaction
          example: '2023-11-22T16:57:12+08:00'
        createdAt:
          type: string
          description: The creation timestamp of the specified transaction
          example: '2023-11-22T16:57:12+08:00'
        status:
          type: string
          enum:
            - PENDING
            - SUCCESSFUL
            - FAILED
          description: The status of the points transaction
          example: SUCCESSFUL
      required:
        - campaignId
        - transactionId
        - type
        - points
        - updatedAt
        - createdAt
        - status
    AccountObjectiveWithPointsTransactionEntity:
      type: object
      properties:
        campaignId:
          type: string
          description: Campaign ID
          example: 0610a0ee-6ceb-45ef-8255-f25580b12356
        completedAt:
          type: string
          description: The completion timestamp of the specified objective
          example: '2023-11-22T16:57:12+08:00'
        createdAt:
          type: string
          description: The creation timestamp of the specified objective
          example: '2023-11-22T16:57:12+08:00'
        externalReferenceId:
          type: string
          description: The reference no of the specified objective
          example: 2-0UQYi8RLz4kPjkWZ
        objectiveId:
          type: string
          description: The identifier of the objective
          example: f39854be-46f2-492f-9dd8-042e5719f05f
        updatedAt:
          type: string
          description: The updated timestamp of the specified objective
          example: '2023-11-22T16:57:12+08:00'
        name:
          type: string
          description: The name of the objective
          example: Objective A
        description:
          type: string
          description: The description of the objective
          example: This is Objective A
          nullable: true
        transaction:
          description: Details of the transaction
          allOf:
            - $ref: '#/components/schemas/PointsTransactionEntity'
      required:
        - campaignId
        - completedAt
        - createdAt
        - externalReferenceId
        - objectiveId
        - updatedAt
        - name
        - description
        - transaction
    AccountActionWithObjectivesEntity:
      type: object
      properties:
        campaignId:
          type: string
          description: Campaign ID
          example: 0610a0ee-6ceb-45ef-8255-f25580b12356
        createdAt:
          type: string
          description: The creation timestamp of the specified action
          example: '2023-11-22T16:57:12+08:00'
        externalReferenceId:
          type: string
          description: The reference no of the specified action
          example: 2-0UQYi8RLz4kPjkWZ
        name:
          type: string
          description: The name of the action
          example: action_a
          nullable: true
        updatedAt:
          type: string
          description: The updated timestamp of the specified action
          example: '2023-11-22T16:57:12+08:00'
        status:
          type: string
          enum:
            - PROCESSED
            - FAILED
            - PENDING
          description: >-
            Indicates the current status of the evaluation process, with
            detailed reasons available in the 'evaluationReason' field. Possible
            values include:
              
            - **PENDING**: The evaluation has started and the system is still
            processing the necessary rules and actions.

            - **PROCESSED**: The evaluation has been successfully completed, and
            the outcome is finalized.

            - **FAILED**: The evaluation could not be completed due to an error
            or issue.
          example: PENDING
        evaluationReason:
          type: string
          enum:
            - RULES_NOT_FOUND
            - OBJECTIVE_NOT_FOUND
            - RULES_PARSING_ERROR
            - INVALID_ACTION
            - MAX_TRIES_HIT
            - NO_VALID_OUTCOMES
            - ERROR_OCCURRED
            - null
          nullable: true
          description: >-
            The reason for the evaluation result. Possible values include:


            **PROCESSED:**

            - **null**: The evaluation was successful and points were allotted.

            - **RULES_NOT_FOUND**: The evaluation was processed but no rules
            were found to evaluate against.

            - **INVALID_ACTION**: The evaluation was processed but the action
            did not meet any criteria. No points were allotted.

            - **MAX_TRIES_HIT**: The evaluation was processed but the maximum
            number of allowed attempts for the specified participant was
            reached. No points were allotted.

            - **NO_VALID_OUTCOMES**: The evaluation was processed but none of
            the conditions resulted in a valid outcome. No points were allotted.


            **FAILED:**

            - **OBJECTIVE_NOT_FOUND**: The evaluation failed because objective
            could not be found using the provided objectiveId.

            - **RULES_PARSING_ERROR**: The evaluation failed because the
            campaign's rule was missing a ruleId, preventing proper parsing.

            - **INVALID_ACTION**: The evaluation failed as the campaign's rule
            has undefined points and objectiveId.

            - **ERROR_OCCURRED**: The evaluation failed due to an unexpected
            error.
          example: MAX_TRIES_HIT
        data:
          type: object
          description: The data of the action
          example:
            formSG:
              formId: '1234567890'
        accountObjectives:
          description: >-
            Details of the objective completed after this action was
            successfully evaluated. Will be undefined if
            `includeAdditionalDetails` is set to false. This list will be empty
            if the action evaluation did not result in any objective completion.
          type: array
          items:
            $ref: '#/components/schemas/AccountObjectiveWithPointsTransactionEntity'
      required:
        - campaignId
        - createdAt
        - externalReferenceId
        - name
        - updatedAt
        - status
        - evaluationReason
        - data
    AccountActionsEntity:
      type: object
      properties:
        identifier:
          type: string
          description: The identifier of this account.
          example: test@example.com
        actions:
          description: List of all actions registered
          type: array
          items:
            $ref: '#/components/schemas/AccountActionWithObjectivesEntity'
      required:
        - identifier
        - actions
    AccountActionWithObjectivesAndIdentifierEntity:
      type: object
      properties:
        identifier:
          type: string
          description: The identifier of this account.
          example: test@example.com
        action:
          description: Action registered
          allOf:
            - $ref: '#/components/schemas/AccountActionWithObjectivesEntity'
      required:
        - identifier
        - action
    AccountObjectiveWithPointsAndActionsEntity:
      type: object
      properties:
        campaignId:
          type: string
          description: Campaign ID
          example: 0610a0ee-6ceb-45ef-8255-f25580b12356
        completedAt:
          type: string
          description: The completion timestamp of the specified objective
          example: '2023-11-22T16:57:12+08:00'
        createdAt:
          type: string
          description: The creation timestamp of the specified objective
          example: '2023-11-22T16:57:12+08:00'
        externalReferenceId:
          type: string
          description: The reference no of the specified objective
          example: 2-0UQYi8RLz4kPjkWZ
        objectiveId:
          type: string
          description: The identifier of the objective
          example: f39854be-46f2-492f-9dd8-042e5719f05f
        updatedAt:
          type: string
          description: The updated timestamp of the specified objective
          example: '2023-11-22T16:57:12+08:00'
        name:
          type: string
          description: The name of the objective
          example: Objective A
        description:
          type: string
          description: The description of the objective
          example: This is Objective A
          nullable: true
        points:
          type: number
          description: The points credited for the transaction
          example: 100
        transactionId:
          type: string
          description: The identifier of the transaction
          example: 4E9Tu8wDImquVxcF
        actions:
          description: List of actions associated with the completed objective.
          type: array
          items:
            $ref: '#/components/schemas/AccountActionEntity'
      required:
        - campaignId
        - completedAt
        - createdAt
        - externalReferenceId
        - objectiveId
        - updatedAt
        - name
        - description
        - points
        - transactionId
        - actions
    AccountObjectivesWithPointsAndActionsEntity:
      type: object
      properties:
        identifier:
          type: string
          description: The identifier of this account.
          example: test@example.com
        objectives:
          description: List of completed objectives for a specified account
          type: array
          items:
            $ref: '#/components/schemas/AccountObjectiveWithPointsAndActionsEntity'
      required:
        - identifier
        - objectives
    AccountCampaignTransactionsEntity:
      type: object
      properties:
        transactionId:
          type: string
          description: The ID of the transaction
        points:
          type: number
          description: The points credited (+) or debited (-) for the transaction
          example: 100
        type:
          type: string
          enum:
            - ALLOT
            - REDEEM
            - EXPIRE
            - TRANSFER_IN
            - TRANSFER_OUT
            - DEDUCT
          description: The type of transaction
          example: ALLOT
        updatedAt:
          type: string
          description: The updated timestamp of the specified transaction
          example: '2023-11-22T16:57:12+08:00'
        createdAt:
          type: string
          description: The creation timestamp of the specified transaction
          example: '2023-11-22T16:57:12+08:00'
        description:
          type: string
          description: The description of the transaction
          example: This transaction is for xxx
          nullable: true
        campaignId:
          type: string
          description: The identifier of the campaign
          example: f39854be-46f2-492f-9dd8-042e5719f05f
        status:
          type: string
          enum:
            - PENDING
            - SUCCESSFUL
            - FAILED
          description: The status of the points transaction
          example: SUCCESSFUL
      required:
        - transactionId
        - points
        - type
        - updatedAt
        - createdAt
        - description
        - campaignId
        - status
    AccountTransactionsEntity:
      type: object
      properties:
        identifier:
          type: string
          description: The identifier of this account.
          example: test@example.com
        transactions:
          description: Transaction history details
          type: array
          items:
            $ref: '#/components/schemas/AccountCampaignTransactionsEntity'
      required:
        - identifier
        - transactions
    PointsTransactionSubsetEntity:
      type: object
      properties:
        description:
          type: string
          description: The description of the transaction
          example: This transaction is for xxx
          nullable: true
        transactionId:
          type: string
          description: The ID of the transaction
          example: Dz7WaF1Q4QnSrXuq
        type:
          type: string
          enum:
            - ALLOT
            - REDEEM
            - EXPIRE
            - TRANSFER_IN
            - TRANSFER_OUT
            - DEDUCT
          description: Indicate type of transaction
          example: ALLOT
        points:
          type: number
          description: The points credited (+) or debited (-) for the transaction
          example: 100
        status:
          type: string
          enum:
            - PENDING
            - SUCCESSFUL
            - FAILED
          description: The status of the points transaction
          example: SUCCESSFUL
      required:
        - transactionId
        - type
        - points
        - status
    AccountActionSubsetEntity:
      type: object
      properties:
        externalReferenceId:
          type: string
          description: The reference no of the specified action
          example: 2-0UQYi8RLz4kPjkWZ
        name:
          type: string
          description: The name of the action
          example: action_a
          nullable: true
        status:
          type: string
          enum:
            - PROCESSED
            - FAILED
            - PENDING
          description: >-
            Indicates the current status of the evaluation process, with
            detailed reasons available in the 'evaluationReason' field. Possible
            values include:
              
            - **PENDING**: The evaluation has started and the system is still
            processing the necessary rules and actions.

            - **PROCESSED**: The evaluation has been successfully completed, and
            the outcome is finalized.

            - **FAILED**: The evaluation could not be completed due to an error
            or issue.
          example: PENDING
        evaluationReason:
          type: string
          enum:
            - RULES_NOT_FOUND
            - OBJECTIVE_NOT_FOUND
            - RULES_PARSING_ERROR
            - INVALID_ACTION
            - MAX_TRIES_HIT
            - NO_VALID_OUTCOMES
            - ERROR_OCCURRED
            - null
          nullable: true
          description: >-
            The reason for the evaluation result. Possible values include:


            **PROCESSED:**

            - **null**: The evaluation was successful and points were allotted.

            - **RULES_NOT_FOUND**: The evaluation was processed but no rules
            were found to evaluate against.

            - **INVALID_ACTION**: The evaluation was processed but the action
            did not meet any criteria. No points were allotted.

            - **MAX_TRIES_HIT**: The evaluation was processed but the maximum
            number of allowed attempts for the specified participant was
            reached. No points were allotted.

            - **NO_VALID_OUTCOMES**: The evaluation was processed but none of
            the conditions resulted in a valid outcome. No points were allotted.


            **FAILED:**

            - **OBJECTIVE_NOT_FOUND**: The evaluation failed because objective
            could not be found using the provided objectiveId.

            - **RULES_PARSING_ERROR**: The evaluation failed because the
            campaign's rule was missing a ruleId, preventing proper parsing.

            - **INVALID_ACTION**: The evaluation failed as the campaign's rule
            has undefined points and objectiveId.

            - **ERROR_OCCURRED**: The evaluation failed due to an unexpected
            error.
          example: MAX_TRIES_HIT
      required:
        - externalReferenceId
        - name
        - status
        - evaluationReason
    TransactionAction:
      type: object
      properties:
        transaction:
          description: Transaction
          allOf:
            - $ref: '#/components/schemas/PointsTransactionSubsetEntity'
        action:
          description: Action
          allOf:
            - $ref: '#/components/schemas/AccountActionSubsetEntity'
        createdAt:
          type: string
          description: >-
            The creation timestamp of the specified transaction or action. If
            the action is not associated with a transaction (e.g., an invalid
            action), the timestamp reflects the creation time of the action
            instead of the transaction
          example: '2023-11-22T16:57:12+08:00'
        updatedAt:
          type: string
          description: >-
            The updated timestamp of the specified transaction or action. If the
            action is not associated with a transaction (e.g., an invalid
            action), the timestamp reflects the updated time of the action
            instead of the transaction.
          example: '2023-11-22T16:57:12+08:00'
        campaignId:
          type: string
          description: The ID of the campaign associate to the account
          example: 8bc8887b-87a0-46d2-b971-3d86b7652ad5
      required:
        - transaction
        - action
        - createdAt
        - updatedAt
        - campaignId
    TransactionsActionsEntity:
      type: object
      properties:
        identifier:
          type: string
          description: The identifier of this account.
          example: test@example.com
        transactionsActions:
          description: List of all transactions and actions
          type: array
          items:
            $ref: '#/components/schemas/TransactionAction'
      required:
        - identifier
        - transactionsActions
    ActionProviderEntity:
      type: object
      properties:
        id:
          type: string
          description: The identifier of the action provider
          example: f39854be-46f2-492f-9dd8-042e5719f05f
        campaignId:
          type: string
          description: The identifier of the campaign
          example: f39854be-46f2-492f-9dd8-042e5719f05f
        provider:
          type: string
          enum:
            - FORMSG
          example: FORMSG
          description: Type of the action provider
        description:
          type: string
          description: The description of the action provider
          example: FormSG integration for campaign A
          nullable: true
        providerConfig:
          oneOf:
            - $ref: '#/components/schemas/FormSGActionProviderConfig'
          description: Provider configuration
        createdAt:
          type: string
          description: The creation timestamp of the action provider
          example: '2023-11-22T16:57:12+08:00'
        updatedAt:
          type: string
          description: The updated timestamp of the action provider
          example: '2023-11-22T16:57:12+08:00'
      required:
        - id
        - campaignId
        - provider
        - description
        - providerConfig
        - createdAt
        - updatedAt
    FormSGActionProviderConfig:
      type: object
      properties:
        formId:
          type: string
          description: >-
            ID of the form from FormSG. Only ASCII printable characters (except
            `<`, `=` and `>`) of length 1 to 50 are allowed.
          example: 661be43fa14ba8cd75eaeeec
        formSecret:
          type: string
          description: Secret of the form from FormSG.
          example: 91wzO6ndE2bI3IN7CzTpWGL4JvLtmQPvNO8f/NlH/vB=
        accountFieldName:
          type: string
          description: >-
            Name of the form field on FormSG that will map to the `account` on
            GovRewards. Only ASCII printable characters (except `<`, `=` and
            `>`) of length 1 to 50 are allowed.
          example: Email
        createAccountIfNotExist:
          type: boolean
          description: >-
            Enabling this flag will allow GovRewards to automatically create an
            account in GovRewards upon successful action evaluation if it does
            not already exist.
          default: false
          example: true
      required:
        - formId
        - formSecret
        - accountFieldName
    AddActionProviderDTO:
      type: object
      properties:
        provider:
          type: string
          enum:
            - FORMSG
          description: Action provider type
          example: FORMSG
        providerConfig:
          oneOf:
            - $ref: '#/components/schemas/FormSGActionProviderConfig'
          description: Provider configuration
          allOf:
            - $ref: '#/components/schemas/FormSGActionProviderConfig'
        description:
          type: string
          description: >-
            Description of this action provider. Only ASCII printable characters
            (except `<`, `=` and `>`) of length 1 to 250 are allowed.
          example: Description for FormSG
          nullable: true
      required:
        - provider
        - providerConfig
    UpdateActionProviderDTO:
      type: object
      properties:
        description:
          type: string
          description: >-
            Description of this action provider. Only ASCII printable characters
            (except `<`, `=` and `>`) of length 1 to 250 are allowed.
          example: Description for FormSG
          nullable: true
        providerConfig:
          oneOf:
            - $ref: '#/components/schemas/FormSGActionProviderConfig'
          description: Provider configuration
          allOf:
            - $ref: '#/components/schemas/FormSGActionProviderConfig'
      required:
        - providerConfig
    CampaignsEntity:
      type: object
      properties:
        id:
          type: string
          description: The identifier of the campaign
          example: f39854be-46f2-492f-9dd8-042e5719f05f
        sid:
          type: string
          description: The short ID of the campaign
          example: my_campaign
        name:
          type: string
          description: The name of the campaign
          example: Campaign A
        description:
          type: string
          description: The description of the campaign
          example: This is Campaign A
          nullable: true
        tenantId:
          type: string
          description: The identifier of the tenant
          example: 2e4e61bd-2ef3-4053-9666-568b4581b081
        createdAt:
          type: string
          description: The creation timestamp of the specified campaign
          example: '2023-11-22T16:57:12+08:00'
        updatedAt:
          type: string
          description: The updated timestamp of the specified campaign
          example: '2023-11-22T16:57:12+08:00'
        pointsTargets:
          description: >-
            The target amount of points that each participant should achieve. A
            webhook event `POINTS_TARGET_MET` will be triggered if this campaign
            has a configured webhook.
          example:
            - 50
            - 100
          type: array
          items:
            type: number
      required:
        - id
        - sid
        - name
        - description
        - tenantId
        - createdAt
        - updatedAt
        - pointsTargets
    CreateCampaignDTO:
      type: object
      properties:
        sid:
          type: string
          description: >-
            Short ID of the campaign. Only lowercase alphanumeric and
            underscores of length 3 to 20 characters are allowed.
          example: my_campaign
        name:
          type: string
          description: >-
            Name of the campaign. Only ASCII printable characters (except `<`,
            `=` and `>`) of length 1 to 50 are allowed.
          example: Campaign A
        description:
          type: string
          description: >-
            Description of the campaign. Only ASCII printable characters (except
            `<`, `=` and `>`) of length 1 to 250 are allowed.
          example: Description for campaign A
          nullable: true
        pointsTargets:
          description: >-
            One or more target amount of points that each participant should
            achieve. Please take note of the following points:
                
            - A webhook event `POINTS_TARGET_MET` will be triggered each time
            any of the points target is met if this campaign has a configured
            webhook. 

            - A maximum of 10 point targets can be set per campaign.

            - Set `[]` to remove all points target. Defaults to `[]` (i.e. no
            points target).

            - The value of pointsTarget must be an integer between 1 and
            1000000. 

            - The array will be automatically sorted in ascending order.
          example:
            - 50
            - 100
          nullable: false
          type: array
          items:
            type: number
      required:
        - sid
        - name
    UpdateCampaignDTO:
      type: object
      properties:
        name:
          type: string
          description: >-
            Name of the campaign. Only ASCII printable characters (except `<`,
            `=` and `>`) of length 1 to 50 are allowed.
          example: Campaign A
        description:
          type: string
          description: >-
            Description of the campaign. Only ASCII printable characters (except
            `<`, `=` and `>`) of length 1 to 250 are allowed.
          example: Description for campaign A
          nullable: true
        pointsTargets:
          description: >-
            One or more target amount of points that each participant should
            achieve. Please take note of the following points:
                
            - A webhook event `POINTS_TARGET_MET` will be triggered each time
            any of the points target is met if this campaign has a configured
            webhook. 

            - A maximum of 10 point targets can be set per campaign.

            - Set `[]` to remove all points target. Defaults to `[]` (i.e. no
            points target).

            - The value of pointsTarget must be an integer between 1 and
            1000000. 

            - The array will be automatically sorted in ascending order.
          example:
            - 50
            - 100
          nullable: false
          type: array
          items:
            type: number
    CreateAccountDTO:
      type: object
      properties:
        identifier:
          type: string
          description: >-
            Identifier value. Only ASCII printable characters (except `<` and
            `>`) of length 1 to 255 are allowed.


            Note that this value will be trimmed (i.e. leading and trailing
            whitespaces will be removed).
          example: user@example.com
        metadata:
          type: object
          description: >-
            metadata for this account for this specified campaign. Metadata must
            be stored as a key-value pair, with both `key` and `value` as a
            valid string.


            `key`: Only lowercase alphanumeric and underscores of length 3 to 20
            characters are allowed.


            `value`: Only ASCII printable characters (except `<`, `=` and `>`)
            of length 1 to 250 are allowed. 
                  
            A maximum of 20 metadata key-value pairs are allowed.
          default: {}
          example:
            team: rocket
      required:
        - identifier
    BatchCreateCampaignAccountsFailedRecord:
      type: object
      properties:
        account:
          description: The identifier of the user (e.g., email, username).
          allOf:
            - $ref: '#/components/schemas/CreateAccountDTO'
        error:
          description: Error information related to the failure
          example:
            reasonCode: duplicate_campaign_id
            description: The request failed because a duplicate campaign ID was found.
            details: []
          allOf:
            - $ref: '#/components/schemas/ErrorResponseDetailDTO'
        reason:
          type: string
          description: Reason for failure
          deprecated: true
          example: The request failed because a duplicate campaign ID was found.
      required:
        - account
        - error
        - reason
    BatchCreateCampaignAccountsEntity:
      type: object
      properties:
        totalRecords:
          type: number
          description: Total number of records processed in the batch.
        totalSuccessfulRecords:
          type: number
          description: Total number of successful records processed.
        totalFailedRecords:
          type: number
          description: Total number of failed records processed.
        successRecords:
          description: >-
            List of successfully processed records, each containing the account
            details.
          type: array
          items:
            $ref: '#/components/schemas/AccountDetailsEntity'
        failedRecords:
          description: >-
            List of records that failed to process, each containing the user
            details and the reason for failure.
          type: array
          items:
            $ref: '#/components/schemas/BatchCreateCampaignAccountsFailedRecord'
      required:
        - totalRecords
        - totalSuccessfulRecords
        - totalFailedRecords
        - successRecords
        - failedRecords
    BatchCreateCampaignAccountsDTO:
      type: object
      properties:
        accounts:
          type: array
          items:
            $ref: '#/components/schemas/CreateAccountDTO'
      required:
        - accounts
    UpdateAccountDTO:
      type: object
      properties:
        identifier:
          type: string
          description: >-
            Identifier value. Only ASCII printable characters (except `<` and
            `>`) of length 1 to 255 are allowed.


            Note that this value will be trimmed (i.e. leading and trailing
            whitespaces will be removed).
          example: user@example.com
        metadata:
          type: object
          description: >-
            metadata for this account for this specified campaign. Metadata must
            be stored as a key-value pair, with both `key` and `value` as a
            valid string.


            `key`: Only lowercase alphanumeric and underscores of length 3 to 20
            characters are allowed.


            `value`: Only ASCII printable characters (except `<`, `=` and `>`)
            of length 1 to 250 are allowed. 
                  
            A maximum of 20 metadata key-value pairs are allowed.
          default: {}
          example:
            team: rocket
      required:
        - identifier
    AccountCampaignStatusEntity:
      type: object
      properties:
        identifier:
          type: string
          description: The identifier of this account.
          example: test@example.com
        isActive:
          type: boolean
          description: Account Status
      required:
        - identifier
        - isActive
    PointsLeaderboardEntity:
      type: object
      properties:
        identifier:
          type: string
          description: The identifier of this account.
          example: test@example.com
        rank:
          type: number
          description: The rank of the leaderboard
          example: 1
        pointsEarned:
          type: number
          description: >-
            The total points credited to the account. This property is
            deprecated and will be removed in future versions. Please use
            "totalPointsCredited" instead.
          example: 10
          deprecated: true
        totalPointsCredited:
          type: number
          description: >-
            The total points credited to the account for this campaign. This
            only includes ALLOT and TRANSFER_IN transactions.
          example: 100
        updatedAt:
          type: string
          description: The timestamp of the latest transaction
          example: '2023-11-22T00:00:00+08:00'
      required:
        - identifier
        - rank
        - pointsEarned
        - totalPointsCredited
        - updatedAt
    PointsLeaderboardIdentifierEntity:
      type: object
      properties:
        identifier:
          type: string
          description: The identifier of this account.
          example: test@example.com
        rank:
          type: number
          description: The rank of the leaderboard
          example: 1
          nullable: true
        pointsEarned:
          type: number
          description: The total points credited to the account.
          example: 10
          nullable: true
          deprecated: true
        totalPointsCredited:
          type: number
          description: >-
            The total points credited to the account for this campaign. This
            only includes ALLOT and TRANSFER_IN transactions.
          example: 100
          nullable: true
        updatedAt:
          type: string
          description: The timestamp of the latest transaction
          example: '2023-11-22T00:00:00+08:00'
          nullable: true
        error:
          description: Error information related to the failure
          example:
            reasonCode: account_not_found
            description: The requested account could not be found.
            details: []
          nullable: true
          allOf:
            - $ref: '#/components/schemas/ErrorResponseDetailDTO'
      required:
        - identifier
        - rank
        - pointsEarned
        - totalPointsCredited
        - updatedAt
    PointsLeaderboardIdentifiersEnitity:
      type: object
      properties:
        accounts:
          type: array
          items:
            $ref: '#/components/schemas/PointsLeaderboardIdentifierEntity'
      required:
        - accounts
    RetrieveLeaderboardDTO:
      type: object
      properties:
        accounts:
          type: array
          items:
            $ref: '#/components/schemas/RetrieveAccountDTO'
      required:
        - accounts
    AccountEntity:
      type: object
      properties:
        identifier:
          type: string
          description: The identifier of this account.
          example: test@example.com
        isActive:
          type: boolean
          description: Account Status
        createdAt:
          type: string
          description: The creation timestamp of the specified account
          example: '2023-11-22T16:57:12+08:00'
        updatedAt:
          type: string
          description: The updated timestamp of the specified account
          example: '2023-11-22T16:57:12+08:00'
      required:
        - identifier
        - isActive
        - createdAt
        - updatedAt
    SenderTransferPoints:
      type: object
      properties:
        identifier:
          type: string
          description: The identifier of this account.
          example: test@example.com
        campaignId:
          type: string
          description: Campaign Id
          example: 0610a0ee-6ceb-45ef-8255-f25580b12356
        transaction:
          description: Transaction record for the points transfer
          example:
            transactionId: zyhIpbOeNYCcxOwg
            type: TRANSFER_OUT
            description: This is a transfer to xxx
            createdAt: '2024-09-20T11:16:08+08:00'
            updatedAt: '2024-09-20T11:16:08+08:00'
            campaignId: 133a6a51-478f-46ca-bc92-013e441d9ae1
            points: -1
            status: SUCCESSFUL
          allOf:
            - $ref: '#/components/schemas/PointsTransactionEntity'
      required:
        - identifier
        - campaignId
        - transaction
    PointsValidityEntity:
      type: object
      properties:
        campaignId:
          type: string
          description: The ID of the campaign associate to the account
          example: 8bc8887b-87a0-46d2-b971-3d86b7652ad5
        createdAt:
          type: string
          description: The creation timestamp of the specified transaction
          example: '2023-11-22T16:57:12+08:00'
        updatedAt:
          type: string
          description: The updated timestamp of the specified transaction
          example: '2023-11-22T16:57:12+08:00'
        effectiveAt:
          type: string
          description: >-
            The date the points takes effect. If it is not an immediate
            allotment, time is set to 00:00
          example: '2023-11-22T16:57:12+08:00'
        expireAt:
          type: string
          description: The date the points expire. Time is set to 00:00
          example: '2023-11-22T00:00:00+08:00'
        totalPoints:
          type: number
          description: Total points allotted for this transaction
          example: 100
        description:
          type: string
          description: Description of the points allotted
          example: This allotment is for xxx
          nullable: true
      required:
        - campaignId
        - createdAt
        - updatedAt
        - effectiveAt
        - expireAt
        - totalPoints
    ReceiverTransferPoints:
      type: object
      properties:
        identifier:
          type: string
          description: The identifier of this account.
          example: test@example.com
        campaignId:
          type: string
          description: Campaign Id
          example: 0610a0ee-6ceb-45ef-8255-f25580b12356
        transaction:
          description: Transaction record for the points transfer
          example:
            transactionId: eavofLTFNYdihgzy
            type: TRANSFER_IN
            description: This is a transfer from xxx
            createdAt: '2024-09-20T11:16:08+08:00'
            updatedAt: '2024-09-20T11:16:08+08:00'
            campaignId: 133a6a51-478f-46ca-bc92-013e441d9ae1
            points: 1
            status: SUCCESSFUL
          allOf:
            - $ref: '#/components/schemas/PointsTransactionEntity'
        validity:
          description: >-
            Points validity that indicates the effective and expiry of the
            points
          example:
            campaignId: 133a6a51-478f-46ca-bc92-013e441d9ae1
            createdAt: '2024-09-20T11:16:08+08:00'
            updatedAt: '2024-09-20T11:16:08+08:00'
            totalPoints: 1
            expireAt: null
            effectiveAt: '2024-09-20T11:16:08+08:00'
            description: This is a transfer from xxx
          allOf:
            - $ref: '#/components/schemas/PointsValidityEntity'
      required:
        - identifier
        - campaignId
        - transaction
        - validity
    TransferPointsEntity:
      type: object
      properties:
        sender:
          description: Details of the points transfer from the sender's account
          allOf:
            - $ref: '#/components/schemas/SenderTransferPoints'
        receiver:
          description: Details of the points transfer to the receiver's account
          allOf:
            - $ref: '#/components/schemas/ReceiverTransferPoints'
      required:
        - sender
        - receiver
    TransferAccountInfoDTO:
      type: object
      properties:
        identifier:
          type: string
          description: >-
            Identifier value. Only ASCII printable characters (except `<` and
            `>`) of length 1 to 255 are allowed.


            Note that this value will be trimmed (i.e. leading and trailing
            whitespaces will be removed).
          example: user@example.com
        campaignId:
          type: string
          description: Campaign ID
          example: 2c1a34b1-cfd8-4066-9565-d236fcf41c70
        transactionDescription:
          type: string
          description: >-
            Description of the transfer. Only ASCII printable characters (except
            `<`, `=` and `>`) of length 1 to 250 are allowed.
          example: This is a transfer from/to xxx
          nullable: true
      required:
        - identifier
        - campaignId
    TransferPointsDTO:
      type: object
      properties:
        sender:
          description: Sender account details
          allOf:
            - $ref: '#/components/schemas/TransferAccountInfoDTO'
        receiver:
          description: Receiver account details
          allOf:
            - $ref: '#/components/schemas/TransferAccountInfoDTO'
        points:
          type: number
          description: >-
            Number of points to transfer from the sender account to the receiver
            account. The value of points must be an integer between 1 and 9,999
          example: 1
      required:
        - sender
        - receiver
        - points
    AccountMetrics:
      type: object
      properties:
        total:
          type: number
          description: Total number of accounts since the campaign started
          example: 1000
        activeCount:
          type: number
          description: Number of active accounts
          example: 850
        newCount:
          type: number
          description: Number of new accounts
          example: 950
      required:
        - total
        - activeCount
        - newCount
    ActionItemMetrics:
      type: object
      properties:
        name:
          type: string
          description: Name of the action
          example: walk_1000_steps
          nullable: true
        data:
          type: object
          description: The data of the action
          example:
            formSG:
              formId: '1234567890'
        count:
          type: number
          description: Number of action registered
          example: 37
      required:
        - name
        - data
        - count
    RedemptionItemMetrics:
      type: object
      properties:
        name:
          type: string
          description: Name of the redemption item
          example: Item 1
        count:
          type: number
          description: Number of successful redemptions
          example: 40
        totalQuantityRedeemed:
          type: number
          description: Total quantity redeemed for successful redemptions
          example: 60
      required:
        - name
        - count
        - totalQuantityRedeemed
    ObjectiveCompletedItemMetrics:
      type: object
      properties:
        name:
          type: string
          description: Name of the objective
          example: Walk 1000 Steps
        count:
          type: number
          description: Number objectives completed
          example: 20
      required:
        - name
        - count
    PointsTransactionItemMetrics:
      type: object
      properties:
        type:
          type: string
          enum:
            - ALLOT
            - REDEEM
            - EXPIRE
            - TRANSFER_IN
            - TRANSFER_OUT
            - DEDUCT
          description: Type of points transaction
          example: ALLOT
        totalPoints:
          type: number
          description: Total points for the transaction type
          example: 1500
      required:
        - type
        - totalPoints
    CampaignMetrics:
      type: object
      properties:
        campaignId:
          type: string
          description: The identifier of the campaign
          example: f39854be-46f2-492f-9dd8-042e5719f05f
        accounts:
          description: Account metrics for a campaign.
          allOf:
            - $ref: '#/components/schemas/AccountMetrics'
        actions:
          description: Action metrics for a campaign.
          type: array
          items:
            $ref: '#/components/schemas/ActionItemMetrics'
        redemptions:
          description: Redemption items metrics for a campaign.
          type: array
          items:
            $ref: '#/components/schemas/RedemptionItemMetrics'
        objectivesCompleted:
          description: Objectives metrics for a campaign.
          type: array
          items:
            $ref: '#/components/schemas/ObjectiveCompletedItemMetrics'
        pointsTransactions:
          description: Points transactions metrics for a campaign.
          type: array
          items:
            $ref: '#/components/schemas/PointsTransactionItemMetrics'
      required:
        - campaignId
        - accounts
        - actions
        - redemptions
        - objectivesCompleted
        - pointsTransactions
    RetriveCampaignMetricsDTO:
      type: object
      properties:
        metricsToInclude:
          type: array
          example:
            - ACCOUNTS
          description: >-
            Metrics to include in the response. If not provided, all metrics
            will be included.
          nullable: false
          items:
            type: string
            enum:
              - ACTIONS
              - OBJECTIVES_COMPLETED
              - REDEMPTIONS
              - ACCOUNTS
              - POINTS_TRANSACTIONS
        fromDate:
          type: string
          example: '2025-01-01T00:00:00+08:00'
          description: >-
            The start date and time for filtering records by their creation
            timestamp. Only metrics from records created on or after this date
            will be included in the results.
          nullable: false
        toDate:
          type: string
          example: '2025-01-31T23:59:59+08:00'
          description: >-
            The end date and time for filtering records by their creation
            timestamp. Only metrics from records created on or before this date
            will be included in the results.
          nullable: false
    CampaignTierConditions:
      type: object
      properties:
        minCreditedPoints:
          type: number
          description: >-
            Minimum number of points required to reach this tier. Note that this
            is calculated based on points credited (i.e. ALLOT, TRANSFER_IN).
            The value of minCreditedPoints must be an integer between 0 and
            1,000,000
          example: 1000
      required:
        - minCreditedPoints
    CampaignTierEntity:
      type: object
      properties:
        createdAt:
          type: string
          description: The creation timestamp of the campaign tier
          example: '2023-11-22T16:57:12+08:00'
        updatedAt:
          type: string
          description: The updated timestamp of the campaign tier
          example: '2023-11-22T16:57:12+08:00'
        campaignId:
          type: string
          description: Campaign ID
          example: 0610a0ee-6ceb-45ef-8255-f25580b12356
        id:
          type: string
          description: The identifier of the campaign tier
          example: f39854be-46f2-492f-9dd8-042e5719f05f
        name:
          type: string
          description: The name of the campaign tier
          example: Bronze
        description:
          type: string
          description: The description of the campaign tier
          example: Description for the Bronze Tier
          nullable: true
        isActive:
          type: boolean
          description: Status to enable/disable this tier
          example: true
        priority:
          type: number
          description: >-
            Priority of campaign tier. Determines the order of which the
            participant is assigned a tier when calculating. A higher priority
            (i.e. larger integer) is of higher importance and will be assigned
            first if conditions are met. For e.g. Gold (3) > Silver (2) > Bronze
            (1). The value of priority must be an integer between 1 and 50
          example: 1
        conditions:
          description: >-
            Conditions to meet before achieving this tier. Note that the
            conditions are operated on an "AND" basis, meaning all conditions
            must be met
          allOf:
            - $ref: '#/components/schemas/CampaignTierConditions'
      required:
        - createdAt
        - updatedAt
        - campaignId
        - id
        - name
        - description
        - isActive
        - priority
        - conditions
    AddCampaignTierDTO:
      type: object
      properties:
        name:
          type: string
          description: >-
            Name of the campaign tier. Only ASCII printable characters (except
            `<`, `=` and `>`) of length 1 to 50 are allowed.
          example: Bronze
        description:
          type: string
          description: >-
            Description of the campaign tier. Only ASCII printable characters
            (except `<`, `=` and `>`) of length 1 to 250 are allowed.
          example: Description for the Bronze Tier
          nullable: true
        isActive:
          type: boolean
          description: Status to enable/disable this tier
          example: true
        priority:
          type: number
          description: >-
            Priority of campaign tier. Determines the order of which the
            participant is assigned a tier when calculating. A higher priority
            (i.e. larger integer) is of higher importance and will be assigned
            first if conditions are met. For e.g. Gold (3) > Silver (2) > Bronze
            (1). The value of priority must be an integer between 1 and 50
          example: 1
        conditions:
          description: >-
            Conditions to meet before achieving this tier. Note that the
            conditions are operated on an "AND" basis, meaning all conditions
            must be met
          allOf:
            - $ref: '#/components/schemas/CampaignTierConditions'
      required:
        - name
        - isActive
        - priority
        - conditions
    UpdateCampaignTierDTO:
      type: object
      properties:
        name:
          type: string
          description: >-
            Name of the campaign tier. Only ASCII printable characters (except
            `<`, `=` and `>`) of length 1 to 50 are allowed.
          example: Bronze
        description:
          type: string
          description: >-
            Description of the campaign tier. Only ASCII printable characters
            (except `<`, `=` and `>`) of length 1 to 250 are allowed.
          example: Description for the Bronze Tier
          nullable: true
        isActive:
          type: boolean
          description: Status to enable/disable this tier
          example: true
        conditions:
          description: >-
            Conditions to meet before achieving this tier. Note that the
            conditions are operated on an "AND" basis, meaning all conditions
            must be met
          allOf:
            - $ref: '#/components/schemas/CampaignTierConditions'
    UpdateCampaignTierPriorityDTO:
      type: object
      properties:
        id:
          type: string
          description: The identifier of the campaign tier
          example: f39854be-46f2-492f-9dd8-042e5719f05f
        priority:
          type: number
          description: >-
            Priority of campaign tier. Determines the order of which the
            participant is assigned a tier when calculating. A higher priority
            (i.e. larger integer) is of higher importance and will be assigned
            first if conditions are met. For e.g. Gold (3) > Silver (2) > Bronze
            (1). The value of priority must be an integer between 1 and 50
          example: 1
      required:
        - id
        - priority
    UpdateCampaignTierPrioritiesDTO:
      type: object
      properties:
        tiers:
          description: >-
            List of tiers to update. Must have the same number of elements as
            the number of tiers configured for the campaign.
          type: array
          items:
            $ref: '#/components/schemas/UpdateCampaignTierPriorityDTO'
      required:
        - tiers
    InternalEventEntity:
      type: object
      properties:
        id:
          type: string
          description: Internal event id
          example: 01936e1d-7d52-7c03-8988-44eb2f8cf3b7
        campaignId:
          type: string
          description: The identifier of the campaign
          example: f39854be-46f2-492f-9dd8-042e5719f05f
          nullable: true
        createdAt:
          type: string
          description: Created date time of the internal event
          example: '2023-11-24T00:00:00+08:00'
        type:
          type: string
          description: Type of events
          example: webhook.send.failed
          enum:
            - webhook.send.failed
            - redemption.provider_request.failed
            - formsg.webhook.received.failed
            - goventry.webhook.received.failed
            - account.tier_evaluation.failed
        occurredAt:
          type: string
          description: Date time when the internal event occurred
          example: '2023-11-24T00:00:00+08:00'
        data:
          type: object
          example:
            payload:
              id: y1ioUtmcJcvZHNEm
              data:
                metAt: '2024-11-27T22:51:03+08:00'
                identifier: user@example.com
                pointsAdded: 120
                pointsTargets:
                  - 120
              eventType: POINTS_TARGET_MET
              createdAt: '2024-11-27T22:51:03+08:00'
            errorMessage: >-
              Failed to send webhook to url https://api.agency.gov.sg/webhook.
              Unable to establish a connection to the destination server. This
              may be due to network issues, an incorrect URL, or the server
              being unavailable. Please verify the webhook URL and ensure the
              server is reachable.
          description: |2-

              Contains details about the payload and error message for the internal events.<br/><br/>
              Examples:
                
              
            1. webhook.send.failed:
              
            ```json
            {
                "payload": {
                    "id": "y1ioUtmcJcvZHNEm",
                    "data": {
                        "metAt": "2024-11-27T22:51:03+08:00",
                        "identifier": "user@example.com",
                        "pointsAdded": 120,
                        "pointsTargets": [
                            120
                        ]
                    },
                    "eventType": "POINTS_TARGET_MET",
                    "createdAt": "2024-11-27T22:51:03+08:00"
                },
                "errorMessage": "Failed to send webhook to url https://api.agency.gov.sg/webhook. Unable to establish a connection to the destination server. This may be due to network issues, an incorrect URL, or the server being unavailable. Please verify the webhook URL and ensure the server is reachable."
            }
            ```
                

            2. redemption.provider_request.failed:
              
            ```json
            {
                "provider": "GOVSUPPLY",
                "identifier": "user@example.com",
                "errorMessage": "Unable to redeem item from provider GOVSUPPLY.",
                "quantityToRedeem": 1,
                "redemptionItemId": "6ad7bd35-3a5a-4310-a393-c4c8c0d2d70f",
                "externalReferenceId": "1-o1ivUff2IAn7Tjdg"
            }
            ```
                

            3. formsg.webhook.received.failed:
              
            ```json
            {
                "identifier": "user@example.com",
                "formId": "0000adc0adbd0000a00000ed",
                "data": {},
                "errorMessage": "Invalid or missing action"
            }
            ```
                

            4. goventry.webhook.received.failed:
              
            ```json
            {
                "identifier": "user@example.com",
                "body": "encrypted payload",
                "errorMessage": "Account Not Found Exception"
            }
            ```
                

            5. account.tier_evaluation.failed:
              
            ```json
            {
                "identifier": "user@example.com",
                "tierId": null,
                "totalPointsAdded": 10,
                "errorMessage": "Failed to evaluate tier for account identifier=user@example.com. Account inactive."
            }
            ```
                
              
      required:
        - id
        - createdAt
        - type
        - occurredAt
        - data
    ObjectiveEntity:
      type: object
      properties:
        id:
          type: string
          description: The identifier of the objective
          example: f39854be-46f2-492f-9dd8-042e5719f05f
        name:
          type: string
          description: The name of the objective
          example: Objective A
        description:
          type: string
          description: The description of the objective
          example: This is Objective A
          nullable: true
        campaignId:
          type: string
          description: Campaign ID
          example: 0610a0ee-6ceb-45ef-8255-f25580b12356
        createdAt:
          type: string
          description: The creation timestamp of the specified objective
          example: '2023-11-22T16:57:12+08:00'
        updatedAt:
          type: string
          description: The updated timestamp of the specified objective
          example: '2023-11-22T16:57:12+08:00'
      required:
        - id
        - name
        - description
        - campaignId
        - createdAt
        - updatedAt
    CreateObjectiveDTO:
      type: object
      properties:
        name:
          type: string
          description: >-
            Name of the objective. Only ASCII printable characters (except `<`,
            `=` and `>`) of length 1 to 50 are allowed.
          example: Objective A
        description:
          type: string
          description: >-
            Description of the objective. Only ASCII printable characters
            (except `<`, `=` and `>`) of length 1 to 250 are allowed.
          example: Description for objective A
          nullable: true
      required:
        - name
    UpdateObjectiveDTO:
      type: object
      properties:
        name:
          type: string
          description: >-
            Name of the objective. Only ASCII printable characters (except `<`,
            `=` and `>`) of length 1 to 50 are allowed.
          example: Objective A
        description:
          type: string
          description: >-
            Description of the objective. Only ASCII printable characters
            (except `<`, `=` and `>`) of length 1 to 250 are allowed.
          example: Description for objective A
          nullable: true
    RuleEntity:
      type: object
      properties:
        campaignId:
          type: string
          description: Campaign ID
          example: 0610a0ee-6ceb-45ef-8255-f25580b12356
        objectiveId:
          type: string
          description: The ID of the objective this rule is applied to
          example: 9729fc3f-5c5d-41ad-92e2-01caa0af3dba
        createdAt:
          type: string
          description: Created date time of the rule
          example: '2023-11-24T00:00:00+08:00'
        effectiveAt:
          type: string
          description: Effective date time of the rule
          example: '2023-11-24T00:00:00+08:00'
        expireAt:
          type: string
          description: Expire date time of the rule
          example: '2023-11-24T00:00:00+08:00'
        id:
          type: string
          description: Rule id
          example: 0610a0ee-6ceb-45ef-8255-f25580b12356
        ruleJSON:
          oneOf:
            - $ref: '#/components/schemas/AllotmentV1EngineRule'
          description: JSON rules
        type:
          type: string
          enum:
            - ALLOTMENT
            - REDEMPTION
          example: ALLOTMENT
          description: Type of the rule
        updatedAt:
          type: string
          description: Updated date time of the rule
          example: '2023-11-24T00:00:00+08:00'
        priority:
          type: number
          description: >-
            Priority of the rule. Rule priorities are evaluated within each
            campaign. The value of priority must be an integer between 1 and 100
          example: 10
        engineVersion:
          type: number
          description: Version of Rule Engine. Set to 1
          example: 1
        version:
          type: number
          description: Version of the rule
          example: 1
      required:
        - campaignId
        - objectiveId
        - createdAt
        - effectiveAt
        - expireAt
        - id
        - type
        - updatedAt
        - priority
        - engineVersion
        - version
    ObjectiveWithRulesEntity:
      type: object
      properties:
        id:
          type: string
          description: The identifier of the objective
          example: f39854be-46f2-492f-9dd8-042e5719f05f
        name:
          type: string
          description: The name of the objective
          example: Objective A
        description:
          type: string
          description: The description of the objective
          example: This is Objective A
          nullable: true
        campaignId:
          type: string
          description: Campaign ID
          example: 0610a0ee-6ceb-45ef-8255-f25580b12356
        createdAt:
          type: string
          description: The creation timestamp of the specified objective
          example: '2023-11-22T16:57:12+08:00'
        updatedAt:
          type: string
          description: The updated timestamp of the specified objective
          example: '2023-11-22T16:57:12+08:00'
        rules:
          description: >-
            The rules linked to this objective. This list will be empty if no
            rules are linked to the objective.<br><br>If `includeRules` query
            string is supported for the API endpoint and set to false (or not
            provided), this field will be `undefined`.
          type: array
          items:
            $ref: '#/components/schemas/RuleEntity'
      required:
        - id
        - name
        - description
        - campaignId
        - createdAt
        - updatedAt
    PointsAllotmentEntity:
      type: object
      properties:
        identifier:
          type: string
          description: The identifier of this account.
          example: test@example.com
        transaction:
          description: >-
            Transaction for the points allotment. Returns null if the allotment
            has not been processed
          allOf:
            - $ref: '#/components/schemas/PointsTransactionEntity'
        validity:
          description: >-
            Points validity that indicates the effective and expiry of the
            points
          allOf:
            - $ref: '#/components/schemas/PointsValidityEntity'
      required:
        - identifier
        - transaction
        - validity
    AllotPointsDTO:
      type: object
      properties:
        identifier:
          type: string
          description: >-
            Identifier value. Only ASCII printable characters (except `<` and
            `>`) of length 1 to 255 are allowed.


            Note that this value will be trimmed (i.e. leading and trailing
            whitespaces will be removed).
          example: user@example.com
        description:
          type: string
          description: >-
            Description of the allotment. Only ASCII printable characters
            (except `<`, `=` and `>`) of length 1 to 250 are allowed.
          example: This allotment is for xxx
          nullable: true
        points:
          type: number
          description: >-
            Points to allot. The value of points must be an integer between 1
            and 999
          example: 100
        effectiveAt:
          type: string
          description: >-
            Points are allotted based on the effective date, using the truncated
            date. Effective date must be set on the hour (e.g. 12pm, 1pm, etc.).
            If effective date is not specified, it will automatically default to
            the current date and time for immediate allocation
          example: '2024-06-01T09:00:00+08:00'
        expireAt:
          type: string
          description: >-
            Points will expire on the specified expiry date, using the truncated
            date, or remain valid indefinitely if no expiry date is provided.
            Expiry date must be set at 12AM (SGT Timezone).
          example: '2024-12-31T00:00:00+08:00'
      required:
        - identifier
        - description
        - points
    PointsDeductionEntity:
      type: object
      properties:
        identifier:
          type: string
          description: The identifier of this account.
          example: test@example.com
        transaction:
          description: >-
            Transaction record for the points deduction. Returns null if the
            deduction has not been processed
          example:
            transactionId: zyhIpbOeNYCcxOwg
            type: DEDUCT
            description: This is a deduction for xxx
            createdAt: '2024-09-20T11:16:08+08:00'
            updatedAt: '2024-09-20T11:16:08+08:00'
            campaignId: 133a6a51-478f-46ca-bc92-013e441d9ae1
            points: -100
            status: SUCCESSFUL
          allOf:
            - $ref: '#/components/schemas/PointsTransactionEntity'
      required:
        - identifier
        - transaction
    DeductPointsDTO:
      type: object
      properties:
        identifier:
          type: string
          description: >-
            Identifier value. Only ASCII printable characters (except `<` and
            `>`) of length 1 to 255 are allowed.


            Note that this value will be trimmed (i.e. leading and trailing
            whitespaces will be removed).
          example: user@example.com
        description:
          type: string
          description: >-
            Description of the deduction. Only ASCII printable characters
            (except `<`, `=` and `>`) of length 1 to 250 are allowed.
          example: This deduction is for xxx
          nullable: true
        pointsToDeduct:
          type: number
          description: >-
            Points to deduct. The value of pointsToDeduct must be an integer
            between 1 and 1,000,000
          example: 100
      required:
        - identifier
        - description
        - pointsToDeduct
    FailureRecord:
      type: object
      properties:
        account:
          description: The identifier of the user (e.g., email, username).
          allOf:
            - $ref: '#/components/schemas/RetrieveAccountDTO'
        error:
          description: Error information related to the failure
          example:
            reasonCode: account_not_found
            description: The requested account could not be found.
            details: []
          allOf:
            - $ref: '#/components/schemas/ErrorResponseDetailDTO'
        reason:
          type: string
          description: Reason for failure
          deprecated: true
          example: The requested account could not be found.
      required:
        - account
        - error
        - reason
    BatchPointsAllotmentEntity:
      type: object
      properties:
        totalRecords:
          type: number
          description: Total number of records processed in the batch.
        totalSuccessfulRecords:
          type: number
          description: Total number of successful records processed.
        totalFailedRecords:
          type: number
          description: Total number of failed records processed.
        successRecords:
          description: >-
            List of successfully processed records, each containing the
            transaction and validity details.
          type: array
          items:
            $ref: '#/components/schemas/PointsAllotmentEntity'
        failedRecords:
          description: >-
            List of records that failed to process, each containing the user
            details and the reason for failure.
          type: array
          items:
            $ref: '#/components/schemas/FailureRecord'
      required:
        - totalRecords
        - totalSuccessfulRecords
        - totalFailedRecords
        - successRecords
        - failedRecords
    BatchAllotPointsDTO:
      type: object
      properties:
        description:
          type: string
          description: >-
            Description of the allotment. Only ASCII printable characters
            (except `<`, `=` and `>`) of length 1 to 250 are allowed.
          example: This allotment is for xxx
          nullable: true
        points:
          type: number
          description: >-
            Points to allot. The value of points must be an integer between 1
            and 999
          example: 100
        effectiveAt:
          type: string
          description: >-
            Points are allotted based on the effective date, using the truncated
            date. Effective date must be set on the hour (e.g. 12pm, 1pm, etc.).
            If effective date is not specified, it will automatically default to
            the current date and time for immediate allocation
          example: '2024-06-01T09:00:00+08:00'
        expireAt:
          type: string
          description: >-
            Points will expire on the specified expiry date, using the truncated
            date, or remain valid indefinitely if no expiry date is provided.
            Expiry date must be set at 12AM (SGT Timezone).
          example: '2024-12-31T00:00:00+08:00'
        accounts:
          type: array
          items:
            $ref: '#/components/schemas/RetrieveAccountDTO'
      required:
        - description
        - points
        - accounts
    AdditionalDataAccountObjective:
      type: object
      properties:
        entity:
          type: string
          description: The type of additional data. Will always be `ACCOUNT_OBJECTIVE`
          example: ACCOUNT_OBJECTIVE
        externalReferenceId:
          type: string
          description: The reference no. of the specified objective
          example: 2-0UQYi8RLz4kPjkWZ
        createdAt:
          type: string
          description: The creation timestamp of the specified objective
          example: '2023-11-22T16:57:12+08:00'
        objectiveName:
          type: string
          description: The name of the objective
          example: Objective A
      required:
        - entity
        - externalReferenceId
        - createdAt
        - objectiveName
    AdditionalDataAccountRedemption:
      type: object
      properties:
        entity:
          type: string
          description: The type of additional data. Will always be `ACCOUNT_REDEMPTION`
          example: ACCOUNT_REDEMPTION
        externalReferenceId:
          type: string
          description: The reference no. of the specified redemption
          example: 2-0UQYi8RLz4kPjkWZ
        createdAt:
          type: string
          description: The creation timestamp of the specified objective
          example: '2023-11-22T16:57:12+08:00'
        redemptionItemName:
          type: string
          description: The name of the redemption item
          example: Red bag
      required:
        - entity
        - externalReferenceId
        - createdAt
        - redemptionItemName
    PointsTransactionDetailsEntity:
      type: object
      properties:
        campaignId:
          type: string
          description: The ID of the campaign associate to the account
          example: 8bc8887b-87a0-46d2-b971-3d86b7652ad5
        description:
          type: string
          description: The description of the transaction
          example: This transaction is for xxx
          nullable: true
        transactionId:
          type: string
          description: The ID of the transaction
          example: Dz7WaF1Q4QnSrXuq
        type:
          type: string
          enum:
            - ALLOT
            - REDEEM
            - EXPIRE
            - TRANSFER_IN
            - TRANSFER_OUT
            - DEDUCT
          description: Indicate type of transaction
          example: ALLOT
        points:
          type: number
          description: The points credited (+) or debited (-) for the transaction
          example: 100
        updatedAt:
          type: string
          description: The updated timestamp of the specified transaction
          example: '2023-11-22T16:57:12+08:00'
        createdAt:
          type: string
          description: The creation timestamp of the specified transaction
          example: '2023-11-22T16:57:12+08:00'
        status:
          type: string
          enum:
            - PENDING
            - SUCCESSFUL
            - FAILED
          description: The status of the points transaction
          example: SUCCESSFUL
        additionalData:
          oneOf:
            - $ref: '#/components/schemas/AdditionalDataAccountObjective'
            - $ref: '#/components/schemas/AdditionalDataAccountRedemption'
          description: >-
            Additional data (e.g. linked account objective, account redemption)
            for this transaction, if any.
      required:
        - campaignId
        - transactionId
        - type
        - points
        - updatedAt
        - createdAt
        - status
    GovWalletConfig:
      type: object
      properties:
        campaignId:
          type: string
          description: The ID of this GovWallet campaign.
          example: wog_example
        environment:
          type: string
          description: The GovWallet environment this GovWallet campaign is in.
          example: govstaff
        benefactorId:
          type: string
          description: The Benefactor ID of the GovWallet campaign.
          example: GOVTECH
      required:
        - campaignId
        - environment
        - benefactorId
    GovSupplyConfig:
      type: object
      properties:
        apiKey:
          type: string
          description: >-
            The GovSupply tenant's API Key. GovRewards will encrypt and store
            this key securely.
          example: api_key_sample
        campaignId:
          type: string
          description: The ID of this GovSupply campaign. Must be a valid UUID.
          example: 6a84888a-2374-49eb-acda-dc58facb6182
      required:
        - apiKey
        - campaignId
    DisbursePlusConfig:
      type: object
      properties: {}
    GovSupplyItemConfig:
      type: object
      properties:
        categoryId:
          type: string
          description: >-
            The corresponding category id configured on GovSupply v2. Must be a
            valid UUID.
          example: 364754a0-0a84-4390-b413-333c04d22b07
      required:
        - categoryId
    ConditionDTO:
      type: object
      properties:
        name:
          type: string
          description: Name of the condition
        operator:
          type: string
          description: Operator of the condition
          enum:
            - equal
            - notEqual
            - in
            - notIn
            - contains
            - doesNotContain
            - lessThan
            - lessThanInclusive
            - greaterThan
            - greaterThanInclusive
        value:
          type: object
          description: Value of the condition
          example: string
      required:
        - name
        - operator
        - value
    RedemptionItemEntity:
      type: object
      properties:
        id:
          type: string
          description: Redemption item id
          example: 0610a0ee-6ceb-45ef-8255-f25580b12356
        campaignId:
          type: string
          description: The identifier of the campaign
          example: f39854be-46f2-492f-9dd8-042e5719f05f
        sid:
          type: string
          description: Short ID of the redemption item
          example: bag
        name:
          type: string
          description: Name of the redemption item
          example: Bag
        description:
          type: string
          description: Description of the redemption item
          example: Best bag in the world!
          nullable: true
        pointsToRedeem:
          type: number
          description: >-
            Points required to redeem the item. The value of pointsToRedeem must
            be an integer between 1 and 1,000,000
          example: 1
        perAccountRedeemQuota:
          type: number
          description: >-
            Maximum number of times a person can redeem the item. The value of
            perAccountRedeemQuota must be an integer between 1 and 1,000
          example: 1
          nullable: true
        cashInCents:
          type: number
          description: >-
            In the case the type is POINTS_TO_CASH, this specifies the monetary
            value of the points in cents. The value of cashInCents must be an
            integer between 1 and 100,000,000
          example: 50
          nullable: true
        quantityAvailable:
          type: number
          description: >-
            Quantity of the item available for redemption. The value of
            quantityAvailable must be an integer between 1 and 100,000,000
          example: 1
          nullable: true
        effectiveAt:
          type: string
          description: Effective date time of the redemption item
          example: '2023-11-24T00:00:00+08:00'
        expireAt:
          type: string
          description: Expiry date time of the redemption item
          example: '2023-11-24T00:00:00+08:00'
          nullable: true
        isActive:
          type: boolean
          description: >-
            Indicates if the redemption item is currently active based on
            effectiveAt and expireAt
        provider:
          type: string
          enum:
            - GOVWALLET
            - GOVSUPPLY
            - DISBURSE_PLUS
          description: Provider of the redemption item
          example: GOVWALLET
        type:
          type: string
          enum:
            - POINTS_TO_CASH
            - POINTS_TO_ITEM
          example: POINTS_TO_ITEM
          description: Type of redemption item
        providerItemConfig:
          oneOf:
            - $ref: '#/components/schemas/GovSupplyItemConfig'
          description: Configuration for the corresponding provider item.
          nullable: true
        conditions:
          description: Conditions for the redemption item
          nullable: true
          type: array
          items:
            $ref: '#/components/schemas/ConditionDTO'
        createdAt:
          type: string
          description: Created date time of the redemption item
          example: '2023-11-24T00:00:00+08:00'
        updatedAt:
          type: string
          description: Updated date time of the redemption item
          example: '2023-11-24T00:00:00+08:00'
      required:
        - id
        - campaignId
        - sid
        - name
        - pointsToRedeem
        - effectiveAt
        - expireAt
        - isActive
        - provider
        - type
        - createdAt
        - updatedAt
    CreateRedemptionItemDTO:
      type: object
      properties:
        sid:
          type: string
          description: >-
            Short ID of the redemption item. Only lowercase alphanumeric and
            underscores of length 3 to 20 characters are allowed.
          example: bag
        name:
          type: string
          description: >-
            Name of the redemption item. Only ASCII printable characters (except
            `<`, `=` and `>`) of length 1 to 50 are allowed.
          example: Bag
        description:
          type: string
          description: >-
            Description of the redemption item. Only ASCII printable characters
            (except `<`, `=` and `>`) of length 1 to 250 are allowed.
          example: Best bag in the world!
          nullable: true
        pointsToRedeem:
          type: number
          description: >-
            Points required to redeem the item. The value of pointsToRedeem must
            be an integer between 0 and 1,000,000
          example: 1
        perAccountRedeemQuota:
          type: number
          description: >-
            Maximum number of times a person can redeem the item. The value of
            perAccountRedeemQuota must be an integer between 1 and 1,000
          example: 1
          nullable: true
        cashInCents:
          type: number
          description: >-
            In the case the type is POINTS_TO_CASH, this specifies the monetary
            value of the points in cents. The value of cashInCents must be an
            integer between 1 and 100,000,000
          example: 50
          nullable: true
        type:
          type: string
          enum:
            - POINTS_TO_CASH
            - POINTS_TO_ITEM
          example: POINTS_TO_ITEM
          description: Type of redemption item
        effectiveAt:
          type: string
          description: >-
            Effective date time of the redemption item. Omit this field to allow
            the redemption of this item immediately.
          example: '2023-11-23T00:00:00+08:00'
          default: Current date and time if null
          nullable: true
        expireAt:
          type: string
          description: >-
            Expiry date time of the redemption item. Omit this field to
            configure a redemption item that will not expire
          example: '9999-12-31T23:59:59+08:00'
          nullable: true
        provider:
          type: string
          enum:
            - GOVWALLET
            - GOVSUPPLY
            - DISBURSE_PLUS
          description: Provider of the redemption item
          example: GOVSUPPLY
        quantityAvailable:
          type: number
          description: >-
            Quantity of the item available for redemption. The value of
            quantityAvailable must be an integer between 1 and 100,000,000
          example: 1
          nullable: true
        providerItemConfig:
          oneOf:
            - $ref: '#/components/schemas/GovSupplyItemConfig'
          description: >-
            Configuration for the corresponding provider item. Only required for
            redemption provider GOVSUPPLY
          nullable: true
          allOf:
            - $ref: '#/components/schemas/GovSupplyItemConfig'
        conditions:
          description: >-
            Conditions for the redemption item, referring to the Conditions
            section where you can find the list of available conditions and how
            to configure them. All conditions in the list are combined using AND
            logic.
          nullable: true
          type: array
          items:
            $ref: '#/components/schemas/ConditionDTO'
      required:
        - sid
        - name
        - pointsToRedeem
        - type
        - provider
    PatchRedemptionItemDTO:
      type: object
      properties:
        name:
          type: string
          description: >-
            Name of the redemption item. Only ASCII printable characters (except
            `<`, `=` and `>`) of length 1 to 50 are allowed.
          example: Bag
        description:
          type: string
          description: >-
            Description of the redemption item. Only ASCII printable characters
            (except `<`, `=` and `>`) of length 1 to 250 are allowed.
          example: Best bag in the world!
          nullable: true
        pointsToRedeem:
          type: number
          description: >-
            Points required to redeem the item. The value of pointsToRedeem must
            be an integer between 0 and 1,000,000
          example: 1
        perAccountRedeemQuota:
          type: number
          description: >-
            Maximum number of times a person can redeem the item. The value of
            perAccountRedeemQuota must be an integer between 1 and 1,000
          example: 1
          nullable: true
        cashInCents:
          type: number
          description: >-
            In the case the type is POINTS_TO_CASH, this specifies the monetary
            value of the points in cents. The value of cashInCents must be an
            integer between 1 and 100,000,000
          example: 50
          nullable: true
        type:
          type: string
          enum:
            - POINTS_TO_CASH
            - POINTS_TO_ITEM
          example: POINTS_TO_ITEM
          description: Type of redemption item
        effectiveAt:
          type: string
          description: >-
            Effective date time of the redemption item. Omit this field to allow
            the redemption of this item immediately.
          example: '2023-11-23T00:00:00+08:00'
          default: Current date and time if null
          nullable: true
        expireAt:
          type: string
          description: >-
            Expiry date time of the redemption item. Omit this field to
            configure a redemption item that will not expire
          example: '9999-12-31T23:59:59+08:00'
          nullable: true
        conditions:
          description: >-
            Conditions for the redemption item, referring to the Conditions
            section where you can find the list of available conditions and how
            to configure them. All conditions in the list are combined using AND
            logic.
          nullable: true
          type: array
          items:
            $ref: '#/components/schemas/ConditionDTO'
        providerItemConfig:
          oneOf:
            - $ref: '#/components/schemas/GovSupplyItemConfig'
          description: >-
            Configuration for the corresponding provider item. Only required for
            redemption provider GOVSUPPLY
          nullable: true
          allOf:
            - $ref: '#/components/schemas/GovSupplyItemConfig'
    RedemptionItemProviderConfigEntity:
      type: object
      properties:
        id:
          type: string
          description: Redemption item provider config id
          example: 0610a0ee-6ceb-45ef-8255-f25580b12356
        campaignId:
          type: string
          description: The identifier of the campaign
          example: f39854be-46f2-492f-9dd8-042e5719f05f
        provider:
          type: string
          enum:
            - GOVWALLET
            - GOVSUPPLY
            - DISBURSE_PLUS
          description: Provider to configure
          example: GOVSUPPLY
        providerConfig:
          oneOf:
            - $ref: '#/components/schemas/GovWalletConfig'
            - $ref: '#/components/schemas/GovSupplyConfig'
          description: Provider configuration
        createdAt:
          type: string
          description: >-
            Created date time of the redemption item provider config for this
            campaign
          example: '2023-11-24T00:00:00+08:00'
        updatedAt:
          type: string
          description: >-
            Updated date time of the redemption item provider config for this
            campaign
          example: '2023-11-24T00:00:00+08:00'
      required:
        - id
        - campaignId
        - provider
        - providerConfig
        - createdAt
        - updatedAt
    CreateRedemptionItemProviderConfigDTO:
      type: object
      properties:
        provider:
          type: string
          enum:
            - GOVWALLET
            - GOVSUPPLY
            - DISBURSE_PLUS
          description: Provider of the redemption item to configure
          example: GOVSUPPLY
        providerConfig:
          oneOf:
            - $ref: '#/components/schemas/GovSupplyConfig'
            - $ref: '#/components/schemas/GovWalletConfig'
            - $ref: '#/components/schemas/DisbursePlusConfig'
          description: Provider configuration
      required:
        - provider
        - providerConfig
    UpdateRedemptionItemProviderConfigDTO:
      type: object
      properties:
        providerConfig:
          oneOf:
            - $ref: '#/components/schemas/GovSupplyConfig'
            - $ref: '#/components/schemas/GovWalletConfig'
            - $ref: '#/components/schemas/DisbursePlusConfig'
          description: Provider configuration
    AccountRedemptionItemEntity:
      type: object
      properties:
        identifier:
          type: string
          description: >-
            Identifier value. Only ASCII printable characters (except `<` and
            `>`) of length 1 to 255 are allowed.


            Note that this value will be trimmed (i.e. leading and trailing
            whitespaces will be removed).
          example: user@example.com
        externalReferenceId:
          type: string
          description: The reference no of the redemption item
          example: 2-0UQYi8RLz4kPjkWZ
        quantity:
          type: number
          description: >-
            Quantity redeemed. The value of quantity must be an integer between
            1 and 1,000
          example: '1'
        redemptionItemId:
          type: string
          description: Redemption item id
          example: 0610a0ee-6ceb-45ef-8255-f25580b12356
        transaction:
          description: Indicates the transaction record for item redemption
          allOf:
            - $ref: '#/components/schemas/PointsTransactionEntity'
        providerRedemptionStatus:
          type: string
          enum:
            - FAILED
            - SUCCESSFUL
          example: SUCCESSFUL
          description: Indicates the status of the redemption with the provider
        providerErrorMessage:
          type: string
          description: Error message from provider if redemption failed
          example: >-
            Unable to redeem item from provider GOVSUPPLY. Provider error
            message: {"message":""}
        isRolledBack:
          type: boolean
          description: >-
            Flag to indicate if this account redemption item and its associated
            points transaction has been rolled back due to errors from the
            redemption provider
          example: false
      required:
        - identifier
        - externalReferenceId
        - quantity
        - redemptionItemId
        - transaction
        - providerRedemptionStatus
        - providerErrorMessage
        - isRolledBack
    RedeemDisbursePlusAdditionalData:
      type: object
      properties:
        amiInCents:
          type: number
          description: >-
            AMI - Average Gross Monthly Income representing in cents. The value
            of amiInCents must be an integer between 1 and 2,147,483,647
          example: 100000
        trancheNumber:
          type: number
          description: >-
            Tranche number. The value of trancheNumber must be an integer
            between 1 and 6
          example: 1
      required:
        - amiInCents
        - trancheNumber
    RedeemRedemptionItemDTO:
      type: object
      properties:
        identifier:
          type: string
          description: >-
            Identifier value. Only ASCII printable characters (except `<` and
            `>`) of length 1 to 255 are allowed.


            Note that this value will be trimmed (i.e. leading and trailing
            whitespaces will be removed).
          example: user@example.com
        redemptionItemId:
          type: string
          description: ID of the item to redeem
          example: 0610a0ee-6ceb-45ef-8255-f25580b12356
        quantityToRedeem:
          type: number
          description: >-
            Quantity of item to redeem. The value of quantityToRedeem must be an
            integer between 1 and 1,000
          example: 1
        additionalData:
          description: Additional data to pass to the redemption item provider
          oneOf:
            - $ref: '#/components/schemas/RedeemDisbursePlusAdditionalData'
          allOf:
            - $ref: '#/components/schemas/RedeemDisbursePlusAdditionalData'
      required:
        - identifier
        - redemptionItemId
        - quantityToRedeem
    RecurrenceScheduleDTO:
      type: object
      properties:
        dayOfWeek:
          type: number
          description: >-
            The day of the week for weekly recurrence (0 for Sunday through 6
            for Saturday). This field is required only when `recurrenceType` is
            `WEEKLY`. The value of dayOfWeek must be an integer between 0 and 6
          example: 1
        dayOfMonth:
          type: number
          description: >-
            The day of the month for monthly recurrence (1 through 31). This
            field is required only when `recurrenceType` is `MONTHLY`. The value
            of dayOfMonth must be an integer between 1 and 31
          example: 1
    RecurrenceStrategyDTO:
      type: object
      properties:
        recurrenceType:
          type: string
          enum:
            - DAILY
            - WEEKLY
            - MONTHLY
          description: >-
            Specifies the recurrence type, which determines how frequently the
            action should recur
          example: DAILY
        recurrenceSchedule:
          description: >-
            Defines the specific day on which the recurrence should occur, based
            on the selected `recurrenceType`. This field is required only for
            `WEEKLY` or`MONTHLY` recurrence types.
          allOf:
            - $ref: '#/components/schemas/RecurrenceScheduleDTO'
      required:
        - recurrenceType
    PointsExpiryStrategy:
      type: object
      properties:
        expireAt:
          type: string
          example: '2023-11-23T00:00:00+08:00'
          description: >-
            Expiry date time of the points. When using the PointsExpiryStrategy,
            this date must come after the rule expiry date.
          nullable: false
        relativeExpiryDuration:
          type: string
          example: P1D
          description: >-
            Relative expiry duration of the points in the ISO 8601 duration
            format.  Must only include years (Y), months (M), weeks (W) or days
            (D). Note: The expiry will be calculated based on the time that the
            action that completed the objective was evaluated.
          nullable: false
    AllotmentV1EngineRule:
      type: object
      properties:
        points:
          type: number
          description: >-
            Points to allot if this objective is met. The value of points must
            be an integer between 1 and 999
          example: 10
        maxTries:
          type: number
          description: >-
            Maximum number of times meeting this objective will result in points
            allotment. A value of -1 will indicate unlimited tries.
          example: 1
        maxTriesResetStrategy:
          description: >-
            Define the strategy for resetting `maxTries` for meeting an
            objective.
          allOf:
            - $ref: '#/components/schemas/RecurrenceStrategyDTO'
        conditions:
          type: object
          description: >-
            Rule conditions. Must either have an "all" or "any" property. See
            the Conditions section for the full list of available conditions and
            how to configure them.
          example: >-
            {"all": [{"fact": "action", "operator": "equal", "value":
            "walk_10000_steps"}]}
        pointsExpiryStrategy:
          description: >-
            Define the strategy for setting the expiry for the points earned
            through allotment rules. If defined, only one of `expireAt` or
            `relativeExpiryDuration` can be set.
          allOf:
            - $ref: '#/components/schemas/PointsExpiryStrategy'
      required:
        - points
        - maxTries
        - conditions
    CreateRuleDTO:
      type: object
      properties:
        ruleJSON:
          description: JSON rules
          allOf:
            - $ref: '#/components/schemas/AllotmentV1EngineRule'
        effectiveAt:
          type: string
          description: >-
            Effective date time of the rule. Omit this field to apply the rule
            immediately
          example: '2023-11-23T00:00:00+08:00'
          default: Current date and time if null
          nullable: true
        expireAt:
          type: string
          description: >-
            Expiry date time of the rule. Omit this field to configure a rule
            that will not expire
          example: '9999-12-31T23:59:59+08:00'
          nullable: true
        type:
          type: string
          enum:
            - ALLOTMENT
            - REDEMPTION
          example: ALLOTMENT
          description: Type of the rule
        objectiveId:
          type: string
          description: >-
            The ID of the objective this rule is applied to. Required if type is
            `ALLOTMENT`.
          example: 9729fc3f-5c5d-41ad-92e2-01caa0af3dba
        priority:
          type: number
          description: >-
            Priority of the rule. Rule priorities are evaluated within each
            campaign. Higher priority rules are evaluated before lower priority
            rules. e.g. A rule with priority 10 will be evaluated before a rule
            with priority 9. If multiple rules have the same priority, there is
            no specific sequence in which these rules will be evaluated.. The
            value of priority must be an integer between 1 and 100
          example: 1
          default: 1
          nullable: false
        engineVersion:
          type: number
          description: Version of Rule Engine. Set to 1.
          example: 1
      required:
        - ruleJSON
        - type
        - objectiveId
        - engineVersion
    SimulateRuleDTO:
      type: object
      properties:
        identifier:
          type: string
          description: >-
            Identifier value. Only ASCII printable characters (except `<` and
            `>`) of length 1 to 255 are allowed.


            Note that this value will be trimmed (i.e. leading and trailing
            whitespaces will be removed).
          example: user@example.com
        action:
          type: string
          description: Action to simulate running this rule with
          example: walk_10000_steps
      required:
        - identifier
        - action
    PatchRuleDTO:
      type: object
      properties:
        ruleJSON:
          description: JSON rules
          allOf:
            - $ref: '#/components/schemas/AllotmentV1EngineRule'
        effectiveAt:
          type: string
          description: >-
            Effective date time of the rule. Omit this field to apply the rule
            immediately
          example: '2023-11-23T00:00:00+08:00'
          default: Current date and time if null
          nullable: true
        expireAt:
          type: string
          description: >-
            Expiry date time of the rule. Omit this field to configure a rule
            that will not expire
          example: '9999-12-31T23:59:59+08:00'
          nullable: true
        priority:
          type: number
          description: >-
            Priority of the rule. Rule priorities are evaluated within each
            campaign. Higher priority rules are evaluated before lower priority
            rules. e.g. A rule with priority 10 will be evaluated before a rule
            with priority 9. If multiple rules have the same priority, there is
            no specific sequence in which these rules will be evaluated.. The
            value of priority must be an integer between 1 and 100
          example: 1
          nullable: false
    TenantPartnerEntity:
      type: object
      properties:
        id:
          type: string
          description: The identifier of the partner
          example: f0ace06c-ae34-4998-9cbd-6aeb384e7710
        sid:
          type: string
          description: The short ID of the partner
          example: upstream_partner
        name:
          type: string
          description: The name of the partner
          example: Upstream Partner
        description:
          type: string
          description: The description of the partner
          example: This is an Upstream Partner
          nullable: true
      required:
        - id
        - sid
        - name
        - description
    TenantPartnerAssignmentEntity:
      type: object
      properties:
        tenantId:
          type: string
          description: The identifier of the tenant
          example: e4da9e30-e443-46f5-a770-e2618d092740
        partner:
          description: The details of the partner given access to this tenant
          allOf:
            - $ref: '#/components/schemas/TenantPartnerEntity'
        createdAt:
          type: string
          description: The timestamp of when the partner was granted access to this tenant
          example: '2023-11-22T16:57:12+08:00'
      required:
        - tenantId
        - partner
        - createdAt
    TenantPartnerDTO:
      type: object
      properties:
        partnerId:
          type: string
          description: The identifier of the partner
          example: 00e3a7a7-d1bc-429f-9fde-aa7b6108e980
      required:
        - partnerId
    CredentialEntity:
      type: object
      properties:
        clientId:
          type: string
          description: The unique identifier for the client
          example: <CLIENT_ID>
        clientSecret:
          type: string
          description: The secret key associated with the client
          example: <CLIENT_SECRET>
        createdAt:
          type: string
          description: The timestamp when the credential was created
          example: '2023-11-22T16:57:12+08:00'
      required:
        - clientId
        - clientSecret
        - createdAt
    TenantWithCredentialsEntity:
      type: object
      properties:
        id:
          type: string
          description: The identifier of the tenant
          example: f0ace06c-ae34-4998-9cbd-6aeb384e7710
        sid:
          type: string
          description: The short ID of the tenant
          example: my_tenant
        name:
          type: string
          description: The name of the tenant
          example: My Tenant
        description:
          type: string
          description: The description of the tenant
          example: This is Tenant A
          nullable: true
        createdAt:
          type: string
          description: The creation timestamp of the specified tenant
          example: '2023-11-22T16:57:12+08:00'
        updatedAt:
          type: string
          description: The updated timestamp of the specified tenant
          example: '2023-11-22T16:57:12+08:00'
        ownerEmail:
          type: string
          description: Email address of the tenant owner
          example: user@abc.gov.sg
        credentials:
          description: The OAuth 2.0 Credentials for this tenant
          type: array
          items:
            $ref: '#/components/schemas/CredentialEntity'
      required:
        - id
        - sid
        - name
        - description
        - createdAt
        - updatedAt
        - ownerEmail
        - credentials
    DeleteCredentialDTO:
      type: object
      properties:
        clientId:
          type: string
          description: The unique identifier of the client
          format: uuid
      required:
        - clientId
    WebhookEntity:
      type: object
      properties:
        id:
          type: string
          description: The identifier of the webhook
          example: f39854be-46f2-492f-9dd8-042e5719f05f
        campaignId:
          type: string
          description: Campaign Id
          example: 0610a0ee-6ceb-45ef-8255-f25580b12356
        url:
          type: string
          description: The URL for the webhook
          example: https://www.api.example.gov.sg/webhook
        description:
          type: string
          description: The description of the webhook
          example: This is Webhook A
          nullable: true
        enabledEvents:
          type: array
          description: List of enabled events for this webhook
          example:
            - OBJECTIVE_COMPLETED
          items:
            type: string
            enum:
              - OBJECTIVE_COMPLETED
              - POINTS_TARGET_MET
              - ACCOUNT_TIER_UPDATED
        isActive:
          type: boolean
          description: Whether this webhook is active or not
        createdAt:
          type: string
          description: The creation timestamp of the specified account
          example: '2023-11-22T16:57:12+08:00'
        updatedAt:
          type: string
          description: The updated timestamp of the specified account
          example: '2023-11-22T16:57:12+08:00'
      required:
        - id
        - campaignId
        - url
        - description
        - enabledEvents
        - isActive
        - createdAt
        - updatedAt
    RegisterWebhookDTO:
      type: object
      properties:
        url:
          type: string
          description: Unique URL within each campaign
          example: https://api.example.gov.sg
        description:
          type: string
          description: >-
            Description of the campaign webhook. Only ASCII printable characters
            (except `<`, `=` and `>`) of length 1 to 250 are allowed.
          example: Description for campaign webhook
          nullable: true
        enabledEvents:
          type: array
          description: List of enabled events for the webhook
          example:
            - OBJECTIVE_COMPLETED
          items:
            type: string
            enum:
              - OBJECTIVE_COMPLETED
              - POINTS_TARGET_MET
              - ACCOUNT_TIER_UPDATED
      required:
        - url
        - enabledEvents
    UpdateWebhookDTO:
      type: object
      properties:
        url:
          type: string
          description: Unique URL within each campaign
          example: https://api.example.gov.sg
        description:
          type: string
          description: >-
            Description of the campaign webhook. Only ASCII printable characters
            (except `<`, `=` and `>`) of length 1 to 250 are allowed.
          example: Description for campaign webhook
          nullable: true
        enabledEvents:
          type: array
          description: List of enabled events for the webhook
          example:
            - OBJECTIVE_COMPLETED
          items:
            type: string
            enum:
              - OBJECTIVE_COMPLETED
              - POINTS_TARGET_MET
              - ACCOUNT_TIER_UPDATED
        isActive:
          type: boolean
          description: Flag to indicate whether webhook is active or not
          example: true
    ObjectiveCompletedWebhookEventDataEntity:
      type: object
      properties:
        identifier:
          type: string
          description: The identifier of this account.
          example: test@example.com
        objective:
          description: Completed objective details.
          allOf:
            - $ref: '#/components/schemas/AccountObjectiveWithPointsAndActionsEntity'
      required:
        - identifier
        - objective
      x-tags: Webhook Events
    PointsTargetMetWebhookEventDataEntity:
      type: object
      properties:
        identifier:
          type: string
          description: The identifier of this account.
          example: test@example.com
        pointsAdded:
          type: number
          description: The total amount of points added to the account for this campaign.
          example: 100
        pointsTargets:
          description: >-
            The points target(s) met for this campaign. If a single points
            credit transaction meets multiple points targets, this array will
            contain all the points targets that were met.
          example:
            - 50
            - 100
          type: array
          items:
            type: number
        metAt:
          type: string
          description: Date and time when the points target was met.
          example: '2024-03-06T00:00:00+08:00'
      required:
        - identifier
        - pointsAdded
        - pointsTargets
        - metAt
      x-tags: Webhook Events
    AccountTierChangedEntity:
      type: object
      properties:
        id:
          type: string
          description: The identifier of the campaign tier
          example: f39854be-46f2-492f-9dd8-042e5719f05f
        name:
          type: string
          description: The name of the campaign tier
          example: Bronze
      required:
        - id
        - name
    AccountTierChangedWebhookEventDataEntity:
      type: object
      properties:
        identifier:
          type: string
          description: The identifier of this account.
          example: test@example.com
        previousTier:
          description: >-
            The account's tier before the update. If the account had no previous
            tier, this value will be null.
          nullable: true
          allOf:
            - $ref: '#/components/schemas/AccountTierChangedEntity'
        newTier:
          description: The account's updated tier after the change.
          allOf:
            - $ref: '#/components/schemas/AccountTierChangedEntity'
        changedAt:
          type: string
          description: The updated timestamp of the campaign tier
          example: '2023-11-22T16:57:12+08:00'
      required:
        - identifier
        - previousTier
        - newTier
        - changedAt
      x-tags: Webhook Events
servers:
  - url: https://api.rewards.gov.sg
