Element API display entries by category
Your targetElement needs to be the category object or the ID of your category.
So if the id of your category is 5 you need

'relatedTo' =&gt; ['targetElement' =&gt; 5],


If you really want to be able to fetch your category by slug (which I would not suggest since your slug can be changed in the cp but the ID can't, if someone changes the slug by accident your entire logic will break) you can create an ElementCriteriaModel to search for the category with the slug and insert the object there.

$criteria = craft()-&gt;elements-&gt;getCriteria(ElementType::Category);
$criteria-&gt;slug = $slug; 
$category = $criteria-&gt;find();


And inside your array

'relatedTo' =&gt; ['targetElement' =&gt; $category],