destroy in API.js