---
title: "Upload an attachment to any supported entity"
method: POST
path: "/v1/attachments"
tags: ["Attachments"]
---

# Upload an attachment to any supported entity

`POST /v1/attachments`

Upload a base64-encoded file and attach it to a task, vendor, risk, comment, or other supported entity type. The file is uploaded to S3 and a database record is created.

## Request body

- CreateAttachmentDto
  - `fileName` string, required — Name of the file
  - `fileType` string, required — MIME type of the file
  - `fileData` string, required — Base64 encoded file data
  - `description` string — Description of the attachment
  - `userId` string — User ID of the user uploading the attachment (required for API key auth, ignored for JWT auth)
  - `entityId` string, required — ID of the entity to attach the file to
  - `entityType` 'task' | 'vendor' | 'risk' | 'comment' | 'trust_nda' | 'task_item' | 'background_check' | 'employment_onboard' | 'employment_offboard' | 'offboarding_checklist', required — Type of entity the attachment belongs to

## Response `201`

Attachment uploaded successfully

- AttachmentResponseDto
  - `id` string, required — Unique identifier for the attachment
  - `name` string, required — Original filename
  - `type` string, required — File type/MIME type
  - `size` number, required — File size in bytes
  - `downloadUrl` string, required — Signed URL for downloading the file (temporary)
  - `createdAt` string, date-time, required — Upload timestamp

## Other responses

- `400` — Invalid file data, unsupported file type, or file too large
- `401` — Unauthorized - Invalid authentication

## Changes

- **2026-05-28** `7c0713bef5b1` — 1 info
  - endpoint added

[Change history](https://skmtc.dev/trycompai/apis/comp-ai-api/changes/v1/attachments/post.md)

---

[API](https://skmtc.dev/trycompai/apis/comp-ai-api.md) · [All operations](https://skmtc.dev/trycompai/apis/comp-ai-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/trycompai/comp-ai-api/revisions/73c1d2d2da5d/schema)
