Inactive users still receiving emails when using Send notification for issue api

Hi,

i am using /rest/api/3/issue/{issueIdOrKey}/notify to send a notification for an issue. However, when users have been marked as inactive they are not excluded from emails sent to groups. The email is also sent when accountId of one inactive user is set as a recipient user.

Is it anything I need to add to prevent this?

Thanks