---
title: "File a file attached to a chat"
method: POST
path: "/api/v1/documents/attached"
tags: ["Documents"]
---

# File a file attached to a chat

`POST /api/v1/documents/attached`

## Request

- Base URL: `http://localhost:5180`
- URL: `http://localhost:5180/api/v1/documents/attached`
- Auth: API key in cookie `better-auth.session_token`

Files a file attached to a chat (`POST /ask/attachments`) as a document of the given `kind`, under every record in `links`. The file stays on the chat shelf until it empties, so filing it twice files two documents.

## Request body

- object
  - `attachmentId` string, required: The `id` `POST /ask/attachments` answered with.
  - `kind` 'lease' | 'lease_annex' | 'inspection_report' | 'invoice' | 'receipt' | 'quote' | 'supplier_invoice' | 'certificate' | 'id_document' | 'proof_of_income' | 'insurance_policy' | 'deed' | 'floor_plan' | 'photo' | 'correspondence' | 'formal_notice' | 'statement' | 'tax_document' | 'lease_termination' | 'lease_amendment' | 'other', required: What the document is.
  - `links` object[], required: The records it is filed under: a unit, its lease, the tenant it is about.
    - `kind` 'building' | 'unit' | 'lease' | 'contact' | 'issue' | 'work_order' | 'invoice' | 'certificate' | 'task' | 'booking', required: What the record is.
    - `id` string, required: Stable record id, e.g. `lse_012`.
  - `name` string: What to call it in the filing. The file’s own name when left out.

## Response `200`

The document it is now filed as.

- object
  - `ok` unknown, required
  - `data` object, required
    - `documentId` string, required: The document it is now filed as.
    - `name` string, required
    - `kind` string, required
  - `meta` object, required
    - `requestId` string, required: Echoed in the x-request-id header. Quote it in a bug report.

## Other responses

- `400`: A kind or a link the filing does not take, or a record that is not on this team.
- `404`: No such attachment on this team, or the shelf has emptied since it was attached.

---

[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)
