Get currentSite.handle in Element API
The currentSite property from the Sites service is what you're looking for. Here's how you would use it:
'api/search.json' =&gt; function() {

    $siteHandle = Craft::$app-&gt;getSites()-&gt;currentSite-&gt;handle;

    ...

    $criteria = [
        'site' =&gt; $siteHandle,
        ...
    ];

    return [
        ...
    ];
},