How to identify current user type is integration in Magento 2?

Magento allows API to integrate with a third party system to the interaction between Magento and other platforms.

In Magento, a list of resources that you can access depends on your user type. There are four types of user types available in native out of the box.

List of User types in Magento:
INTEGRATION
ADMIN
CUSTOMER
GUEST

<?php
namespace Jesadiya\UserType\Model;

use Magento\Authorization\Model\UserContextInterface;

class UserTypeIdentify
{
    /**
     * @var UserContextInterface
     */
    private $userContext;

    public function __construct(
        UserContextInterface $userContext
    ) {
        $this->userContext = $userContext;
    }

    /**
     * Return user type
     *
     * @return int|null
     */
    public function getUserType(): ?int
    {
        $userType = $this->userContext->getUserType();
        return $userType;
    }
}

You can access the function using, echo $userType = $this->getUserType();

If Output is 1, user type is integration.

api.xml used to define your resource access integration.
You can define path at etc/integration/api.xml, you can create a custom module using create custom integration

Output:
1