Yes, it is legal to use a WhatsApp spy app if you own the target device or have the consent of the target user.