working api code