Tim Bowen sheds some light on the origins and definition of the phrase to spill the beans.

If you spill the beans you reveal a secret that you are not supposed to disclose. Criminals being interrogated by the police often spill the beans and reveal the names of their accomplices.

This expression is believed to originate in ancient Greece, where beans were used as a means of electing officials. Candidates in elections would place their upturned helmets in a line and voters would put a bean in the helmet of their preferred candidate. When the election process ended, the number of beans in each helmet would be counted and the winner was the candidate with the largest number of beans. The winner’s helmet was then returned to him with the beans inside. He would then spill the beans and place the helmet on his head thereby signifying his acceptance of the post to which he had been elected. Spilling the beans was therefore a means of revealing the outcome of a secret process and has passed into the language as disclosing a secret.