Can i power directly a electromagnet with a 12 volt battery?

I have a zubax fg401m connected to a pixcube orange and when I connect it in the can 2 it does not turn the LED on even though its providing 5 volts

That’s odd because it should power up starting from 4 V. The answer to the title question is “yes”, anything from 4 to 30 V is fine. Please check it using a bench power supply to make sure everything is peachy.