---
title: "Upload transaction files"
method: POST
path: "/v1/transactions/{transaction_id}/files"
tags: ["Transaction"]
---

# Upload transaction files

`POST /v1/transactions/{transaction_id}/files`

## Request

- Base URL: `https://api.cardda.com`
- URL: `https://api.cardda.com/v1/transactions/{transaction_id}/files`
- Auth: HTTP bearer

Attaches one or more files to a transaction's documentation, creating the documentation
record on first upload. Send the request as `multipart/form-data` with a `files` field
(single file or array). Returns the most recently attached file.

## Path parameters

- `transaction_id` string, uuid, required

## Headers

- `company-id` string, uuid, required

## Request body `multipart/form-data`

- object
  - `files` string[], required: One or more files to attach.

## Response `201`

File attached

- TransactionFile: An ActiveStorage attachment stored against a transaction's documentation, serialized together with its blob. Returned by the transaction file endpoints.
  - `id` string, uuid, required: The attachment id (used as `file_id` in the file endpoints).
  - `name` string: The attachment name (association name, always `files`).
  - `record_type` string: The record type the attachment belongs to.
  - `record_id` string, uuid: The id of the documentation record the attachment belongs to.
  - `blob_id` string, uuid: The id of the underlying blob.
  - `created_at` string, date-time
  - `blob` object: The underlying ActiveStorage blob metadata.
    - `id` string, uuid
    - `key` string: Storage key of the blob.
    - `filename` string
    - `content_type` string
    - `metadata` object
    - `byte_size` integer
    - `checksum` string
    - `created_at` string, date-time
    - `service_name` string

## Other responses

- `400`: Missing `files` parameter
- `401`: Unauthorized
- `404`: Transaction not found
- `500`: The file could not be attached

---

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