How can I add custom headers to an ElementAPI response?
You can do this by assigning your endpoint(s) to a function:



return [
    'endpoints' =&gt; [
        'my-endpoint' =&gt; function() {
            HeaderHelper::setHeader(['Surrogate-Control: max-age=300']);

            return [
                // ...
            ];
        }
    ]
];


UPDATE

Alternatively as of v1.2, you can do it from a separate plugin using the onBeforeSendData event:

public function init()
{
    craft()-&gt;on('elementApi.onBeforeSendData', function(Event $event) {
        HeaderHelper::setHeader(['Surrogate-Control: max-age=300']);
    });
}