---
openapi: "3.0.0"
info:
  title: "Api Documentation"
  description: "API documentation for Runo Call Management CRM"
  termsOfService: "https://runo.in/terms-and-conditions/"
  contact:
    name: "Runo Support"
    url: "https://runo.in"
    email: "care@runo.in"
  license:
    name: "© Runo CRM 2024. All rights reserved"
  version: "v1.9.0"
  x-logo:
    url: "https://cdn.runo.in/logo/transparent-playstore-icon.png"
    altText: "Runo logo"
    href: "https://runo.in"
servers:
  - url: "https://api.runo.in/v1"
    description: "Production"

security:
  - "Auth-Key": []
tags:
  - name: "Users"
  - name: "Call Logs"
  - name: "CRM"
  - name: "Customers"
paths:
  /user/ids:
    get:
      tags:
        - "Users"
      description: "Fetches all the user ids of your company"
      deprecated: true
      operationId: "Get all User Ids"
      responses:
        "200":
          description: "If the auth token is valid."
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/userIds"
        "403":
          description: "UnAuthorized."
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/403"
              examples:
                UnAuthenticated:
                  value:
                    message: "Invalid API Key"
                    statusCode: -1
                ApiKeyExpired:
                  value:
                    message: "Your API Key is expired"
                    statusCode: -1
  /user:
    get:
      tags:
        - "Users"
      description: "Fetches all the users of your company"
      operationId: "Get all Users"
      responses:
        "200":
          description: "If the auth token is valid."
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/users"
        "403":
          description: "UnAuthorized."
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/403"
              examples:
                UnAuthenticated:
                  value:
                    message: "Invalid API Key"
                    statusCode: -1
                ApiKeyExpired:
                  value:
                    message: "Your API Key is expired"
                    statusCode: -1
  /user/login/log:
    get:
      tags:
        - "Users"
      description: "Fetches the Login logs of all the users of a given date."
      operationId: "Get All Users Login logs"
      parameters:
        - name: "date"
          in: "query"
          description: "Date for which login logs should be fetched. Accepted\
            \ format is YYYY-MM-DD."
          required: false
          style: "form"
          explode: true
          schema:
            type: "string"
            example: "2020-05-25"
            default: "Yesterday's date"
        - name: "pageNo"
          in: "query"
          description: "Requested Page number"
          required: true
          style: "form"
          explode: true
          schema:
            type: "number"
            example: "1"
        - name: "processName"
          in: "query"
          description: "Name of the proccess for which login logs should be fetched. If the process name is missing or invalid, logs from all the process will be fetched"
          required: false
          style: "form"
          explode: true
          schema:
            type: "string"
            example: "Default Proccess"
            default: "all"
      responses:
        "200":
          description: "If the auth token is valid."
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/loginlogs"
        "403":
          description: "UnAuthorized."
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/403"
              examples:
                UnAuthenticated:
                  value:
                    message: "Invalid API Key"
                    statusCode: -1
                ApiKeyExpired:
                  value:
                    message: "Your API Key is expired"
                    statusCode: -1
  /crm/allocations:
    get:
      tags:
        - "CRM"
      description:
        "Fetches the allocations of a given date (Only allows the past dates). This API returns\
        \ at max 100 records in one page"
      operationId: "List Allocations"
      parameters:
        - name: "date"
          in: "query"
          description:
            "Date for which allocations should be fetched. Accepted\
            \ format is YYYY-MM-DD. Only the past dates are allowed."
          required: false
          style: "form"
          explode: true
          schema:
            type: "string"
            example: "2026-03-23"
            default: "Yesterday's date"
        - name: "pageNo"
          in: "query"
          description: "Requested Page number"
          required: true
          style: "form"
          explode: true
          schema:
            type: "number"
            example: "1"
        - name: "processName"
          in: "query"
          description: "Name of the proccess for which allocations should be fetched."
          required: false
          style: "form"
          explode: true
          schema:
            type: "string"
            example: "Default Proccess"
            default: "all"
      responses:
        "200":
          description: "If the auth token is valid."
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/allocations"
        "403":
          description: "UnAuthorized."
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/403"
              examples:
                UnAuthenticated:
                  value:
                    message: "Invalid API Key"
                    statusCode: -1
                ApiKeyExpired:
                  value:
                    message: "Your API Key is expired"
                    statusCode: -1
                AccessDenied:
                  value:
                    message:
                      "This Api access is only available between XX AM to XX\
                      \ AM IST"
                    statusCode: -1
    post:
      tags:
        - "CRM"
      description: "API to create multiple allocations and assign to users based on common pool, workflow rule, or assignedTo number"
      operationId: "Add Multiple Allocations"      
      parameters:
        - name: "results"
          in: "query"
          description: "Level of detail in response: off=count only, failed=failed and count, all=success, failed and count"
          required: false
          style: "form"
          explode: true
          schema:
            type: "string"
            enum:
              - "off"
              - "all"
              - "failed"
            default: "failed"
      requestBody:
        description: "Data to be allocated"
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/bulkAllocation"
        required: true
      responses:
        "200":
          description: "If the auth token is valid."
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bulkAddAllocationsSuccess"
        "403":
          description: "UnAuthorized."
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/403"
              examples:
                UnAuthenticated:
                  value:
                    message: "Invalid API Key"
                    statusCode: -1
                ApiKeyExpired:
                  value:
                    message: "Your API Key is expired"
                    statusCode: -1
  /customer/list:
    get:
      tags:
        - "Customers"
      description:
        "Fetches the customers of a given date (Only allows the past dates). This API returns\
        \ at max 100 records in one page"
      operationId: "List Customers"
      parameters:
        - name: "date"
          in: "query"
          description:
            "Date for which customers should be fetched. Accepted\
            \ format is YYYY-MM-DD. Only the past dates are allowed."
          required: false
          style: "form"
          explode: true
          schema:
            type: "string"
            example: "2026-03-23"
            default: "Yesterday's date"
        - name: "pageNo"
          in: "query"
          description: "Requested Page number"
          required: true
          style: "form"
          explode: true
          schema:
            type: "number"
            example: "1"
        - name: "processName"
          in: "query"
          description: "Name of the proccess for which customers should be fetched."
          required: false
          style: "form"
          explode: true
          schema:
            type: "string"
            example: "Default Proccess"
            default: "all"
        - name: "dateType"
          in: "query"
          description: "Type of date to filter by. Either 'created' or 'updated'."
          required: false
          style: "form"
          explode: true
          schema:
            type: "string"
            enum: ["created", "updated"]
            default: "created"
            example: "created"
      responses:
        "200":
          description: "If the auth token is valid."
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/customer~1list"
        "403":
          description: "UnAuthorized."
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/403"
              examples:
                UnAuthenticated:
                  value:
                    message: "Invalid API Key"
                    statusCode: -1
                ApiKeyExpired:
                  value:
                    message: "Your API Key is expired"
                    statusCode: -1
                AccessDenied:
                  value:
                    message:
                      "This Api access is only available between XX AM to XX\
                      \ AM IST"
                    statusCode: -1
  /user/suspend:
   put:
     tags:
       - "Users"
     description: "Suspends a user in your company"
     operationId: "Suspend User"
     requestBody:
       description: "Phone number of the user to be suspended"
       content:
         application/json:
           schema:
             $ref: "#/components/schemas/suspendUser"
       required: true
     responses:
       "200":
         description: "If the auth token is valid."
         content:
           application/json:
             schema:
               $ref: "#/components/schemas/suspendUserSuccess"
       "403":
         description: "UnAuthorized."
         content:
           application/json:
             schema:
               $ref: "#/components/schemas/403"
             examples:
               UnAuthenticated:
                 value:
                   message: "Invalid API Key"
                   statusCode: -1
               ApiKeyExpired:
                 value:
                   message: "Your API Key is expired"
                   statusCode: -1
  /crm/interactions:
    get:
      tags:
        - "CRM"
      description:
        "Fetches the crm interactions of a given date (Only allows the past dates). This API returns\
        \ at max 100 records in one page"
      operationId: "List CRM Interactions"
      parameters:
        - name: "date"
          in: "query"
          description:
            "Date for which crm interactions should be fetched. Accepted\
            \ format is YYYY-MM-DD. Only the past dates are allowed."
          required: false
          style: "form"
          explode: true
          schema:
            type: "string"
            example: "2020-05-25"
            default: "Yesterday's date"
        - name: "pageNo"
          in: "query"
          description: "Requested Page number"
          required: true
          style: "form"
          explode: true
          schema:
            type: "number"
            example: "1"
        - name: "processName"
          in: "query"
          description: "Name of the proccess for which crm interactions should be fetched."
          required: false
          style: "form"
          explode: true
          schema:
            type: "string"
            example: "Default Proccess"
            default: "all"
        - name: "isLatestOnly"
          in: "query"
          description: "When true this api fetches the latest interaction of each customer on the given day. It is false by default."
          required: false
          style: "form"
          explode: true
          schema:
            type: "boolean"
            example: "true"
            default: false
      responses:
        "200":
          description: "If the auth token is valid."
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/interactions"
        "403":
          description: "UnAuthorized."
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/403"
              examples:
                UnAuthenticated:
                  value:
                    message: "Invalid API Key"
                    statusCode: -1
                ApiKeyExpired:
                  value:
                    message: "Your API Key is expired"
                    statusCode: -1
                AccessDenied:
                  value:
                    message:
                      "This Api access is only available between XX AM to XX\
                      \ AM IST"
                    statusCode: -1
  /crm/interaction:
    post:
      tags:
        - "CRM"
      description: "Creates or Updates the customer (if existing) and adds an interaction under that customer."
      operationId: "Create Interaction"
      requestBody:
        description: "Data of the Interaction"
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/interaction"
        required: true
      responses:
        "200":
          description: "If the auth token is valid."
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/addInteractionSuccess"
        "403":
          description: "UnAuthorized."
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/403"
              examples:
                UnAuthenticated:
                  value:
                    message: "Invalid API Key"
                    statusCode: -1
                ApiKeyExpired:
                  value:
                    message: "Your API Key is expired"
                    statusCode: -1
  /call/logs:
    get:
      tags:
        - "Call Logs"
      description: "Fetches the call logs of a given date (Only allows the past dates). This api returns at max 100 records in one page."
      operationId: "List call logs"
      parameters:
        - name: "date"
          in: "query"
          description: "Date for which call logs should be fetched. Accepted\
            \ format is YYYY-MM-DD. Only the past dates are allowed."
          required: false
          style: "form"
          explode: true
          schema:
            type: "string"
            example: "2020-05-25"
            default: "Yesterday's date"
        - name: "pageNo"
          in: "query"
          description: "Requested Page number"
          required: true
          style: "form"
          explode: true
          schema:
            type: "number"
            example: "1"
        - name: "processName"
          in: "query"
          description: "Name of the proccess for which call logs should be fetched."
          required: false
          style: "form"
          explode: true
          schema:
            type: "string"
            example: "Default Proccess"
            default: "all"
        - name: "isLatestOnly"
          in: "query"
          description: "When true this api fetches the latest call interaction of each customer on the given day. It is false by default."
          required: false
          style: "form"
          explode: true
          schema:
            type: "boolean"
            example: "true"
            default: false
      responses:
        "200":
          description: "If the auth token is valid."
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/callLogs"
        "403":
          description: "UnAuthorized."
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/403"
              examples:
                UnAuthenticated:
                  value:
                    message: "Invalid API Key"
                    statusCode: -1
                ApiKeyExpired:
                  value:
                    message: "Your API Key is expired"
                    statusCode: -1
  /crm/whatsapp:
    get:
      tags:
        - "CRM"
      description:
        "Fetches the whatsapp interactions of a given date (Only allows the past dates) and a given proccess. This API returns\
        \ at max 100 records in one page"
      operationId: "List Whatsapp Interactions"
      parameters:
        - name: "date"
          in: "query"
          description:
            "Date for which whatsapp interactions should be fetched. Accepted\
            \ format is YYYY-MM-DD. Only allows the past dates."
          required: false
          style: "form"
          explode: true
          schema:
            type: "string"
            example: "2020-05-25"
            default: "Yesterday's date"
        - name: "pageNo"
          in: "query"
          description: "Requested Page number"
          required: true
          style: "form"
          explode: true
          schema:
            type: "number"
            example: "1"
        - name: "processName"
          in: "query"
          description: "Name of the proccess for which whatsapp interactions should be fetched."
          required: false
          style: "form"
          explode: true
          schema:
            type: "string"
            example: "Default Proccess"
            default: "all"
      responses:
        "200":
          description: "If the auth token is valid."
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/whatsapp"
        "403":
          description: "UnAuthorized."
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/403"
              examples:
                UnAuthenticated:
                  value:
                    message: "Invalid API Key"
                    statusCode: -1
                ApiKeyExpired:
                  value:
                    message: "Your API Key is expired"
                    statusCode: -1
  /crm/allocation:
    post:
      tags:
        - "CRM"
      description: "Api to create an allocation to a user or common pool"
      operationId: "Create Allocation"
      parameters:
        - name: "isCommonPool"
          in: "query"
          description:
            "When isCommonPool is true, if the assignTo number is missing or invalid,
            the allocation will be uploaded into common pool"
          required: false
          style: "form"
          explode: true
          schema:
            type: "boolean"
            example: true
      requestBody:
        description: "Data to be allocated"
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/allocation"
        required: true
      responses:
        "200":
          description: "If the auth token is valid."
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/addAllocationSuccess"
        "403":
          description: "UnAuthorized."
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/403"
              examples:
                UnAuthenticated:
                  value:
                    message: "Invalid API Key"
                    statusCode: -1
                ApiKeyExpired:
                  value:
                    message: "Your API Key is expired"
                    statusCode: -1
  /crm/allocation/user:
    delete:
      tags:
        - "CRM"
      description: "Api to delete allocations that are currently assigned to the given users"
      operationId: "Delete Allocations By Users"
      requestBody:
        description: "Phone Numbers of the users whose allocations are to be deleted"
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/deleteAllocationsByUser"
        required: true
      responses:
        "200":
          description: "Deleted Successfully"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/deleteAllocationSuccess"
              examples:
                Success:
                  value:
                    message: "Successfully deleted XX allocations"
                    statusCode: 0
                UserNotFound:
                  value:
                    message: "Unable to find users with the given phone numbers."
                    statusCode: 3
        "403":
          description: "UnAuthorized."
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/403"
              examples:
                UnAuthenticated:
                  value:
                    message: "Invalid API Key"
                    statusCode: -1
                ApiKeyExpired:
                  value:
                    message: "Your API Key is expired"
                    statusCode: -1
  /crm/allocation/customer:
    delete:
      tags:
        - "CRM"
      description: "Api to delete the allocations of the given customers"
      operationId: "Delete Allocations By Customers"
      requestBody:
        description: "Phone Numbers of the customers with country codes, whose allocations are to be deleted."
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/deleteAllocationsByCustomer"
        required: true
      responses:
        "200":
          description: "If the auth token is valid."
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/deleteAllocationSuccess"
        "403":
          description: "UnAuthorized."
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/403"
              examples:
                UnAuthenticated:
                  value:
                    message: "Invalid API Key"
                    statusCode: -1
                ApiKeyExpired:
                  value:
                    message: "Your API Key is expired"
                    statusCode: -1
  /process:
    get:
      tags:
        - "Processes"
      description: "Fetches all the processes in your company"
      operationId: "Get all Processes"
      responses:
        "200":
          description: "If the auth token is valid."
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/process"
        "403":
          description: "UnAuthorized."
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/403"
              examples:
                UnAuthenticated:
                  value:
                    message: "Invalid API Key"
                    statusCode: -1
                ApiKeyExpired:
                  value:
                    message: "Your API Key is expired"
                    statusCode: -1
  /crm/fields:
    get:
      tags:
        - "CRM"
      description: "Fetches all the crm fields (user defined fields and fixed fields) for the given process id"
      operationId: "Get all CRM Fields"
      parameters:
        - name: "processName"
          in: "query"
          description: "process name"
          required: false
          style: "form"
          explode: true
          schema:
            type: "string"
            example: "Default process"
      responses:
        "200":
          description: "If the auth token is valid."
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/crmFields"
        "403":
          description: "UnAuthorized."
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/403"
              examples:
                UnAuthenticated:
                  value:
                    message: "Invalid API Key"
                    statusCode: -1
                ApiKeyExpired:
                  value:
                    message: "Your API Key is expired"
                    statusCode: -1
  /customer/phone/{phoneNumber}:
    delete:
      tags:
        - "Customers"
      description: "Api to delete the customer by the given phone number with the country code"
      operationId: "Delete Customer by Phone Number"
      parameters:      
        - in: path
          name: phoneNumber
          schema:
            type: string
            example: "+919876543210"
          required: true
          description: Phone Number (with country code) of the customer to be deleted
      responses:
        "200":
          description: "If the auth token is valid."
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/deleteCustomerSuccess"
        "403":
          description: "UnAuthorized."
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/403"
              examples:
                UnAuthenticated:
                  value:
                    message: "Invalid API Key"
                    statusCode: -1
                ApiKeyExpired:
                  value:
                    message: "Your API Key is expired"
                    statusCode: -1
  /customer/id/{customerId}:
    delete:
      tags:
        - "Customers"
      description: "Api to delete the customer by Id"
      operationId: "Delete Customer by Id"
      parameters:      
        - in: path
          name: customerId
          schema:
            type: string
          required: true
          description: Id of the customer to be deleted
      responses:
        "200":
          description: "If the auth token is valid."
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/deleteCustomerSuccess"
        "403":
          description: "UnAuthorized."
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/403"
              examples:
                UnAuthenticated:
                  value:
                    message: "Invalid API Key"
                    statusCode: -1
                ApiKeyExpired:
                  value:
                    message: "Your API Key is expired"
                    statusCode: -1
  /call/analysis/initiate:
    post:
      tags:
        - "AI Call Analysis"
      description:
        "Sends a call recording for AI analysis. Send a signed url for the recording along with the
        call type and the agent name. Credits are charged on the length of the recording, measured by
        us, at one credit per minute rounded up. The analysis runs in the background, so this returns
        a requestId which you use to check the progress and fetch the result."
      operationId: "Initiate Call Analysis"
      requestBody:
        description: "Details of the call to be analysed"
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/initiateCallAnalysis"
            example:
              recordingUrl: "https://your-bucket.s3.ap-south-1.amazonaws.com/call.mp3?X-Amz-Signature=xxxxx"
              callType: "incoming"
              callerName: "Asha Nair"
              metadata:
                ticketId: "TKT-4471"
        required: true
      responses:
        "200":
          description: "If the auth token is valid."
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/initiateCallAnalysisSuccess"
        "403":
          description: "UnAuthorized."
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/403"
              examples:
                UnAuthenticated:
                  value:
                    message: "Invalid API Key"
                    statusCode: -1
                ApiKeyExpired:
                  value:
                    message: "Your API Key is expired"
                    statusCode: -1
                CreditsExhausted:
                  value:
                    message: "Your API Key is inactive as the AI Call Analysis credits are exhausted"
                    statusCode: -1
  /call/analysis/result/{id}:
    get:
      tags:
        - "AI Call Analysis"
      description: |
        Returns the finished analysis of the call. This includes the call score, a summary of the
        conversation, how positive each speaker sounded, how the talking time was split, the
        compliance checks that were configured, and the keywords detected. The score and the
        analysis are filled in only once the status reads `0`.

        | Status | Meaning | What it tells you |
        | --- | --- | --- |
        | `-1` | PAUSED | Stopped for want of credits |
        | `0` | COMPLETED | The score and analysis are ready |
        | `1` | FAILED | Could not be processed, credits returned |
        | `2` | IN_PROGRESS | Accepted and queued |
        | `3` | TRANSCRIBED | The conversation has been written out |
        | `4` | ANALYSING | The transcript is being scored |
        | `5` | NO_CONVERSATION | The recording held no conversation |
      operationId: "Get Call Analysis"
      parameters:
        - in: path
          name: id
          schema:
            type: string
          required: true
          description: "The id returned when the call analysis was initiated"
      responses:
        "200":
          description: "If the auth token is valid."
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/callAnalysis"
        "403":
          description: "UnAuthorized."
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/403"
              examples:
                UnAuthenticated:
                  value:
                    message: "Invalid API Key"
                    statusCode: -1
                ApiKeyExpired:
                  value:
                    message: "Your API Key is expired"
                    statusCode: -1
components:
  schemas:
    initiateCallAnalysis:
      type: "object"
      required:
        - "recordingUrl"
        - "callType"
      properties:
        recordingUrl:
          type: "string"
          description:
            "A signed url for the recording, time limited, for example a pre-signed Amazon S3 or
            Google Cloud Storage url. It must be an https url carrying a signature, and it needs to
            stay valid until the analysis finishes."
        callType:
          type: "string"
          enum:
            - "incoming"
            - "outgoing"
          description:
            "Whether the call was incoming or outgoing. Missed calls and calls of no length cannot
            be analysed."
        callerName:
          type: "string"
          description: "Name of the agent who handled the call. Optional (pass it for better results)."
        customerName:
          type: "string"
          description: "Name of the customer on the call. Optional."
        processId:
          type: "string"
          description:
            "Id of the process. Optional, and accepted for compatibility, but a recording sent
            through this API is always analysed against your default process."
        metadata:
          type: "object"
          description:
            "Any reference of your own, such as a ticket number or a campaign name. Saved exactly as
            you send it and returned unchanged when you fetch the analysis. Up to 50 entries."
      description: "Schema to initiate a call analysis"
    initiateCallAnalysisSuccess:
      type: "object"
      properties:
        statusCode:
          type: "number"
          description: "Will be 0 in case of success"
        message:
          type: "string"
          description:
            "Contains the success message or error reason, based on the\
            \ statusCode"
        data:
          type: "object"
          properties:
            requestId:
              type: "string"
              description:
                "The id we create for this analysis. Use it to check the progress and fetch the
                result."
            status:
              type: "integer"
              description: "Stage of the analysis when the request was accepted"
            creditsUsed:
              type: "number"
              description:
                "Credits charged for this request. One minute of recording costs one credit, rounded
                up, so a one minute call costs one credit and a call of one minute and ten seconds
                costs two."
      description: "Schema for an initiated call analysis"
      example:
        statusCode: 0
        message: "Successfully initiated the call analysis"
        data:
          requestId: "68b1f2c9a4d3e5f601234567"
          status: 2
          creditsUsed: 3
    callAnalysis:
      type: "object"
      properties:
        statusCode:
          type: "number"
          description: "Will be 0 in case of success"
        message:
          type: "string"
          description:
            "Contains the success message or error reason, based on the\
            \ statusCode"
        data:
          type: "object"
          properties:
            callLogId:
              type: "string"
              description: "Id of the analysis"
            status:
              type: "integer"
              enum: [-1, 0, 1, 2, 3, 4, 5]
              description: "Stage of the analysis. See the table above."
            score:
              type: "number"
              nullable: true
              description:
                "Score out of 100 for how the call was handled, based on your scoring settings.
                Null until the status reads COMPLETED, and null as well when call scoring is turned
                off for your account, in which case the rest of the analysis is still returned."
            metadata:
              type: "object"
              description: "The reference you sent when initiating the analysis, returned unchanged"
            analysis:
              type: "object"
              description:
                "The analysis of the conversation. Null until the status reads COMPLETED."
              properties:
                summary:
                  type: "string"
                  description: "A short summary of what the call was about"
                transcript:
                  type: "array"
                  description:
                    "The conversation as it was spoken, in order. Each entry is one turn by one
                    speaker."
                  items:
                    type: "object"
                    properties:
                      speaker:
                        type: "string"
                        description: "Who was speaking on this turn, the agent or the customer"
                      utterance:
                        type: "string"
                        description: "What was said on this turn"
                sentiment:
                  type: "object"
                  description:
                    "How positive each speaker sounded, from -1 for negative to 1 for positive"
                  properties:
                    agent:
                      type: "number"
                    customer:
                      type: "number"
                wordsSpoken:
                  type: "object"
                  description: "Number of words spoken by each speaker"
                  properties:
                    agent:
                      type: "number"
                    customer:
                      type: "number"
                loudness:
                  type: "object"
                  description:
                    "Average loudness of each speaker in decibels, and of anything that was not
                    speech"
                  properties:
                    agent:
                      type: "number"
                    customer:
                      type: "number"
                    nonSpeech:
                      type: "number"
                speakingTime:
                  type: "object"
                  description:
                    "How the call time was split, in seconds, including time spent on hold, in
                    noise and in silence"
                  properties:
                    agent:
                      type: "number"
                    customer:
                      type: "number"
                    nonSpeech:
                      type: "object"
                      properties:
                        holdTime:
                          type: "number"
                        noise:
                          type: "number"
                        deadAir:
                          type: "number"
                customerSatisfaction:
                  type: "string"
                  description: "How satisfied the customer sounded by the end of the call"
                complianceChecks:
                  type: "object"
                  description:
                    "Each compliance check configured for your process, and whether the agent met
                    it on this call"
                entities:
                  type: "array"
                  description: "Words and phrases of interest that came up, and how often"
                  items:
                    type: "object"
                    properties:
                      keyword:
                        type: "string"
                      count:
                        type: "number"
                fillerWords:
                  type: "array"
                  description: "Filler words the agent used, and how often"
                  items:
                    type: "object"
                    properties:
                      keyword:
                        type: "string"
                      count:
                        type: "number"
                intentSources:
                  type: "array"
                  description: "What the customer showed interest in during the call"
                  items:
                    type: "object"
                    properties:
                      keyword:
                        type: "string"
                      count:
                        type: "number"
      description: "Schema for the call analysis"
      example:
        statusCode: 0
        message: "Successfully fetched the call analysis"
        data:
          callLogId: "68b1f2c9a4d3e5f601234567"
          status: 0
          score: 78.5
          metadata:
            ticketId: "TKT-4471"
          analysis:
            summary: "The customer asked about pricing for the annual plan and requested a demo."
            transcript:
              - speaker: "agent"
                utterance: "Thank you for calling Runo, how can I help you today?"
              - speaker: "customer"
                utterance: "I wanted to know the pricing for the annual plan."
            sentiment:
              agent: 0.42
              customer: 0.18
            wordsSpoken:
              agent: 412
              customer: 289
            loudness:
              agent: -24.6
              customer: -27.1
              nonSpeech: -48.3
            speakingTime:
              agent: 210
              customer: 140
              nonSpeech:
                holdTime: 12
                noise: 6
                deadAir: 5
            customerSatisfaction: "satisfied"
            complianceChecks:
              Greeting: "Yes"
              Closure: "No"
            entities:
              - keyword: "demo"
                count: 3
            fillerWords:
              - keyword: "actually"
                count: 7
            intentSources:
              - keyword: "pricing"
                count: 2
    userIds:
      type: "object"
      properties:
        statusCode:
          type: "number"
          description: "Will be 0 in case of success"
        message:
          type: "string"
          description:
            "Contains the success message or error reason, based on the\
            \ statusCode"
        data:
          type: "array"
          items:
            type: "object"
            properties:
              userId:
                type: "string"
                description: "Id of the user"
              name:
                type: "string"
                description: "Name of the user"
              phoneNumber:
                type: "string"
                description: "Phone number of the user"
      description: "Schema for user ids"
      example:
        statusCode: 0
        message: "Successfully fetched the user ids"
        data:
          - userId: "731e0bc1-1p4e-4eq1-9lb7-6290276172co"
            name: "Rahul Singh"
            phoneNumber: "+919898989898"
    users:
      type: "object"
      properties:
        statusCode:
          type: "number"
          description: "Will be 0 in case of success"
        message:
          type: "string"
          description:
            "Contains the success message or error reason, based on the\
            \ statusCode"
        data:
          type: "array"
          items:
            type: "object"
            properties:
              userId:
                type: "string"
                description: "Id of the user"
              name:
                type: "string"
                description: "Name of the user"
              phoneNumber:
                type: "string"
                description: "Phone number of the user"
              email:
                type: "string"
                description: "Email of the user"
              designation:
                type: "string"
                description: "Designation of the user"
              process:
                type: "array"
                description: "Array of processes"
                items:
                  type: "string"
                  description: "Name of the process"
      description: "Schema for users"
      example:
        statusCode: 0
        message: "Successfully fetched the users"
        data:
          - userId: "731e0bc1-1p4e-4eq1-9lb7-6290276172co"
            name: "Rahul Singh"
            phoneNumber: "+919898989898"
            email: "rahulsingh@gmail.com"
            designation: "Admin"
            process:
              - "Default process"
              - "process1"
              - "process2"
    suspendUser:
      type: "object"
      description: "Schema for suspend user request body"
      required:
        - "userPhoneNumber"
      properties:
        userPhoneNumber:
          type: "string"
          description: "Phone number of the user to be suspended with country code"
      example:
        userPhoneNumber: "+919898989898"
    suspendUserSuccess:
      type: "object"
      properties:
        message:
          type: "string"
          example: "Successfully suspended user: User Name"
        statusCode:
          type: "number"
          example: 0
      description: "Schema for success response"
    process:
      type: "object"
      properties:
        statusCode:
          type: "number"
          description: "Will be 0 in case of success"
        message:
          type: "string"
          description:
            "Contains the success message or error reason, based on the\
            \ statusCode"
        data:
          type: "array"
          items:
            type: "object"
            properties:
              processId:
                type: "string"
                description: "Id of the process"
              name:
                type: "string"
                description: "Name of the process"
      description: "Schema for processes"
      example:
        statusCode: 0
        message: "Successfully fetched the processes"
        data:
          - name: "Default Inbound & Outbound Process"
            processId: "5e57737b2ed7b30007f22277"
    crmFields:
      type: "object"
      properties:
        statusCode:
          type: "number"
          description: "Will be 0 in case of success"
        message:
          type: "string"
          description:
            "Contains the success message or error reason, based on the\
            \ statusCode"
        data:
          type: "object"
          properties:
            userFields:
              type: "array"
              description: "User defined crm fields"
              items:
                properties:
                  name:
                    type: "string"
                    description: "Name of the crm field"
                  type:
                    type: "string"
                    description: "Type of the crm field"
            fixedFields:
              type: "array"
              description: "Name changes for the fixed fields"
              items:
                properties:
                  name:
                    type: "string"
                    description: "Original name of the field"
                  displayName:
                    type: "string"
                    description: "Modified Display name of the field"
      description: "Schema for crm fields"
      example:
        statusCode: 0
        message: "Successfully fetched the crm fields"
        data:
          userFields:
            - name: "source"
              type: "options"
            - name: "status"
              type: "options"
            - name: "Hot Followup On"
              type: "dateTime"
            - name: "Cold Followup On"
              type: "dateTime"
            - name: "Appointment On"
              type: "dateTime"
            - name: "Non contact reason"
              type: "options"
            - name: "Non Contact Followup On"
              type: "dateTime"
            - name: "Not Picked Followup On"
              type: "dateTime"
            - name: "Not interested reason"
              type: "options"
          fixedFields:
            - name: "customer.company.kdm.name"
              displayName: "Manager Name"
            - name: "customer.company.kdm.phoneNumber"
              displayName: "Manager Phone"
    interactions:
      type: "object"
      properties:
        statusCode:
          type: "number"
          description: "Will be 0 in case of success"
        message:
          type: "string"
          description:
            "Contains the success message or error reason, based on the\
            \ statusCode"
        data:
          type: "object"
          properties:
            metadata:
              type: "array"
              items:
                type: "object"
                properties:
                  total:
                    type: "number"
                    description: "Total number of interactions for the given date"
                  page:
                    type: "number"
                    description: "Current page no"
            data:
              type: "array"
              items:
                type: "object"
                properties:
                  customer:
                    type: "object"
                    properties:
                      id:
                        type: "string"
                        description: "Id of the customer"
                      name:
                        type: "string"
                        description: "Name of the customer"
                      phoneNumber:
                        type: "string"
                        description: "Phone number of the customer with country code"
                      email:
                        type: "string"
                        description: "Email of the customer"
                        nullable: true
                      company:
                        type: "object"
                        properties:
                          name:
                            type: "string"
                            description: "Name of the company"
                            nullable: true
                          address:
                            type: "object"
                            properties:
                              street:
                                type: "string"
                                description: "Street name"
                                nullable: true
                              city:
                                type: "string"
                                description: "City name"
                                nullable: true
                              state:
                                type: "string"
                                description: "State name"
                                nullable: true
                              country:
                                type: "string"
                                description: "Country name"
                                nullable: true
                              pincode:
                                type: "number"
                                description: "Pincode"
                                nullable: true
                            description: "Address of the company"
                          kdm:
                            type: "object"
                            properties:
                              name:
                                type: "string"
                                description: "Kdm name"
                                nullable: true
                              phoneNumber:
                                type: "string"
                                description: "Phone number of the kdm"
                                nullable: true
                            description: "Key decision maker details of the company"
                        description: "Company details of the customer"
                    description: "Customer details"
                  priority:
                    type: "number"
                    description:
                      "Priority of the customer. 3 -> HIGH, 2 -> MEDIUM, 1\
                      \ -> LOW, -1 -> NOT MENTIONED"
                    enum:
                      - 3
                      - 2
                      - 1
                      - -1
                  userFields:
                    type: "array"
                    description: "User defined crm fields for the customer"
                    items:
                      properties:
                        name:
                          type: "string"
                          description: "Name of the crm field"
                        value:
                          description:
                            "Value entered by the agent. For date field, it\
                            \ will be sent as epoch (in seconds since 1970)"
                          oneOf:
                            - type: "string"
                            - type: "number"
                  notes:
                    type: "string"
                    description: "Remarks given by the user"
                  assigned:
                    type: "object"
                    properties:
                      from:
                        type: "string"
                        description: "Interaction is created by"
                      to:
                        type: "string"
                        description:
                          "Interaction is assigned to. Will be same as from,\
                          \ in case it's not assigned to anyone"
                  createdAt:
                    type: "number"
                    description: "Interaction created at epoch (in seconds since 1970)"
      description: "Schema for crm interactions"
      example:
        statusCode: 0
        message: "Successfully fetched the interactions list"
        data:
          metadata:
            - total: 1
              page: 1
          data:
            - customer:
                id: "5f5a5a5a5a5a5a5a5a5a5a5a"
                name: "Rohit Agarwal"
                phoneNumber: "+919898989898"
                email: "rohit.agarwal@gmail.com"
                company:
                  name: "Agarwal Foods Limited"
                  address:
                    street: "84-2, Main road"
                    city: "RAIPUR"
                    state: "Chattisgarh"
                    country: "India"
                    pincode: 578100
                  kdm:
                    name: "Varun Agarwal"
                    phoneNumber: "+919696969696"
              priority: 3
              notes:
                "Customer is interested and asked to drop details on mail. Scheduling\
                \ a followup with Priyank to take the discussion forward"
              assigned:
                from: "Rahul Singh"
                to: "Priyank Gupta"
              createdAt: 1600486640
              userFields:
                - name: "source"
                  value: "Website enquiry"
                - name: "followup On"
                  value: 1600862400
                - name: "status"
                  value: "Hot Followup"
    interaction:
      type: "object"
      description: "Schema for add interaction Body"
      example:
        customer:
          name: "Rohit Agarwal"
          phoneNumber: "+919898989898"
          email: "rohit.agarwal@gmail.com"
          company:
            name: "Agarwal Foods Limited"
            address:
              street: "84-2, Main road"
              city: "RAIPUR"
              state: "Chattisgarh"
              country: "India"
              pincode: 578100
            kdm:
              name: "Varun Agarwal"
              phoneNumber: "+919696969696"
        priority: 3
        notes:
          "Customer is interested and asked to drop details on mail. Scheduling\
          \ a followup with Priyank to take the discussion forward"
        processName: "Default Process"
        assignedTo: "+919876543210"
        userFields:
          - name: "source"
            value: "Referral"
          - name: "status"
            value: "Cold Followup"
          - name: "Followup On"
            value: 1603171442
      required:
        - "customer"
      properties:
        customer:
          required:
            - "name"
            - "phoneNumber"
          type: "object"
          properties:
            name:
              type: "string"
              description: "Name of the customer"
            phoneNumber:
              type: "string"
              description: "Phone number of the customer with country code"
            email:
              type: "string"
              description: "Email of the customer"
              nullable: true
            company:
              type: "object"
              properties:
                name:
                  type: "string"
                  description: "Name of the company"
                  nullable: true
                address:
                  type: "object"
                  properties:
                    street:
                      type: "string"
                      description: "Street name"
                      nullable: true
                    city:
                      type: "string"
                      description: "City name"
                      nullable: true
                    state:
                      type: "string"
                      description: "State name"
                      nullable: true
                    country:
                      type: "string"
                      description: "Country name"
                      nullable: true
                    pincode:
                      type: "number"
                      description: "Pincode"
                      nullable: true
                  description: "Address of the company"
                  nullable: true
                kdm:
                  type: "object"
                  properties:
                    name:
                      type: "string"
                      description: "Kdm name"
                      nullable: true
                    phoneNumber:
                      type: "string"
                      description: "Phone number of the kdm"
                      nullable: true
                  description: "Key decision maker details of the company"
                  nullable: true
              description: "Company details of the customer"
              nullable: true
          description: "Customer details"
        priority:
          type: "number"
          description:
            "Priority of the customer. 3 -> HIGH, 2 -> MEDIUM, 1 -> LOW,\
            \ -1 -> NOT MENTIONED"
          nullable: true
          enum:
            - 3
            - 2
            - 1
            - -1
        notes:
          type: "string"
          description: "Remarks given by the user"
          nullable: true
        processName:
          type: "string"
          description: "Process name in which this customer should be assigned"
          nullable: true
        userFields:
          type: "array"
          description: "User defined crm fields for the customer"
          nullable: true
          items:
            required:
              - "name"
              - "value"
            properties:
              name:
                type: "string"
                description: "Name of the crm field. Should be same as the one\
                  \ defined in the excel template/crm fields in the admin panel"
              value:
                description: "Value of the crm field. For date field, provide\
                  \ epoch value in seconds"
                oneOf:
                  - type: "string"
                  - type: "number"
        assignedTo:
          type: "string"
          description:
            "Phone number of the user to which this interaction should\
            \ be assigned. Phone number should have country code in it. If omitted the interaction gets assigned to the user whose api-key is used."
    allocations:
      type: "object"
      properties:
        statusCode:
          type: "number"
          description: "Will be 0 in case of success"
        message:
          type: "string"
          description:
            "Contains the success message or error reason, based on the\
            \ statusCode"
        data:
          type: "object"
          properties:
            metadata:
              type: "array"
              items:
                type: "object"
                properties:
                  total:
                    type: "number"
                    description: "Total number of allocations for the given date"
                  page:
                    type: "number"
                    description: "Current page no"
            data:
              type: "array"
              items:
                type: "object"
                properties:
                  _id:
                    type: "string"
                    description: "Unique identifier of the allocation"
                    example: "69c0e3a53656ea94b1e76dc1"
                  customer:
                    type: "object"
                    properties:
                      id:
                        type: "string"
                        description: "Id of the customer"
                      name:
                        type: "string"
                        description: "Name of the customer"
                      phoneNumber:
                        type: "string"
                        description: "Phone number of the customer with country code"
                      email:
                        type: "string"
                        description: "Email of the customer"
                        nullable: true
                      company:
                        type: "object"
                        properties:
                          name:
                            type: "string"
                            description: "Name of the company"
                            nullable: true
                          address:
                            type: "object"
                            properties:
                              street:
                                type: "string"
                                description: "Street name"
                                nullable: true
                              city:
                                type: "string"
                                description: "City name"
                                nullable: true
                              state:
                                type: "string"
                                description: "State name"
                                nullable: true
                              country:
                                type: "string"
                                description: "Country name"
                                nullable: true
                              pincode:
                                type: "number"
                                description: "Pincode"
                                nullable: true
                            description: "Address of the company"
                          kdm:
                            type: "object"
                            properties:
                              name:
                                type: "string"
                                description: "Kdm name"
                                nullable: true
                              phoneNumber:
                                type: "string"
                                description: "Phone number of the kdm"
                                nullable: true
                            description: "Key decision maker details of the company"
                        description: "Company details of the customer"
                    description: "Customer details"
                  priority:
                    type: "number"
                    description:
                      "Priority of the customer. 3 -> HIGH, 2 -> MEDIUM, 1\
                      \ -> LOW, -1 -> NOT MENTIONED"
                    enum:
                      - 3
                      - 2
                      - 1
                      - -1
                  source:
                    type: "string"
                    description: "Source of the allocation"
                    nullable: true
                    example: "Website enquiry"
                  userFields:
                    type: "array"
                    description: "User defined crm fields for the customer"
                    nullable: true
                    items:
                      properties:
                        name:
                          type: "string"
                          description: "Name of the crm field"
                        value:
                          description:
                            "Value entered by the agent. For date field, it\
                            \ will be sent as epoch (in seconds since 1970)"
                          oneOf:
                            - type: "string"
                            - type: "number"
                  notes:
                    type: "string"
                    description: "Remarks given by the user"
                    nullable: true
                  assigned:
                    type: "object"
                    properties:
                      from:
                        type: "string"
                        description: "Allocation is created by"
                      to:
                        type: "string"
                        description:
                          "Allocation is assigned to. Will be same as from,\
                          \ in case it's not assigned to anyone"
                  createdAt:
                    type: "number"
                    description: "Allocation created at epoch (in seconds since 1970)"
                  processName:
                    type: "string"
                    description: "Name of the process this allocation belongs to"
                    example: "Default Process"
      description: "Schema for allocations"
      example:
        statusCode: 0
        message: "Successfully fetched the allocations list"
        data:
          metadata:
            - total: 1
              page: 1
          data:
            - _id: "507f1f77bcf86cd799439011"
              customer:
                id: "5f5a5a5a5a5a5a5a5a5a5a5a"
                name: "Rohit Agarwal"
                phoneNumber: "+919898989898"
                email: "rohit.agarwal@gmail.com"
                company:
                  name: "Agarwal Foods Limited"
                  address:
                    street: "84-2, Main road"
                    city: "RAIPUR"
                    state: "Chattisgarh"
                    country: "India"
                    pincode: 578100
                  kdm:
                    name: "Varun Agarwal"
                    phoneNumber: "+919696969696"
              priority: 3
              notes: "Customer is interested and asked to drop details on mail"
              source: "Website enquiry"
              assigned:
                from: "Rahul Singh"
                to: "Priyank Gupta"
              userFields:
                - name: "source"
                  value: "Website enquiry"
                - name: "followup On"
                  value: 1600862400
              createdAt: 1600486640
              processName: "Default Process"
    customer/list:
      type: "object"
      properties:
        statusCode:
          type: "number"
          description: "Will be 0 in case of success"
        message:
          type: "string"
          description:
            "Contains the success message or error reason, based on the\
            \ statusCode"
        data:
          type: "object"
          properties:
            metadata:
              type: "array"
              items:
                type: "object"
                properties:
                  total:
                    type: "number"
                    description: "Total number of customers for the given date"
                  page:
                    type: "number"
                    description: "Current page no"
            data:
              type: "array"
              items:
                type: "object"
                properties:
                  _id:
                    type: "string"
                    description: "Unique identifier of the customer (from cusId)"
                  name:
                    type: "string"
                    description: "Name of the customer"
                  phoneNumber:
                    type: "string"
                    description: "Phone number of the customer with country code (from pNum)"
                  email:
                    type: "string"
                    description: "Email of the customer"
                    nullable: true
                  company:
                    type: "object"
                    description: "Company details of the customer (from cmp)"
                    nullable: true
                  priority:
                    type: "number"
                    description: "Priority of the customer (from prt). 3 -> HIGH, 2 -> MEDIUM, 1 -> LOW, -1 -> NOT MENTIONED"
                    enum:
                      - 3
                      - 2
                      - 1
                      - -1
                  processName:
                    type: "string"
                    description: "Name of the process"
                  assigned:
                    type: "object"
                    properties:
                      from:
                        type: "string"
                        description: "Customer is created by (from asgn.fromName)"
                      to:
                        type: "string"
                        description: "Customer is assigned to (from asgn.toName)"
                  userFields:
                    type: "array"
                    description: "User defined crm fields for the customer"
                    items:
                      properties:
                        name:
                          type: "string"
                          description: "Name of the crm field"
                        value:
                          description: "Value entered by the agent. For date field, it will be sent as epoch (in seconds since 1970)"
                          oneOf:
                            - type: "string"
                            - type: "number"
                  createdBy:
                    type: "string"
                    description: "Customer created by user (from creator.name)"
                  createdAt:
                    type: "number"
                    description: "Customer created at epoch (in seconds since 1970) (from cAt)"
                description: "Customer details"
              description: "Array of customer objects"
      description: "Schema for customer list"
      example:
        statusCode: 0
        message: "Successfully fetched the customers list"
        data:
          metadata:
            - total: 2
              page: 1
          data:
            - _id: "507f1f77bcf86cd799439011"
              name: "Rohit Agarwal"
              phoneNumber: "+919898989898"
              email: "rohit.agarwal@gmail.com"
              company:
                name: "Agarwal Foods Limited"
                address:
                  street: "84-2, Main road"
                  city: "RAIPUR"
                  state: "Chattisgarh"
                  country: "India"
                  pincode: "578100"
                kdm:
                  name: "Varun Agarwal"
                  phoneNumber: "+919696969696"
              priority: 3
              processName: "Default Process"
              assigned:
                from: "Rahul Singh"
                to: "Priyank Gupta"
              userFields:
                - name: "source"
                  value: "Website enquiry"
                - name: "followup On"
                  value: 1600862400
              createdBy: "Rahul Singh"
              createdAt: 1600486640
            - _id: "507f1f77bcf86cd799439012"
              name: "Priya Sharma"
              phoneNumber: "+919797979797"
              email: "priya.sharma@gmail.com"
              company:
                name: "Sharma Enterprises"
                address:
                  street: "123, Business Street"
                  city: "Mumbai"
                  state: "Maharashtra"
                  country: "India"
                  pincode: 400001                  
                  pobox: null
                kdm:
                  name: "Rajesh Sharma"
                  phoneNumber: "+919595959595"
              priority: 2
              processName: "Sales Process"
              assigned:
                from: "Ankit Verma"
                to: "Sneha Patel"
              userFields:
                - name: "source"
                  value: "Referral"
                - name: "followup On"
                  value: 1600948800
              createdBy: "Ankit Verma"
              createdAt: 1600573040
    whatsapp:
      type: "object"
      properties:
        statusCode:
          type: "number"
          description: "Will be 0 in case of success"
        message:
          type: "string"
          description:
            "Contains the success message or error reason, based on the\
            \ statusCode"
        data:
          type: "object"
          properties:
            metadata:
              type: "array"
              items:
                type: "object"
                properties:
                  total:
                    type: "number"
                    description: "Total number of interactions for the given date"
                  page:
                    type: "number"
                    description: "Current page no"
            data:
              type: "array"
              items:
                type: "object"
                properties:
                  customer:
                    type: "object"
                    properties:
                      name:
                        type: "string"
                        description: "Name of the customer"
                      phoneNumber:
                        type: "string"
                        description: "Phone number of the customer with country code"
                    description: "Customer details"
                  message:
                    type: "string"
                    description: "WhatsApp message that is sent"
                  label:
                    type: "string"
                    description: "Label of the sent WhatsApp template"
                  status:
                    type: "string"
                    description: "Status of this WhatsApp message."
                  user:
                    type: "object"
                    properties:
                      name:
                        type: "string"
                        description: "name of the User"
                      id:
                        type: "string"
                        description: "Id of the user"
                  createdAt:
                    type: "number"
                    description: "Interaction created at epoch (in seconds since 1970)"
      description: "Schema for crm whatsapp interactions"
      example:
        statusCode: 0
        message: "Successfully fetched the whatsapp interactions list"
        data:
          metadata:
            - total: 1
              page: 1
          data:
            - customer:
                name: "Rohit Agarwal"
                phoneNumber: "+919898989898"
              message: "Hello, How are you."
              label: "greeting"
              status: "initiated"
              user:
                name: "Rahul Singh"
                id: "61a4XXXXXXXX"
              createdAt: 1600486640
    callLogs:
      type: "object"
      properties:
        statusCode:
          type: "number"
          description: "Will be 0 in case of success"
        message:
          type: "string"
          description:
            "Contains the success message or error reason, based on the\
            \ statusCode"
        data:
          type: "object"
          properties:
            metadata:
              type: "array"
              items:
                type: "object"
                properties:
                  total:
                    type: "number"
                    description: "Total number of call logs for the given date"
                  page:
                    type: "number"
                    description: "Current page no"
            data:
              type: "array"
              items:
                type: "object"
                properties:
                  callId:
                    type: "string"
                    description: "id of the call"
                  callerId:
                    type: "string"
                    description: "User id of the caller"
                  calledBy:
                    type: "string"
                    description: "Name of the caller"
                  name:
                    type: "string"
                    description: "Name of the customer"
                    default: "Unknown"
                  customerId:
                    type: "string"
                    description: "Id of the customer"
                    nullable: true
                  phoneNumber:
                    type: "string"
                    description: "Phone number of the customer with country code"
                  startTime:
                    type: "number"
                    description: "Start epoch of the call (in seconds since 1970)"
                  duration:
                    type: "number"
                    description: "Duration of the call in seconds"
                  type:
                    type: "string"
                    description: "Type of the call. For outgoing unanswered calls, type will be outgoing and tag will be unanswered"
                    enum:
                      - incoming
                      - outgoing
                      - missed
                  status:
                    type: "string"
                    description: "Disposition selected by the caller"
                    nullable: true
                  tag:
                    type: "string"
                    description: "Tag of the call. Personal -> If the call is marked as personal. Unanswered -> If the outgoing call is not answered"
                    nullable: true
                    enum:
                      - personal
                      - unanswered
                  createdAt:
                    type: "number"
                    description: "Interaction created at epoch (in seconds since 1970)"
      description: "Schema for crm interactions"
      example:
        statusCode: 0
        message: "Successfully fetched the call logs"
        data:
          metadata:
            - total: 2
              page: 1
          data:
            - callId: "5e256e1cc9785f000845fe2c"
              callerId: "731e0bc1-1p4e-4eq1-9lb7-6290276172co"
              calledBy: "Rahul Singh"
              name: "Rohit Agarwal"
              customerId: "5e256e1cc9785f000845fe2c"
              phoneNumber: "+919898989898"
              startTime: 1600486640
              duration: 132
              type: "outgoing"
              status: "Appointment Fixed"
              tag: null
              createdAt: 1600486640
            - callerId: "731e0bc1-1p4e-4eq1-9lb7-6290276172co"
              calledBy: "Rahul Singh"
              name: "Rohit Agarwal"
              customerId: "5e256e1cc9785f000845fe2c"
              phoneNumber: "+919898989898"
              startTime: 1600286640
              duration: 0
              type: "outgoing"
              status: "Not Contacted"
              tag: "unanswered"
              createdAt: 1600286640
    loginlogs:
      type: "object"
      properties:
        statusCode:
          type: "number"
          description: "Will be 0 in case of success"
        message:
          type: "string"
          description:
            "Contains the success message or error reason, based on the\
            \ statusCode"
        data:
          type: "object"
          properties:
            metadata:
              type: "array"
              items:
                type: "object"
                properties:
                  total:
                    type: "number"
                    description: "Total number of login logs for the given date"
                  page:
                    type: "number"
                    description: "Current page no"
            data:
              type: "array"
              items:
                type: "object"
                properties:
                  agentName:
                    type: "string"
                    description: "Name of the user"
                    default: "Unknown"
                  event:
                    type: "string"
                    description: "event performed by the user"
                    enum:
                      - login
                      - logout
                  eventTime:
                    type: "number"
                    description: "time of the event performed in epoch (in seconds since 1970)"
                  modelName:
                    type: "string"
                    description: "model name of the device used to perform the event"
                    nullable: true
                  osVersion:
                    type: "string"
                    description: "version of the Os used in the device used to perform the event"
                    nullable: true
      description: "Schema for users login logs"
      example:
        statusCode: 0
        message: "Successfully fetched the users login logs"
        data:
          metadata:
            - total: 2
              page: 1
          data:
            - agentName: "Rohit Agarwal"
              event: "login"
              eventTime: 1660193241
              modelName: "RMX1992"
              osVersion: "11"
            - agentName: "Rohit Agarwal"
              event: "logout"
              eventTime: 1660193452
              modelName: "RMX1992"
              osVersion: "11"          
    allocation:
      type: "object"
      description: "Schema for add allocation Body"
      example:
        customer:
          name: "Rohit Agarwal"
          phoneNumber: "+919898989898"
          email: "rohit.agarwal@gmail.com"
          company:
            name: "Agarwal Foods Limited"
            address:
              street: "84-2, Main road"
              city: "RAIPUR"
              state: "Chattisgarh"
              country: "India"
              pincode: 578100
            kdm:
              name: "Varun Agarwal"
              phoneNumber: "+919696969696"
        priority: 3
        notes:
          "Customer is interested and asked to drop details on mail. Scheduling\
          \ a followup with Priyank to take the discussion forward"
        processName: "Default Process"
        assignedTo: "+919876543210"
        ruleName: "Default"
        userFields:
          - name: "source"
            value: "Referral"
          - name: "status"
            value: "Cold Followup"
          - name: "Followup On"
            value: 1603171442
      required:
        - "assignedTo"
        - "customer"
      properties:
        customer:
          required:
            - "name"
            - "phoneNumber"
          type: "object"
          properties:
            name:
              type: "string"
              description: "Name of the customer"
            phoneNumber:
              type: "string"
              description: "Phone number of the customer with country code"
            email:
              type: "string"
              description: "Email of the customer"
              nullable: true
            company:
              type: "object"
              properties:
                name:
                  type: "string"
                  description: "Name of the company"
                  nullable: true
                address:
                  type: "object"
                  properties:
                    street:
                      type: "string"
                      description: "Street name"
                      nullable: true
                    city:
                      type: "string"
                      description: "City name"
                      nullable: true
                    state:
                      type: "string"
                      description: "State name"
                      nullable: true
                    country:
                      type: "string"
                      description: "Country name"
                      nullable: true
                    pincode:
                      type: "number"
                      description: "Pincode"
                      nullable: true
                  description: "Address of the company"
                  nullable: true
                kdm:
                  type: "object"
                  properties:
                    name:
                      type: "string"
                      description: "Kdm name"
                      nullable: true
                    phoneNumber:
                      type: "string"
                      description: "Phone number of the kdm"
                      nullable: true
                  description: "Key decision maker details of the company"
                  nullable: true
              description: "Company details of the customer"
              nullable: true
          description: "Customer details"
        priority:
          type: "number"
          description:
            "Priority of the customer. 3 -> HIGH, 2 -> MEDIUM, 1 -> LOW,\
            \ -1 -> NOT MENTIONED"
          nullable: true
          enum:
            - 3
            - 2
            - 1
            - -1
        notes:
          type: "string"
          description: "Remarks given by the user"
          nullable: true
        processName:
          type: "string"
          description: "Process name in which this lead should be assigned"
          nullable: true
        ruleName:
          type: "string"
          description: "Allocation rule name based on which this lead is being assigned"
          nullable: true
        userFields:
          type: "array"
          description: "User defined crm fields for the customer"
          nullable: true
          items:
            required:
              - "name"
              - "value"
            properties:
              name:
                type: "string"
                description: "Name of the crm field. Should be same as the one\
                  \ defined in the excel template/crm fields in the admin panel"
              value:
                description: "Value of the crm field. For date field, provide\
                  \ epoch value in seconds"
                oneOf:
                  - type: "string"
                  - type: "number"
        assignedTo:
          type: "string"
          description:
            "Phone number of the user to which this allocation should\
            \ be assigned. Phone number should have country code in it"
    bulkAllocation:
      type: "object"
      description: "Schema for bulk add allocations request body"
      required:
        - "processName"
        - "allocations"
      properties:
        processName:
          type: "string"
          description: "Process name in which these allocations should be created"
          example: "Default Process"
        isCommonPool:
          type: "boolean"
          description: "When isCommonPool is true, all the allocations will be uploaded into common pool"
          nullable: true
          example: false
        ruleName:
          type: "string"
          description: "Allocation rule name, based on which these allocations are being assigned"
          nullable: true
          example: "City Based Rule"
        assignedTo:
          type: "string"
          description: "Phone number of the user to which these allocations should be assigned. Phone number should have country code in it"
          nullable: true
          example: "+919876543210"
        existingDataUpdateMethod:
          type: "string"
          description: "Method to handle existing data updates. Either 'update' or 'override'"
          nullable: true
          enum:
            - "update"
            - "override"
          default: "override"
          example: "override"
        allocations:
          type: "array"
          description: "Array of allocations to be created. Minimum 1 and maximum 10 allocations per request"
          minItems: 1
          maxItems: 10
          items:
            type: "object"
            required:
              - "customer"
            properties:
              customer:
                type: "object"
                required:
                  - "name"
                  - "phoneNumber"
                properties:
                  name:
                    type: "string"
                    description: "Name of the customer"
                    example: "Rohit Agarwal"
                  phoneNumber:
                    type: "string"
                    description: "Phone number of the customer with country code"
                    example: "+919898989898"
                  email:
                    type: "string"
                    description: "Email of the customer"
                    nullable: true
                    example: "rohit.agarwal@gmail.com"
                  company:
                    type: "object"
                    properties:
                      name:
                        type: "string"
                        description: "Name of the company"
                        nullable: true
                        example: "Agarwal Foods Limited"
                      address:
                        type: "object"
                        properties:
                          street:
                            type: "string"
                            description: "Street name"
                            nullable: true
                            example: "84-2, Main road"
                          city:
                            type: "string"
                            description: "City name"
                            nullable: true
                            example: "RAIPUR"
                          state:
                            type: "string"
                            description: "State name"
                            nullable: true
                            example: "Chattisgarh"
                          country:
                            type: "string"
                            description: "Country name"
                            nullable: true
                            example: "India"
                          pincode:
                            type: "number"
                            description: "Pincode"
                            nullable: true
                            example: 578100
                        description: "Address of the company"
                        nullable: true
                      kdm:
                        type: "object"
                        properties:
                          name:
                            type: "string"
                            description: "Kdm name"
                            nullable: true
                            example: "Varun Agarwal"
                          phoneNumber:
                            type: "string"
                            description: "Phone number of the kdm"
                            nullable: true
                            example: "+919696969696"
                        description: "Key decision maker details of the company"
                        nullable: true
                    description: "Company details of the customer"
                    nullable: true
                description: "Customer details"
              priority:
                type: "number"
                description: "Priority of the customer. 3 -> HIGH, 2 -> MEDIUM, 1 -> LOW, -1 -> NOT MENTIONED"
                nullable: true
                enum:
                  - 3
                  - 2
                  - 1
                  - -1
                example: 3
              notes:
                type: "string"
                description: "Remarks given by the user"
                nullable: true
                example: "Customer is interested and asked to drop details on mail"
              userFields:
                type: "array"
                description: "User defined crm fields for the customer"
                nullable: true
                items:
                  type: "object"
                  required:
                    - "name"
                    - "value"
                  properties:
                    name:
                      type: "string"
                      description: "Name of the crm field. Should be same as the one defined in the excel template/crm fields in the admin panel"
                      example: "source"
                    value:
                      description: "Value of the crm field. For date field, provide epoch value in seconds"
                      oneOf:
                        - type: "string"
                        - type: "number"
                      example: "Referral"
              whatsAppConsent:
                type: "boolean"
                description: "WhatsApp consent for this specific allocation"
                nullable: true
                default: false
                example: false
      example:
        processName: "Default Process"
        isCommonPool: false
        ruleName: "City Based Rule"
        existingDataUpdateMethod: "update"
        allocations:
          - customer:
              name: "Rohit Agarwal"
              phoneNumber: "+919898989898"
              email: "rohit.agarwal@gmail.com"
              company:
                name: "Agarwal Foods Limited"
                address:
                  street: "84-2, Main road"
                  city: "RAIPUR"
                  state: "Chattisgarh"
                  country: "India"
                  pincode: 578100
                kdm:
                  name: "Varun Agarwal"
                  phoneNumber: "+919696969696"
            priority: 3
            notes: "Customer is interested and asked to drop details on mail"
            whatsAppConsent: false
            userFields:
              - name: "source"
                value: "Referral"
              - name: "status"
                value: "Cold Followup"
    deleteAllocationsByUser:
      type: "object"
      description: "Schema for delete allocation Body"
      example:
        phoneNumbers: ["+919866XXXXXX", "+919856XXXXXX"]
        processName: "Default Proccess"
      required:
        - "phoneNumbers"
      properties:
        phoneNumbers:
          type: "array"
          description: "Phone numbers of the users with country code"
        processName:
          type: "string"
          description: "Process from which the allocations should be removed. If this is not provided, allocations are removed across the processes for the given phoneNumbers."
          nullable: true
    deleteAllocationsByCustomer:
      type: "object"
      description: "Schema for delete allocation Body"
      example:
        phoneNumbers: ["+919866XXXXXX", "+919856XXXXXX"]
        processName: "Default Proccess"
      required:
        - "phoneNumbers"
      properties:
        phoneNumbers:
          type: "array"
          description: "Phone numbers of the customers with country code"
        processName:
          type: "string"
          description: "Process from which the allocations should be removed. If this is not provided, allocations are removed across the processes for the given phoneNumbers."
          nullable: true
    deleteAllocationSuccess:
      type: "object"
      properties:
        message:
          type: "string"
          example: "Successfully deleted XX allocations"
        statusCode:
          type: "number"
          example: 0
      description: "Schema for success response"
    deleteAllocationUserNotFound:
      type: "object"
      properties:
        message:
          type: "string"
          example: "Unable to find users with the given phone numbers."
        statusCode:
          type: "number"
          example: 3
      description: "Schema for success response"
    bulkAddAllocationsSuccess:
      type: "object"
      properties:
        message:
          type: "string"
          example: "Successfully added 3 allocations"
        statusCode:
          type: "number"
          example: 0
        data:
          type: "object"
          properties:
            count:
              type: "object"
              properties:
                success:
                  type: "number"
                  description: "Number of allocations that were successfully created"
                  example: 3
                failure:
                  type: "number"
                  description: "Number of allocations that failed to be created"
                  example: 1
            success:
              type: "array"
              description: "List of successfully created allocation rows"
              items:
                type: "object"
                properties:
                  name:
                    type: "string"
                    example: "Rohit Agarwal"
                  phone:
                    type: "string"
                    example: "+919898989898"
                  assignedTo:
                    type: "string"
                    nullable: true
                    description: "User to which the allocation was assigned"
                    example: "+919876543210"
            failed:
              type: "array"
              description: "List of failed allocation rows"
              items:
                type: "object"
                properties:
                  name:
                    type: "string"
                    example: "John Doe"
                  phone:
                    type: "string"
                    example: "+919876543210"
                  reason:
                    type: "string"
                    nullable: true
                    description: "Reason for failure"
                    example: "Invalid phone number"
      description: "Schema for bulk add allocations success response"
      example:
        message: "Successfully added 2 allocations"
        statusCode: 0
        data:
          count:
            success: 2
            failure: 1
          success:
            - name: "Rohit Agarwal"
              phone: "+919898989898"
              assignedTo: "+919876543210"
            - name: "Priya Sharma"
              phone: "+919797979797"
              assignedTo: "+919876543210"
          failed:
            - name: "John Doe"
              phone: "+919876543210"
              reason: "Invalid phone number"
    addAllocationSuccess:
      type: "object"
      properties:
        message:
          type: "string"
          example: "Successfully added the allocation"
        statusCode:
          type: "number"
          example: 0
      description: "Schema for success response"
    addInteractionSuccess:
      type: "object"
      properties:
        message:
          type: "string"
          example: "Successfully added the interaction"
        statusCode:
          type: "number"
          example: 0
      description: "Schema for success response"    
    deleteCustomerSuccess:
      type: "object"
      properties:
        message:
          type: "string"
          example: "Successfully deleted the customer"
        statusCode:
          type: "number"
          example: 0
      description: "Schema for success response"
    "403":
      type: "object"
      properties:
        message:
          type: "string"
        statusCode:
          type: "number"
      description: "Schema for UnAuthorized access"
  securitySchemes:
    "Auth-Key":
      type: "apiKey"
      description:
        "Generate API Key from Runo Admin Web Application and pass it in the headers\
        \ with `Auth-Key` as the key and your api key as the value <br> `Auth-Key: xxxxxxxxxxxxxxxx`"
      name: "Auth-Key"
      in: "header"
