Zend certified PHP/Magento developer

API stopped working with 2fa since 2.4 upgrade

We have used the same PHP script since magento 2 upgrade (around 4 years) to integrate magento with our warehouse management software. Since we upgraded to 2.4 we are getting this message

resulted in a 400 Bad Request response: {“message”:”You are required
to configure personal Two-Factor Authorization in order to login.
Please check your email.”

We have always had 2fa enabled.

We use the standard way of connecting, is there another way of doing it since the upgrade?

 $_stores[1] = [
            'base_uri' => 'https://XXX.XXX.co.uk/',
            'username' => 'XXX',
            'password' => 'XXX',
        ];

        if (!isset($_stores[$store_id])) {
            throw new Exception('Invalid store ID found in URL');
        }

        $this->_client = new Client([
            'base_uri' => $_stores[$store_id]['base_uri'] . 'index.php/rest/all/V1/',
            'verify' => false,
        ]);

        try {
            $response = $this->_client->request('POST', 'integration/admin/token', [
                'json' => [
                    'username' => $_stores[$store_id]['username'],
                    'password' => $_stores[$store_id]['password'],
                ],
            ]);

We have turned 2fa off for now but we would really like to get it back on as soon as possible. I’m guessing the account needs to be able to bypass the 2fa somehow? or is there another way to ger the token without using 2fa? i can’t find anything online about this?