# Delete Draft post from the API - getting not\_found error

**URL:** https://meta.discourse.org/t/delete-draft-post-from-the-api-getting-not-found-error/401220
**Category:** Development
**Tags:** rest-api
**Created:** [April 22, 2026, 8:38am UTC](https://meta.discourse.org/t/delete-draft-post-from-the-api-getting-not-found-error/401220 "2026-04-22T08:38:25Z")
**Posts on this page:** 1
**Showing post:** 3

<div class="post-metadata">

### Author: ![zogstrip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zogstrip/32/512781_2.png) [@zogstrip](https://meta.discourse.org/u/zogstrip)
#### Post date: [April 22, 2026, 10:32am UTC](https://meta.discourse.org/t/delete-draft-post-from-the-api-getting-not-found-error/401220/3 "2026-04-22T10:32:31Z")

</div>

> [@nitinkg](#):
>
> Is draft deletion supported via API key auth, same as the other APIs?

Have you tried passing the username as a query param as well? (aka. adding `?username=<username>` to the URL)

Looks like we were not being quite consistent with how we allowed the API to fall-back to the `Api-Username` username when no `username` query param was being provided.

That should be fixed with

> <https://github.com/discourse/discourse/pull/39449>
>
> Admin callers using the API to \`DELETE /drafts/:id.json\` or \`DELETE /review/:id.…json\` received a \`not\_found\` error when the \`username\` param was omitted, even though the resource existed and was owned by the API user (\`Api-Username\`). The destroy actions always called \`fetch\_user\_from\_params\` on the API path, which raises \`Discourse::NotFound\` when neither \`username\` nor \`external\_id\` is provided — forcing callers to redundantly pass \`username=\<self\>\` to delete their own resources.
> 
> Extract the target-user resolution into a shared \`fetch\_target\_user\` helper in \`ApplicationController\` that mirrors the pattern already used by \`topics#set\_notifications\`: for API requests, an admin can target another user via \`username\`/\`external\_id\`; otherwise the action operates on \`current\_user\`. This also aligns API capabilities with the UI — non-admin API callers can now manage their own drafts/reviewables, matching what they can already do via the web.
> 
> Migrated call sites:
> 
> \- \`DraftsController#destroy\` and \`#bulk\_destroy\`
> \- \`ReviewablesController#destroy\`
> \- \`TopicsController#set\_notifications\` (now uses the helper instead of its inline version)
> 
> https://meta.discourse.org/t/401220

---

_[View the full topic](https://meta.discourse.org/t/delete-draft-post-from-the-api-getting-not-found-error/401220)._
