Brazil defender Dani Alves asked a Spanish court on Thursday to be freed on bail while he waits to be tried for rape.