# Private Nachricht mit Anhang/Upload über API

**URL:** https://meta.discourse.org/t/private-message-with-attachment-upload-via-api/384250
**Category:** Support
**Tags:** rest-api
**Created:** [29. September 2025 um 06:35 UTC](https://meta.discourse.org/t/private-message-with-attachment-upload-via-api/384250 "2025-09-29T06:35:34Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![aidanheerdegen](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/aidanheerdegen/32/277061_2.png) [@aidanheerdegen](https://meta.discourse.org/u/aidanheerdegen)
#### Post date: [29. September 2025 um 06:35 UTC](https://meta.discourse.org/t/private-message-with-attachment-upload-via-api/384250/1 "2025-09-29T06:35:34Z")

</div>

Ist es möglich, die API zu verwenden, um eine Direktnachricht mit einem Anhang/Upload zu senden?

Dies ist über die Weboberfläche möglich, aber es ist mir nicht klar, wie ich dies mit der API emulieren kann.

---

<div class="post-metadata">

### Author: ![Canapin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/canapin/32/119591_2.png) [@Canapin](https://meta.discourse.org/u/Canapin)
#### Post date: [29. September 2025 um 07:50 UTC](https://meta.discourse.org/t/private-message-with-attachment-upload-via-api/384250/2 "2025-09-29T07:50:09Z")

</div>

Hallo, Sie benötigen zwei API-Anfragen. Eine zum Hochladen der Datei, die die URL zurückgibt, und eine zum Erstellen des Beitrags, in den Sie die URL einfügen.

> [@How to upload a file via API and get it's URL?](https://meta.discourse.org/t/how-to-upload-a-file-via-api-and-get-its-url/123732/3?u=canapin):
>
> Also interested in this question I can’t find a way to upload a file to Topic and Post via the API. Perhaps someone can suggest a method. UPD: I figured it out, the method is described in the documentation and it works. Upload a file using “/uploads.json”, in response we get the Short URL of the uploaded file like “upload://ueNyWDEgHhXIuIdB472fy9T6.txt” We update the post with the second API request, adding a line like this to the very end of post[raw]: [filename.txt|attachment](upload://…

---

<div class="post-metadata">

### Author: ![aidanheerdegen](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/aidanheerdegen/32/277061_2.png) [@aidanheerdegen](https://meta.discourse.org/u/aidanheerdegen)
#### Post date: [1. Oktober 2025 um 23:25 UTC](https://meta.discourse.org/t/private-message-with-attachment-upload-via-api/384250/3 "2025-10-01T23:25:01Z")

</div>

> [@Canapin](#):
>
> Hallo, Sie benötigen zwei API-Anfragen. Eine zum Hochladen der Datei, die die URL zurückgibt, und eine zum Erstellen des Beitrags, in den Sie die URL einfügen.

Danke. Bei der Verwendung der GUI hat der Upload je nach Kontext (Thema vs. private Nachricht) eine andere Sicherheit, daher müsste ich die gleichen Einstellungen im API-Aufruf für den Upload nachahmen, um das gleiche Ergebnis zu erzielen.

Wenn ich mir die API ansehe, ist mir nicht klar, wie ich das erreichen kann

> **[Discourse API Docs](https://docs.discourse.org/#tag/Uploads)**
