---
title: "POST /attachments"
method: POST
path: "/attachments"
tags: ["Files"]
---

# POST /attachments

`POST /attachments`

Upload a file and attach it to an entity in a single atomic operation. Send as multipart/form-data with `file`, `entityType`, and `entityId` fields. Maximum file size: 20 MB.

## Response `201`

Default Response

- object
  - `result` string, required
  - `data` File, required
    - `id` number, required
    - `companyId` number, required
    - `entityType` 'customer' | 'job' | 'site' | 'enquiry' | 'job_phase' | 'form' | 'certificate', required
    - `entityId` number, required
    - `fileGuid` string, required — Unique file identifier (sys_file.guid)
    - `fileName` string, required
    - `fileSize` number, required — File size in bytes
    - `mimeType` string, required
    - `createdBy` number, nullable, required
    - `createdAt` string, date-time, required
    - `links` Links[], required
      - `href` string, required
      - `rel` string, required
      - `type` 'GET' | 'POST' | 'PUT' | 'PATCH', required

## Other responses

- `4XX` — Client Request Errors
- `5XX` — Server Errors

---

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