<p>I think i have found the answer after digging in Element docs... looks like this works! in criteria</p>

<pre><code>'draftCreator' =&gt; $user-&gt;id
</code></pre>

CC BY-SA 4.0
2020-05-27T15:10:39.133Z
2020-05-27T15:10:39.133Z
Spotd
<p>I have a remote app that enables preview based on your editor craft account. I want to retrieve draft entries that they are working on, but i cant find a way to do this. 'authorId' seems to always be the original author of the entry, rather than the draft.</p>

<p>Here is the important bit of my code -></p>

<pre><code>$user = Craft::$app-&gt;users-&gt;getUserByUsernameOrEmail($userp);

           return [
          'elementType' =&gt; Entry::class,
          'paginate' =&gt; false,
          'pretty' =&gt; true,
          'criteria' =&gt; ['draftId' =&gt; $entryId, 'section' =&gt; 'cashwrap', 'drafts' =&gt; true, 'orderBy'   =&gt; 'dateUpdated desc', 'authorId' =&gt; $user-&gt;id, 'limit' =&gt; 10 ],
</code></pre>

<p>I cant find any ref for retrieving, or filtering by the draft author id? The above will only show drafts for original author id not draft author.</p>

<plugin-elementapi><author><draft>
Element-api - filter Draft entries by the draft author (not original author)
# Element-api - filter Draft entries by the draft author (not original author)

(Asked by: username_0 on 2020-05-19)

I have a remote app that enables preview based on your editor craft account. I want to retrieve draft entries that they are working on, but i cant find a way to do this. 'authorId' seems to always be the original author of the entry, rather than the draft.
Here is the important bit of my code ->
$user = Craft::$app->users->getUserByUsernameOrEmail($userp);

           return [
          'elementType' => Entry::class,
          'paginate' => false,
          'pretty' => true,
          'criteria' => ['draftId' => $entryId, 'section' => 'cashwrap', 'drafts' => true, 'orderBy'   => 'dateUpdated desc', 'authorId' => $user->id, 'limit' => 10 ],

I cant find any ref for retrieving, or filtering by the draft author id? The above will only show drafts for original author id not draft author.

**Tags:** plugin-elementapi, author, draft

---

## 1 answers

### Answer by username_0 on 2020-05-27. Score: 1

I think i have found the answer after digging in Element docs... looks like this works! in criteria
'draftCreator' => $user->id


---

