openapi: 3.0.0
info:
  title: Offline MFA
  description: The Offline MFA API allows you to manage users who are enrolled on a device and can log in even when the device is offline.
  version: 1.0.0
servers:
  - url: 'https://id360.manageengine.com/api/v1'
    description: 'API Endpoint'
tags:
  - name: device-offline-mfa
    description: Device Offline MFA Endpoints
paths:
  /devices/{device_id}/offline-enrolled-users:
    get:
      tags:
        - device-offline-mfa
      summary: 'Get Offline Enrolled Users'
      description: 'The Get Offline Enrolled Users API can be used to get the list of users enrolled on a device who are allowed to log in even when the device is offline.'
      parameters:
        - $ref: '#/components/parameters/acceptHeader'
        - $ref: '#/components/parameters/id'
        - $ref: '#/components/parameters/limit'
        - $ref: '#/components/parameters/from'
        - $ref: '#/components/parameters/filter'
        - $ref: '#/components/parameters/sort'
      responses:
        '200':
          description: 'OK'
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    $ref: '#/components/schemas/offlineEnrolledUsers'
                  meta:
                    $ref: '#/components/schemas/meta'
        '401':
          description: 'Unauthorized'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/unauthorized'
        '404':
          description: 'Not Found'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/deviceNotFound'
        '500':
          description: 'Internal Server Error'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/serverError'
      security:
        - Zoho_Auth:
            - id360.device.READ
            - id360.device.ALL
    delete:
      tags:
        - device-offline-mfa
      summary: 'Bulk Delete Offline Enrolled Users'
      description: 'The Bulk Delete Offline Enrolled Users API can be used to delete multiple users enrolled on a device who are allowed to log in even when the device is offline.'
      parameters:
        - $ref: '#/components/parameters/authorization'
        - $ref: '#/components/parameters/id'
        - $ref: '#/components/parameters/ids'
      responses:
        '204':
          description: 'No Content'
        '207':
          description: 'Multi-Status'
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    $ref: '#/components/schemas/bulkActionsMultiStatus'
        '401':
          description: 'Unauthorized'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/unauthorized'
        '403':
          description: 'Forbidden'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/accessDenied'
        '404':
          description: 'Not Found'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/deviceNotFound'
        '500':
          description: 'Internal Server Error'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/serverError'
      security:
        - Zoho_Auth:
            - id360.device.write
            - id360.device.delete
            - id360.device.all

  /devices/{device_id}/offline-enrolled-users/{user_id}:
    delete:
      tags:
        - device-offline-mfa
      summary: 'Delete Offline Enrolled User'
      description: 'The Delete Offline Enrolled User API can be used to delete a user enrolled on a device who is allowed to log in even when the device is offline.'
      parameters:
        - $ref: '#/components/parameters/authorization'
        - $ref: '#/components/parameters/id'
        - $ref: '#/components/parameters/userId'
      responses:
        '204':
          description: 'No Content'
        '401':
          description: 'Unauthorized'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/unauthorized'
        '403':
          description: 'Forbidden'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/accessDenied'
        '404':
          description: 'Not Found'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/deviceNotFound'
        '500':
          description: 'Internal Server Error'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/serverError'
      security:
        - Zoho_Auth:
            - id360.device.write
            - id360.device.delete
            - id360.device.all
components:
  parameters:
    authorization:
      name: Authorization
      in: header
      schema:
        type: string
      description: 'Authorization OAuth token for the API'
      required: true
      example: 'Zoho-oauthtoken 1000.41d**************125f'
    acceptHeader:
      name: Accept
      in: header
      schema:
        type: string
      description: 'Accept header for the API'
      required: false
      example: 'application/json'
    limit:
      in: query
      name: limit
      schema:
        type: integer
        maximum: 200
        minimum: 1
        default: 200
      description: 'Limit the number of users to be fetched'
      required: false
      example: 50
    fields:
      in: query
      name: fields
      schema:
        type: string
      description: 'Select the fields to be fetched in the response.'
      required: false
      example: 'id,firstName,email'
    filter:
      in: query
      name: filter
      schema:
        type: string
      description: >
        Filter resources based on a the provided SCIM filter query. Refer to filter section for more details
        <br>
        <strong>eg:</strong> firstName eq "John" and lastName eq "Doe"
      required: false
      example: firstName eq "John" and lastName eq "Doe"
    sort:
      in: query
      name: sort
      schema:
        type: string
      description: >
        Sort the resources based on the provided field. The default sort order is ascending. To sort in descending order, prefix the field with a - (hyphen).
        <br>
        <strong>eg:</strong> firstName,-lastName
      required: false
      example: 'firstName,-lastName'
    from:
      in: query
      name: from
      schema:
        type: integer
        default: 1
      description: >
        Start index for pagination.
      required: false
      example: 1
    id:
      in: path
      name: device_id
      schema:
        type: string
      description: 'The ID of the device to be fetched or deleted'
      example: '2000000000001'
      required: true
    userId:
      in: path
      name: user_id
      schema:
        type: string
      description: 'The ID of the device to be fetched or deleted'
      example: '2000000000001'
      required: true
    ids:
      in: query
      name: ids
      schema:
        type: string
      description: >
        Comma-separated list of resource IDs.
        <br>
        <strong>eg:</strong> 2000000000011,2000000000012
      required: true
      example: '2000000000011,2000000000012'
  schemas:
    gendoc-attributes-schema:
      $ref: '#/components/schemas/offlineEnrolledUser'

    offlineEnrolledUsers:
      type: array
      items:
        $ref: '#/components/schemas/offlineEnrolledUser'
      example:
        - id: "2000000000101"
          display_name: "AlexHales"
          user_name: "alexhales@company.com"
          sam_account_name: "alexhales"
          enrolled_time: "2023-10-26T03:30:00Z"
          primary_source:
            id: '2000000072637'
            name: 'Berge-Corp'
            application_service:
              id: '2000000018007'
              display_name: 'Universal Directory'
              name: 'ZOHO_DIRECTORY'
              logo: 'universal-directory'
          enrolled_authenticators:
            - authn_factor_config_id: "2000000001001"
              factor_type: "GoogleAuthenticator"
              display_name: "Google Authenticator"
            - authn_factor_config_id: "2000000001002"
              factor_type: "MicrosoftAuthenticator"
              display_name: "Microsoft Authenticator"
            - id: "2000000000102"
              factor_type: "FIDOAuthenticator"
              display_name: "FIDO2 Passkeys"
        - id: "20012002"
          display_name: "JohnDoe"
          user_name: "johndoe@company.com"
          local_account_name: "johndoe"
          enrolled_time: "2023-10-26T03:30:00Z"
          primary_source:
            id: '2000000072637'
            name: 'Berge-Corp'
            application_service:
              id: '2000000018007'
              display_name: 'Universal Directory'
              name: 'ZOHO_DIRECTORY'
              logo: 'universal-directory'
          enrolled_authenticators:
            - authn_factor_config_id: "2000000001001"
              factor_type: "GoogleAuthenticator"
              display_name: "Google Authenticator"
            - authn_factor_config_id: "2000000001002"
              factor_type: "MicrosoftAuthenticator"
              display_name: "Microsoft Authenticator"
            - id: "2000000000102"
              factor_type: "FIDOAuthenticator"
              display_name: "FIDO2 Passkeys"
        - id: "20012003"
          display_name: "JaneSmith"
          user_name: "janesmith@company.com"
          local_account_name: "janesmith"
          enrolled_time: "2023-10-26T03:30:00Z"
          primary_source:
            id: '2000000072637'
            name: 'Berge-Corp'
            application_service:
              id: '2000000018007'
              display_name: 'Universal Directory'
              name: 'ZOHO_DIRECTORY'
              logo: 'universal-directory'
          enrolled_authenticators:
            - authn_factor_config_id: "2000000001001"
              factor_type: "GoogleAuthenticator"
              display_name: "Google Authenticator"
            - authn_factor_config_id: "2000000001002"
              factor_type: "MicrosoftAuthenticator"
              display_name: "Microsoft Authenticator"
            - id: "2000000000102"
              factor_type: "FIDOAuthenticator"
              display_name: "FIDO2 Passkeys"
    offlineEnrolledUser:
      type: object
      properties:
        id:
          type: string
          example: "2000000000101"
          description: 'Unique identifier for the user'
        display_name:
          type: string
          example: "AlexHales"
          description: 'Display name of the user'
        user_name:
          type: string
          example: "alexhales@company.com"
          description: 'Email address or username of the user'
        sam_account_name:
          type: string
          example: "alexhales"
          description: 'SAM account name of the user'
        local_account_name:
          type: string
          example: "alexhales"
          description: 'Local account name of the user'
        enrolled_time:
          type: string
          format: date-time
          example: "2023-10-26T03:30:00Z"
          description: 'Time when the user was enrolled on the device'
        primary_source:
          $ref: '#/components/schemas/primarySource'
        enrolled_authenticators:
          type: array
          items:
            type: object
            properties:
              authn_factor_config_id:
                type: string
                description: Unique identifier of the authnfactor config
                example: "authenticator-12345"
              authn_factor_type:
                type: string
                description: Type of the authenticator factor
                example: "TOTP"
              display_name:
                type: string
                description: Display name of the authenticator
                example: "Google Authenticator"
          description: 'List of authenticators enrolled for the user on the device'

    primarySource:
      type: object
      description: Primary source of the resource.
      properties:
        id:
          type: string
          description: Unique identifier of the primary source.
          example: '2000000002642'
        name:
          type: string
          description: Name of the primary source.
          example: 'admp.com'
        application_service:
          type: object
          description: Service to which the primary source belongs.
          properties:
            id:
              type: string
              description: Unique identifier of the service.
              example: '2000000002642'
            display_name:
              type: string
              description: Display name of the service.
              example: 'Universal Directory'
            name:
              type: string
              description: Name of the service.
              example: 'ZOHO_DIRECTORY'
            logo:
              type: string
              description: URL of the service logo.
              example: 'https://example.com/logo.png'

    meta:
      type: object
      properties:
        start_index:
          type: integer
          description: The starting index of the records in the response.
          example: 1
        limit:
          type: integer
          description: The maximum number of records returned in the response.
          example: 100
        total_no_of_objects:
          type: integer
          description: The total number of records available for the request.
          example: 1

    bulkActionsMultiStatus:
      type: array
      items:
        type: object
        properties:
          resource_id:
            type: string
            description: The ID of the resource for whom the action was performed.
            example: '2000000000001'
          status:
            type: integer
            description: HTTP status code indicating the result of the action.
            example: 204
          error:
            $ref: '#/components/schemas/deviceNotFound'
      example:
        - resource_id: '2000000000001'
          status: 204
        - resource_id: '2000000000002'
          status: 404
          error:
            code: '****'
            title: 'Device Not Found'
            detail: 'No device found with ID 2000000000001.'

    deviceNotFound:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              example: '********'
              description: 'Code representing the error'
            title:
              type: string
              example: 'Device Not Found'
              description: 'Title of the error'
            detail:
              type: string
              example: 'No device found with ID 2000000000001.'
              description: 'Detailed message about the error'
    accessDenied:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              example: '********'
              description: 'Code representing the error'
            title:
              type: string
              example: 'Access Denied'
              description: 'Title of the error'
            detail:
              type: string
              example: 'You do not have permission to do this operation.'
    unauthorized:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              example: '00000101'
              description: 'Code representing the error'
            title:
              type: string
              example: 'Unauthorized'
              description: 'Title of the error'
            detail:
              type: string
              example: 'The OAuth token is invalid.'
              description: 'Detailed message about the error'
    serverError:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              example: '00000000'
              description: 'Code representing the error'
            title:
              type: string
              example: 'Internal Server Error'
              description: 'Title of the error'
            detail:
              type: string
              example: 'An unexpected internal error has occurred on the server. Please try again later.'
              description: 'Detailed message about the error'
  securitySchemes:
    Zoho_Auth:
      type: oauth2
      x-authorization-example: 'Zoho-oauthtoken 1000.41d9f2cfbd1b7a8f9e314b7aff7bc2d1.8fcc9810810a216793f385b9dd6e125f'
      flows:
        implicit:
          authorizationUrl: https://accounts.zoho.com/oauth/v2/auth
          scopes:
            id360.device.read: 'Read Device from the account'
            id360.device.write: 'Create/Update/Delete Device in the account'
            id360.device.create: 'Create Device in the account'
            id360.device.delete: 'Delete User from the account'
            id360.device.update: 'Update Device in the account'
            id360.device.all: 'Perfrom all actions on Device'
        authorizationCode:
          authorizationUrl: 'https://accounts.zoho.com/oauth/v2/auth'
          tokenUrl: 'https://accounts.zoho.com/oauth/v2/token'
          scopes:
            id360.device.read: 'Read Device from the account'
            id360.device.write: 'Create/Update/Delete Device in the account'
            id360.device.create: 'Create Device in the account'
            id360.device.delete: 'Delete User from the account'
            id360.device.update: 'Update Device in the account'
            id360.device.all: 'Perfrom all actions on Device'
        clientCredentials:
          tokenUrl: https://accounts.zoho.com/oauth/v2/token
          scopes:
            id360.device.read: 'Read Device from the account'
            id360.device.write: 'Create/Update/Delete Device in the account'
            id360.device.create: 'Create Device in the account'
            id360.device.delete: 'Delete User from the account'
            id360.device.update: 'Update Device in the account'
            id360.device.all: 'Perfrom all actions on Device'
        password:
          tokenUrl: https://accounts.zoho.com/oauth/v2/token
          scopes:
            id360.device.read: 'Read Device from the account'
            id360.device.write: 'Create/Update/Delete Device in the account'
            id360.device.create: 'Create Device in the account'
            id360.device.delete: 'Delete User from the account'
            id360.device.update: 'Update Device in the account'
            id360.device.all: 'Perfrom all actions on Device'