---
title: "Get a VetsGPT attachment upload URL"
method: POST
path: "/workspaces/{workspaceId}/vetsgpt/chats/{chatId}/attachments/upload-url"
tags: ["vetsgpt", "signed-url"]
---

# Get a VetsGPT attachment upload URL

`POST /workspaces/{workspaceId}/vetsgpt/chats/{chatId}/attachments/upload-url`

## Request

- Base URL: `https://vetnio.com/api/v2`
- URL: `https://vetnio.com/api/v2/workspaces/{workspaceId}/vetsgpt/chats/{chatId}/attachments/upload-url`
- Auth: HTTP bearer

Issues a presigned URL for uploading one file to an existing chat the caller owns or can contribute to. Steps:

1. Call this endpoint for each file.
2. `PUT` the raw bytes to `chatAttachmentUploadUrl` within 24 hours, with the file's real `Content-Type` (for example `image/jpeg` or `application/pdf`).
3. Pass the `key` in `imageKeys` or `pdfKeys` on the ask endpoint for the same chat.

VetsGPT can read images, PDFs, plain text, CSV, Word (.docx) and Excel files; other types are skipped without an error. No size limit is enforced on the upload (the web app caps PDFs at 50 MB), and at most 100,000 extracted characters per file are used.

## Path parameters

- `workspaceId` string, required: Identifier of the workspace (clinic). The caller must be a member, and VetsGPT must be enabled for them in this workspace.
- `chatId` string, required: Identifier of a VetsGPT chat owned by or explicitly shared with the caller. Unshared chats behave as if they did not exist.

## Request body

- object
  - `filename` string: Original file name. Shown to VetsGPT as the file's label and returned in the messages endpoint's data URIs. When omitted, the generated key is used instead.

## Response `200`

A signed upload URL and attachment key.

- object: Where to upload a chat attachment and the key that identifies it afterwards.
  - `chatAttachmentUploadUrl` string, uri, required: Presigned S3 URL, valid for 24 hours. `PUT` the raw file bytes to it with a `Content-Type` header matching the file (for example `application/pdf` or `image/jpeg`).
  - `key` string, required: Attachment key (`chats/<workspaceId>/<chatId>/attachments/<uuid>`). After the upload, pass it in `imageKeys` or `pdfKeys` when you call the ask endpoint for the same chat. Keys are only valid in the chat they were issued for.

## Other responses

- `400`: Invalid input data
- `401`: Authorization not provided
- `403`: Insufficient access
- `500`: Internal server error

---

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