Numbers 22:11-12

22:11 “Look, a nation has come out of Egypt, and it covers the face of the earth. Come now and put a curse on them for me; perhaps I will be able to defeat them and drive them out.” 22:12 But God said to Balaam, “You must not go with them; you must not curse the people, for they are blessed.”

Numbers 22:18-20

22:18 Balaam replied to the servants of Balak, “Even if Balak would give me his palace full of silver and gold, I could not transgress the commandment of the Lord my God to do less or more. 22:19 Now therefore, please stay the night here also, that I may know what more the Lord might say to me.” 22:20 God came to Balaam that night, and said to him, “If the men have come to call you, get up and go with them; but the word that I will say to you, that you must do.”

Numbers 22:35

22:35 But the angel of the Lord said to Balaam, “Go with the men, but you may only speak the word that I will speak to you.” So Balaam went with the princes of Balak.