# Bulk Create And Allocate Rewards

## OpenAPI Specification

```yaml
openapi: 3.0.1
info:
  title: ''
  description: ''
  version: 1.0.0
paths:
  /api/v0/partner/enKashCard/bulk-create-allocate-points-json:
    post:
      summary: Bulk Create And Allocate Rewards
      deprecated: false
      description: >
        This API facilitates the creation / allocation of points to users in
        bulk. Request is an array of jsons (can be seen in example)


        Error messages client might expect as failure reasons in dto:-


        UNPROCESSABLE_ENTITY (422): The request is semantically incorrect.

        "Company Id is required if it is an Enkash User"

        "Primary Enkash card is not present. So bulk upload cannot be done"

        "KYC is not uploaded or under review for the primary card. So bulk
        upload cannot be done"

        "Bin Type is not mapped on PlanMaster"

        "Card Account does not exist for this partner"



        NOT_FOUND (404): The requested resource was not found.

        "Card account not found for companyId: [companyId] and cardAccountId:
        [cardAccountId]"
      tags:
        - Rewards & Incentives/APIs - Reward/Reward Allocation
      parameters:
        - name: companyId
          in: query
          description: Enkash Company Id
          required: true
          example: CEKBVCGMR1
          schema:
            type: string
        - name: cardAccountId
          in: query
          description: Enkash Card account Id
          required: true
          example: CA1ZS96
          schema:
            type: string
        - name: isPointsAllocation
          in: query
          description: >
            If the flag is true, the point will be allocated to the existing
            user as well as the new  user.

            If the flag is false only new users will be created and points will
            be allocated to new users , no points will be allocated to the
            existing users.
          required: true
          example: 'true'
          schema:
            type: boolean
        - name: partnerId
          in: header
          description: ''
          required: true
          example: CRMTTTMUF
          schema:
            type: string
        - name: Content-Type
          in: header
          description: ''
          required: true
          example: application/json
          schema:
            type: string
        - name: Authorization
          in: header
          description: ''
          required: true
          example: '{token}'
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              type: array
              items:
                type: object
                properties:
                  title:
                    type: string
                    description: Mr/Mrs/Ms
                  name:
                    type: string
                    description: Name of the user
                  email:
                    type: string
                    description: Email id of user
                  mobile:
                    type: string
                    description: Mobile of user
                  loadAmount:
                    type: integer
                    description: Amount to be allocated to user
                  remarks:
                    type: string
                    description: Remarks
                  uniqueReferenceNumber:
                    type: string
                    description: Unique Transaction Reference number provided by client
                  01J5W6QW1H8SSXJTPYZ1HGF1MA:
                    type: string
                x-apidog-orders:
                  - title
                  - name
                  - email
                  - mobile
                  - loadAmount
                  - remarks
                  - uniqueReferenceNumber
                  - 01J5W6QW1H8SSXJTPYZ1HGF1MA
                required:
                  - 01J5W6QW1H8SSXJTPYZ1HGF1MA
                  - name
                  - mobile
                  - loadAmount
                  - uniqueReferenceNumber
            example:
              - title: Mr
                name: John hrllo
                email: ojas.bisariya@kratikal.com
                mobile: '6836111111'
                loadAmount: 100
                remarks: good
                uniqueReferenceNumber: test123457
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  email:
                    type: string
                    description: Email of the user to whom points are allocated
                  name:
                    type: string
                    description: name of user
                  mobile:
                    type: string
                    description: mobile number of user
                  title:
                    type: string
                    description: Mr / Mrs /Ms
                  loadAmount:
                    type: number
                    description: How much amount is to be loaded to user card
                  companyId:
                    type: string
                    description: ENkash Company Id
                  cardAccountId:
                    type: string
                    description: 'Enkash Card Account id '
                  enkashCardId:
                    type: string
                    description: Enkash Card Id of the user Card
                  userId:
                    type: string
                    description: Enkash User Id
                  accountBalance:
                    type: number
                    description: Balance left in account after allocation
                  enkashCardTxnId:
                    type: string
                    description: Unique Transaction Id of EnKash
                  otbBalance:
                    type: number
                    description: User Card Balance after allocation
                  successCount:
                    type: number
                    description: 'number of successful allocations '
                  failureCount:
                    type: number
                    description: 'number of failed allocations '
                  totalCount:
                    type: number
                    description: 'total number of allocations '
                x-apidog-orders:
                  - email
                  - name
                  - mobile
                  - title
                  - loadAmount
                  - companyId
                  - cardAccountId
                  - enkashCardId
                  - userId
                  - accountBalance
                  - enkashCardTxnId
                  - otbBalance
                  - successCount
                  - failureCount
                  - totalCount
                required:
                  - email
                  - name
                  - mobile
                  - title
                  - loadAmount
                  - companyId
                  - cardAccountId
                  - enkashCardId
                  - userId
                  - accountBalance
                  - enkashCardTxnId
                  - otbBalance
                  - successCount
                  - failureCount
                  - totalCount
              example:
                code: 0
                message: Success
                payload:
                  successBulkEnKashCardCreateDTOs:
                    - email: johndee@email.com
                      name: John Dee
                      mobile: '6776543210'
                      title: Mr
                      loadAmount: 10
                      companyId: CEKCDVT1UV
                      cardAccountId: CAF0RX8N3
                      enkashCardId: EKCBO72AEY
                      userId: EKHVPYVS
                      accountBalance: 48681
                      enkashCardTxnId: ECTA72T56O2SP
                      otbBalance: 10000
                  failureBulkEnKashCardCreateDTOs:
                    - email: taylor@email.com
                      name: test1 testlast
                      mobile: '6876543324'
                      title: Mr
                      loadAmount: 10
                      companyId: CEKCDVT1UV
                      cardAccountId: CAF0RX8N3
                    - email: johndee@email.com
                      name: John Dee
                      mobile: '6776543210'
                      title: Mr
                      loadAmount: 10
                      companyId: CEKCDVT1UV
                      cardAccountId: CAF0RX8N3
                      uniqueReferenceNumber: '123443101'
                      failureReason: >-
                        The transaction associated with the given Unique
                        reference Number already exists
                  successCount: 1
                  failureCount: 2
                  totalCount: 3
          headers: {}
          x-apidog-name: Success
      security: []
      x-apidog-folder: Rewards & Incentives/APIs - Reward/Reward Allocation
      x-apidog-status: developing
      x-run-in-apidog: https://app.apidog.com/web/project/616243/apis/api-9796906-run
components:
  schemas: {}
  securitySchemes: {}
servers:
  - url: https://ekpayout-uat.enkash.in
    description: Testing Env
security: []

```
