Route updating $file

Hi together,
I’m trying to update a $file meta field in a custom route. I’m using an external transcoding service for videos, this is the flow: “file.create:after” sends a request to the transcoder -> transcoder picks up the task and converts the file -> after transcoding it calls a route of kirby, passing the transcoded video informations as payload.
All of the first steps work well, just updating the $file’s meta fields with the new content throws an error. This is my route:
‘routes’ => [
[
‘pattern’ => ‘videoready(:all)’,
‘action’ => function ($params) {

      $payload = get(); // then do something with the payload
      $videoId =  get('videoId');
      

      $pages = page('projekte')->children();
      foreach ($pages as $page) {
        if($file = $page->file($videoId)) {

          try {
            $newPage = $page->update([
              'fileconverted' => true
            ]);

            echo 'The meta info has been updated';

          } catch(Exception $e) {

            echo 'The meta info could not be updated';
            echo ' '.$page->fileconverted().' '.$videoId.' ';
            echo $e->getMessage();

          }

        }
      }

      return $videoId.' updated';
    },
    'method' => 'POST'
  ]
],

Thank you
Ben

This updates the page, not the file metadata!

Also, you need to authenticate to be able to perform such transactions, see $kirby->impersonate()-

Sorry, I was trying around and posted the wrong snippet. I tried the same on the $file itself too.
The $kirby->impersonate() did the magic.
Thank you!!!
Ben