The student protest was one of a handful of rare public acts of defiance that sprung up in the military controlled nation as it marked one year since then army chief Prayut Chan-O-Cha seized power, toppling the elected administration of Yingluck Shinawatra.
Political protests are currently banned in Thailand alongside criticising the junta.
Angry scuffles broke out late yesterday between police and around 50 student protesters after some of the anti-coup demonstrators tried to chain themselves together outside a popular mall in the capital.
"Police merely invited them for talks they are not arrested," Major General Chayapol Chatchaidet, commander of Bangkok's zone six, which covers much of the city's downtown districts, told AFP.
More From This Section
"All 31 students have been freed this morning. No charge has been filed against anyone," he added.
Thailand's police and military routinely use the phrase "invited to talk" to describe detentions that are anything but voluntary.
In the days after the coup, the junta ordered scores of politicians, academics and critics to report for "attitude adjustment", some of whom were held for up to a week, including ousted premier Yingluck.
Local rights group iLaw, which monitors arrest figures, said yesterday that 751 people have been "summoned" by the authorities since the military took over while 166 people have been arrested "while expressing their opinions in a public place".
Seven student protesters were also detained yesterday in the northeastern city of Khon Kaen, a bastion of support for Yingluck and her brother Thaksin, who was toppled in a 2006 military coup.