How can I fix this code so it generates unique random letters and numbers in lower case?
api_string = (0...32).map{65.+(rand(25)).chr}.join
Newer versions of Ruby support SecureRandom.base58, which will get you much denser tokens than hex, without any special characters.
> SecureRandom.base58(24) > "Zp9N4aYvQfz3E6CmEzkadoa2"