Designing an API that serves files to be downloaded is not easy. In a way, it is an exception to the…