---
title: "Post a file from the conversation Draft folder as a chat message"
method: POST
path: "/ocs/v2.php/apps/spreed/api/{apiVersion}/chat/{token}/attachment"
tags: ["chat"]
---

# Post a file from the conversation Draft folder as a chat message

`POST /ocs/v2.php/apps/spreed/api/{apiVersion}/chat/{token}/attachment`

The file must be inside the Draft folder returned by the probe endpoint. This endpoint moves the file from Draft into the shared conversation subfolder (resolving any name conflicts), creates the chat message, and returns the actual final filename. The subfolder is shared with the room via a folder-level TYPE_ROOM share — no per-file share is created, keeping the Share Overview clean.

## Path parameters

- `apiVersion` 'v1', required
- `token` string, required

## Headers

- `OCS-APIRequest` boolean, required

## Request body

- object
  - `filePath` string, required — Path of the file relative to the user's home root (e.g. "Talk/Group Chat-abc123/Draft/uuid.jpg")
  - `referenceId` string, required — Client-generated reference ID for the message
  - `talkMetaData` string — JSON-encoded metadata (caption, messageType, silent, …)
  - `fileName` string — Desired final file name; the service resolves conflicts by appending " (1)", " (2)", … if already taken
  - `allowUpdate` boolean — Allow recipients to modify shared files

## Response `200`

File moved from Draft and posted as chat message

- object
  - `ocs` object, required
    - `meta` OCSMeta, required
      - `status` string, required
      - `statuscode` integer, required
      - `message` string
      - `totalitems` string
      - `itemsperpage` string
    - `data` object, required
      - `renames` object[], required

## Other responses

- `400` — Path does not point to a file
- `401` — Current user is not logged in
- `404` — File not found
- `422` — File is not inside the conversation Draft folder for this room
- `500` — Could not prepare the conversation folder
- `501` — Conversation subfolders feature is disabled
- `507` — User storage quota exceeded

## Changes

- **2026-07-03** `f46672500092` — 1 info
  - added the new optional request property `allowUpdate`
- **2026-07-01** `6445cccf6c1b` — 1 warning
  - removed the request property `allowUpdate`
- **2026-06-30** `f6cbdb0a44f0` — 1 info
  - added the new optional request property `allowUpdate`
- **2026-03-30** `ad88085904b7` — 1 info
  - endpoint added

[Change history](https://skmtc.dev/nextcloud/apis/spreed-full/changes/ocs/v2.php/apps/spreed/api/:apiVersion/chat/:token/attachment/post.md)

---

[API](https://skmtc.dev/nextcloud/apis/spreed-full.md) · [All operations](https://skmtc.dev/nextcloud/apis/spreed-full/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/nextcloud/spreed-full/revisions/41d6458d6d6e/schema)
