Response Header in custom API

Hi,

i need to pass a custom header to my custom API-Endpoint.
In a controller this code works.

$kirby->response()->header('x-foo', 'bar');

How can i pass this to my API?

[
		  'pattern' => 'connect',
		  'action'  => function () use ($kirby) {
			  $iam = $kirby->user();
			  $kirby->response()->header('x-foo', 'bar');
			  
			return [
			  'note' => 'Willkommen ' . (string)$iam->name(),
			];
		  }
		],

Is this even possible?