added isxdigit in getapikey()