Get PDF file from Assets Folder - Element API
You have to check if your matrix element has a block or not with the code $block-&gt;downloadablePdf[0]-&gt;url you'll access the first element in your matrix but when there is no it will throw an error.

'downloadablePDF' =&gt; $block-&gt;downloadablePdf[0]? $block-&gt;downloadablePdf[0]-&gt;getUlr() : ''


will check if there is an asset and return the url or an empty string if there is no asset