---
title: "Attach a file to a chat"
method: POST
path: "/api/v1/ask/attachments"
tags: ["Dardaris"]
---

# Attach a file to a chat

`POST /api/v1/ask/attachments`

## Request

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

Multipart: `file`. The file is held on the scratch shelf for 1 day and filed nowhere: name its `id` in `attachments` on `POST /ask` and the assistant reads it with the question, and `POST /documents/attached` files it against a record. Whatever is not filed goes when the shelf empties.

## Response `200`

The file, held.

- object
  - `ok` unknown, required
  - `data` object, required
    - `id` string, required: The `id` `POST /ask/attachments` answered with.
    - `name` string, required: The file’s own name.
    - `contentType` string, required
    - `bytes` integer, required
    - `expiresAt` string, required: When it is gone unless something files it first.
  - `meta` object, required
    - `requestId` string, required: Echoed in the x-request-id header. Quote it in a bug report.

## Other responses

- `400`: No file, an empty one, one larger than the account takes, or a kind it does not take.

---

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