Here's a quick way to search for a word inside a string, using strpos the string to look at and the word to look for. Upon a match, true is returned.
$string = 'https://api.domain.com/files';
if (strpos($string, 'api') !== false) {
echo 'true';
}