With the explosion of consumer devices, designing flexible and device-independent optimized APIs has become increasingly challenging. This talk covers API design best practices and core principles for microservice and serverless architecture, demonstrates them using a custom PHP framework, and summarizes the lessons learnt. Additionally, the talk covers highly optimized API design using graphQL to address versioning issues and device resource constraints. Lastly, we cover key takeaways for implementing and migrating to these architectures.