Responsive Images with REST API

Hi there

I am evaluating a completely headless setup with kirby.
I would like to be able to upload images in one big size and kirby should generate different sizes of responsive images.
I see there is this: https://getkirby.com/docs/guide/templates/resize-images-on-the-fly
But this is all php kirby code, and I want just to consume the REST API. I tried to preconfigure the sizes within site/config/config.php but when uploading a new image, it would not save it in different sizes…

I then thought maybe it would just generate the specific size the first time the image is requested like sometimes they do it with image cdns. But also I did not find any documentation about that.

So what would be the best way to upload an image, and then being able to load a resized version of that image via REST API?

Is there even a possibility?
thank you for every input on that.

Cheers