Mixed relation criteria operator in Element API
Something like this should work to combine 'and' and 'or' conditions.

'relatedTo' =&gt; [
    'and',
    ['element' =&gt; [124, 99]],
    ['element' =&gt; 105],
    ['element' =&gt; 231],
],


And this is the pattern I’m usually using to build the relatedTo param dynamically. I also try to be explicit about the direction (sourceElement / targetElement) and the relation’s field.

$query = craft()-&gt;request-&gt;getQuery();

$relatedToParam = ['and'];

if ($query['reg']) {
    $relatedToParam[] = [
        'targetElement' =&gt; $query['reg'],
        'field' =&gt; 'myRegFieldHandle',
    ];
}

// repeat for all our other relatedTo conditions

$relatedToParam = count($relatedToParam) &gt; 1 ? $relatedToParam : null,

return [
    'criteria' =&gt; [
        'section' =&gt; 'resources',
        'relatedTo' =&gt; $relatedToParam,
    ],
];