---
title: "Attach a file to a reply"
method: PUT
path: "/api/v1/mail/threads/{id}/attachments/{attachmentId}"
tags: ["Desk"]
---

# Attach a file to a reply

`PUT /api/v1/mail/threads/{id}/attachments/{attachmentId}`

## Request

- Base URL: `http://localhost:5180`
- URL: `http://localhost:5180/api/v1/mail/threads/{id}/attachments/{attachmentId}`
- Auth: API key in cookie `better-auth.session_token`

Keeps the bytes of one file beside the reply it will be sent with, in the store of the mailbox the reply goes out of. The body is the file itself, with its Content-Type and a Content-Length. Name the reply with `message` and send it with POST /mail/threads/{id}/send, listing the attachment.

## Path parameters

- `id` string, required
- `attachmentId` string, required

## Query parameters

- `message` string, required
- `name` string, required

## Response `200`

The file is kept, ready to be sent.

- object
  - `ok` unknown, required
  - `data` object, required
    - `id` string, required: Stable record id, e.g. `lse_012`.
    - `name` string, required
    - `size` number, required: Bytes, as the store counted them.
    - `kind` string, required: Its content type.
  - `meta` object, required
    - `requestId` string, required: Echoed in the x-request-id header. Quote it in a bug report.

## Other responses

- `400`: No Content-Length, or a file over the request ceiling.
- `404`: No such conversation on this team.
- `409`: That reply is already on its way, or on another conversation.
- `422`: No mailbox can send on this conversation, or this deployment keeps no files (`details.reason`).

---

[API](https://skmtc.dev/dardaris/apis/dardaris-api.md) · [All operations](https://skmtc.dev/dardaris/apis/dardaris-api/llms.txt) · [OpenAPI document](https://skmtc.dev/dardaris/apis/dardaris-api/revisions/4aff33835c73?raw)
