Article 7 of the International Covenant on Civil and Political Rights states:
No one shall be subjected to torture or to cruel, inhuman or degrading treatment or punishment. In particular, no one shall be subjected without his free consent to medical or scientific experimentation.
The UN Convention Against Torture and Other Cruel, Inhuman or Degrading Treatment or Punishment expands upon Article 7 of the ICCPR and deals with prohibitions on torture and ill treatment at all stages of detention.
The UN Basic Principles for the Treatment of Prisoners set out 11 Principles based upon the UN Standard Minimum Rules for the Treatment of Prisoners which are not legally binding but aim to offer guidance for the treatment of prisoners and the management of correctional facilities.
The Convention on the Rights of the Child at Articles 9 and 36 also address standards of treatment for those in detention under 18.
The UN Office on Drugs and Crime has produced a Compendium of UN standards and norms in crime prevention and criminal justice including principles relevant to the operation of correctional and detention facilities.