---
title: "Uploads a single file as a base64-encoded JSON body. Designed for MCP clients and other JSON-only callers that can't easily build multipart/form-data requests.
When body.LinkTo is supplied (entityType in {Task, Expense, Estimate, Invoice}), the row is linked in the same transaction; otherwise it is inserted as AttachmentType=\"Draft\" for later linking."
method: POST
path: "/api/FileAttachment/Base64"
tags: ["FileAttachment"]
---

# Uploads a single file as a base64-encoded JSON body. Designed for MCP clients and other JSON-only callers that can't easily build multipart/form-data requests.
When body.LinkTo is supplied (entityType in {Task, Expense, Estimate, Invoice}), the row is linked in the same transaction; otherwise it is inserted as AttachmentType="Draft" for later linking.

`POST /api/FileAttachment/Base64`

## Request body

- FileAttachmentBase64Request — JSON body for POST /api/FileAttachment/Base64. Provide the file as base64-encoded bytes plus its filename.
  - `Filename` string — Original filename including extension. Required.
  - `ContentType` string — Optional MIME type. Inferred from extension if omitted.
  - `Base64Data` string — Base64-encoded file content. Required.
  - `LinkTo` 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.

## 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/invalid base64, 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)
