---
title: "Uploads a single file via multipart/form-data. Send the file in a \"file\" form field.
Optional query parameters linkToEntityType + linkToEntityId inline-link the upload to a Task, Expense, Estimate, or Invoice in the same call.
When no link is supplied, the row is inserted as AttachmentType=\"Draft\" and reaped by the cleanup job after 24 hours if never linked."
method: POST
path: "/api/FileAttachment"
tags: ["FileAttachment"]
---

# Uploads a single file via multipart/form-data. Send the file in a "file" form field.
Optional query parameters linkToEntityType + linkToEntityId inline-link the upload to a Task, Expense, Estimate, or Invoice in the same call.
When no link is supplied, the row is inserted as AttachmentType="Draft" and reaped by the cleanup job after 24 hours if never linked.

`POST /api/FileAttachment`

## Query parameters

- `linkToEntityType` string
- `linkToEntityId` integer

## Response `200`

Returns the uploaded file attachment details.

- FileAttachmentUploadResult — Response from the /api/FileAttachment* endpoints. Mirrors the shape of /api/Expense/Attachment with an optional LinkedTo echo when an inline link was requested.
  - `FileAttachments` FileAttachmentDetails[] — List of uploaded file attachment details.
    - `FileAttachmentID` integer — Unique identifier for the file attachment.
    - `SizeBytes` integer — File size in bytes.
    - `OriginalFilename` string — Original filename as uploaded.
    - `PublicFileURL` string — Public URL to access the uploaded file.
    - `PreviewBaseURL` string — URL for a preview/thumbnail of the file.
  - `LinkedTo` FileAttachmentLinkTarget — Identifies an entity to inline-link an uploaded attachment to. Supported entityType values: "Task", "Expense", "Estimate", "Invoice".
    - `EntityType` string — Entity kind. One of: "Task", "Expense", "Estimate", "Invoice".
    - `EntityId` integer — The target entity's primary key.

## Other responses

- `400` — Bad request (missing file, oversize, malformed payload, unknown entity).
- `401` — Unauthorized.
- `403` — Caller lacks the required scope or right.
- `507` — Insufficient storage allowance on the account.

---

[API](https://skmtc.net/avaza/apis/avaza-api-documentation.md) · [All operations](https://skmtc.net/avaza/apis/avaza-api-documentation/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/avaza/avaza-api-documentation/versions/1eeadf750514/schema)
