Fix permission denial NameError
Rearrange import statements
Removed validation function and use builtin instead
Remove legacy API client script