Element API access param in transformer
I managed to get access to the slug in the transformer function by using use. I'm not sure if it's the correct way but it works for now.

'api/series/&lt;slug:{slug}&gt;.json' =&gt; function($slug) {
  // get category by slug
  $category = craft()-&gt;elements-&gt;getCriteria(ElementType::Category);
  $category-&gt;group = 'series';
  $category-&gt;slug = $slug;
  $category-&gt;first();

  return [
    'elementType' =&gt; ElementType::Entry,
    'criteria' =&gt; [
      'section' =&gt; ['lessons'],
      'relatedTo' =&gt; ['targetElement' =&gt; $series]
    ],
    'transformer' =&gt; function(EntryModel $entry) use ($category) {

      $firstCategory = $category-&gt;first();

      $cat = [
        'id' =&gt; $firstCategory-&gt;id,
        'slug' =&gt; $firstCategory-&gt;slug,
        'title' =&gt; $firstCategory-&gt;title
      ];

      return array_merge(structureEntry($entry), structureCategory($cat));
    }
  ];
}