openapi: 3.0.0
info:
  title: Agents
  description: This API provides endpoints for IDP agents.
  version: 1.0.0
servers:
  - url: 'https://id360.manageengine.com/api/v1'
    description: 'API Endpoint'
tags:
  - name: idp-agent
    description: IDP Agents Endpoints
paths:
  # IDP Agents Endpoints
  /protection/agents-info:
    get:
      tags:
        - idp-agent
      summary: Get IDP Agents Information
      description: Retrieves information about IDP agents.
      parameters:
        - $ref: '#/components/parameters/acceptHeader'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    $ref: '#/components/schemas/agentInfos'
        '401':
          description: Unauthorized.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/unauthorized'
        '500':
          description: Internal server error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/serverError'
      security:
        - Zoho_Auth:
            - id360.conditional_access_policy.read
            - id360.conditional_access_policy.all

  /protection/agents-info/{type}/regenerate-install-key:
    post:
      tags:
        - idp-agent
      summary: Regenerate Installation Key for IDP Agent
      description: Regenerates the installation key for a specific IDP agent type.
      parameters:
        - $ref: '#/components/parameters/acceptHeader'
        - $ref: '#/components/parameters/agentType'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: object
                    properties:
                      installation_key:
                        type: string
                        description: New installation key for the agent.
                        example: 'abcdef1234567890'
        '401':
          description: Unauthorized.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/unauthorized'
        '500':
          description: Internal server error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/serverError'
      security:
        - Zoho_Auth:
            - id360.conditional_access_policy.write
            - id360.conditional_access_policy.all

  /protection/agents-info/{type}/download:
    get:
      tags:
        - idp-agent
      summary: Download IDP Agent for a Specific Type
      description: Downloads the IDP agent for a specific type.
      parameters:
        - $ref: '#/components/parameters/acceptHeader'
        - $ref: '#/components/parameters/agentType'
      responses:
        '200':
          description: Successful MSI download
          content:
            application/x-msi:
              schema:
                type: string
                format: binary
                example: IDProtectionAgent.msi file
          headers:
            Content-Disposition:
              description: Content-Disposition header for the download.
              example: 'attachment; filename="IDProtectionAgent.msi"'
              schema:
                type: string
        '401':
          description: Unauthorized.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/unauthorized'
        '500':
          description: Internal server error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/serverError'
      security:
        - Zoho_Auth:
            - id360.conditional_access_policy.read
            - id360.conditional_access_policy.all

  /protection/agents-info/{type}/download/{platform}:
    get:
      tags:
        - idp-agent
      summary: Download IDP Device Agent for a Specific Platform
      description: Downloads the IDP Device Agent for a specific platform.
      parameters:
        - $ref: '#/components/parameters/acceptHeader'
        - $ref: '#/components/parameters/agentType'
        - $ref: '#/components/parameters/platform'
      responses:
        '200':
          description: Successful MSI download
          content:
            application/x-msi:
              schema:
                type: string
                format: binary
                example: IDProtectionAgent.msi file
          headers:
            Content-Disposition:
              description: Content-Disposition header for the download.
              example: 'attachment; filename="IDProtectionAgent.msi"'
              schema:
                type: string
        '401':
          description: Unauthorized.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/unauthorized'
        '500':
          description: Internal server error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/serverError'
      security:
        - Zoho_Auth:
            - id360.conditional_access_policy.read
            - id360.conditional_access_policy.all

components:
  parameters:
    acceptHeader:
      name: Accept
      in: header
      schema:
        type: string
      description: 'Accept header for the API'
      required: false
      example: 'application/json'
    agentType:
      name: type
      in: path
      required: true
      description: Type of the IDP agent (e.g., DeviceAgent).
      schema:
        type: string
      example: 'DeviceAgent'
    platform:
      name: platform
      in: path
      required: true
      description: Platform for which the IDP agent is to be downloaded (e.g., windows, macos, linux).
      schema:
        type: string
      example: 'windows'
  schemas:
    gendoc-attributes-schema:
      $ref: '#/components/schemas/agentInfoResource'

    # IDP Agents Schemas
    agentInfos:
      type: array
      items:
        $ref: '#/components/schemas/agentInfoResource'
      example:
        - type: 'DeviceAgent'
          display_name: 'IDProtection Agent'
          endpoint_name: 'ComputerDevices'
          installation_key: '1234567890abcdef'
          platforms:
            - name: 'windows'
              download_url: 'https://idprotection.manageengine.com/static_downloads/idsecurityagent/2.0.0/IDProtectionAgent.msi'
              version: '2.0.0'
              installation_details:
                status: 'installed'
                installed_count: 100
                total_devices_count: 1000
            - name: 'macos'
              download_url: 'https://idprotection.manageengine.com/static_downloads/idsecurityagent/2.0.0/IDProtectionAgent.dmg'
              version: '2.0.0'
              installation_key: '1234567890abcdef'
              installation_details:
                status: 'installed'
                installed_count: 100
                total_devices_count: 1000
            - name: 'linux'
              download_url: 'https://idprotection.manageengine.com/static_downloads/idsecurityagent/2.0.0/IDProtectionAgent.tar.gz'
              version: '2.0.0'
              installation_key: '1234567890abcdef'
              installation_details:
                status: 'installed'
                installed_count: 500
                total_devices_count: 1000
        - type: 'NPSExtension'
          display_name: 'IDProtection NPS Extension'
          endpoint_name: 'NPS'
          download_url: 'https://idprotection.manageengine.com/static_downloads/nps/2.0.0/IDProtectionNPSExtension.zip'
          version: '2.0.0'
          installation_key: '1234567890abcdef'
          installation_details:
            status: 'installed'
        - type: 'IISModule'
          display_name: 'IDProtection OWA Connector'
          endpoint_name: 'IIS'
          download_url: 'https://idprotection.manageengine.com/static_downloads/iis/2.0.0/IDProtectionIISModule.zip'
          version: '2.0.0'
          installation_key: '1234567890abcdef'
          installation_details:
            status: 'installed'
    agentInfoResource:
      type: object
      properties:
        type:
          type: string
          description: Type of the agent.
          example: 'DeviceAgent'
        display_name:
          type: string
          description: Display name of the agent.
          example: 'IDProtection Agent'
        endpoint_name:
          type: string
          description: Name of the endpoint for the agent.
          example: 'ComputerDevices'
        platforms:
          type: array
          items:
            type: object
            properties:
              name:
                type: string
                description: Name of the platform.
                example: 'windows'
              download_url:
                type: string
                format: uri
                description: URL to download the agent for the platform.
                example: 'https://idprotection.manageengine.com/static_downloads/idsecurityagent/2.0.0/IDProtectionAgent.msi'
              version:
                type: string
                description: Version of the agent for the platform.
                example: '2.0.0'
              installation_details:
                type: object
                properties:
                  status:
                    type: string
                    enum:
                      - installed
                      - not_installed
                    description: Status of the agent installation.
                    example: installed
                  installed_count:
                    type: integer
                    description: Number of devices where the agent is installed.
                    example: 100
                  total_devices_count:
                    type: integer
                    description: Total number of devices available for installation.
                    example: 1000
        download_url:
          type: string
          format: uri
          description: URL to download the agent.
          example: 'https://idprotection.manageengine.com/static_downloads/idsecurityagent/2.0.0/IDProtectionAgent.msi'
        version:
          type: string
          description: Version of the agent.
          example: '2.0.0'
        installation_key:
          type: string
          description: Installation key for the agent.
          example: '1234567890abcdef'
        installation_details:
          type: object
          properties:
            status:
              type: string
              enum:
                - installed
                - not_installed
              description: Status of the agent installation.yifusdvoyhvois
              example: installed

    unauthorized:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              example: '00000101'
            title:
              type: string
              example: 'Unauthorized'
            detail:
              type: string
              example: 'The OAuth token is invalid.'
    serverError:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              example: '00000000'
            title:
              type: string
              example: 'Internal Server Error'
            detail:
              type: string
              example: 'An unexpected internal error has occurred on the server. Please try again later.'
  securitySchemes:
    Zoho_Auth:
      type: oauth2
      x-authorization-example: 'Zoho-oauthtoken 1000.41d9f2cfbd1b7a8f9e314b7aff7bc2d1.8fcc9810810a216793f385b9dd6e125f'
      flows:
        authorizationCode:
          authorizationUrl: 'https://accounts.zoho.com/oauth/v2/auth'
          tokenUrl: 'https://accounts.zoho.com/oauth/v2/token'
          scopes:
            id360.conditional_access_policy.read: 'Read access for management actions'
            id360.conditional_access_policy.write: 'Write access for management actions'
            id360.conditional_access_policy.create: 'Create access for management actions'
            id360.conditional_access_policy.delete: 'Delete access for management actions'
            id360.conditional_access_policy.update: 'Update access for management actions'
            id360.conditional_access_policy.all: 'All access for management actions'