Return API errors
Cleanup types and structs