api: make sure to rewind file objects before each request