The law requires police to have a search warrant to search your house, unless there is an exception to the warrant rule.  If you give consent, they can search.  You can give limited consent and you can withdraw your consent.  They can also search is they have “exigent circumstances.”  An example of this is they think someone is inside whose life is in danger.  There are other reasons, but there must not be enough time to get a warrant for them to come in without one.