---
title: "Create a thread, with an optional first message and attachments"
method: POST
path: "/accountant/threads"
tags: ["Accountant Portal"]
---

# Create a thread, with an optional first message and attachments

`POST /accountant/threads`

## Request

- Base URL: `https://api.medianfi.com/api/v1`
- URL: `https://api.medianfi.com/api/v1/accountant/threads`
- Auth: HTTP bearer

Creates an accountant-owned thread. When `content` is non-empty or `attachments` are present, the first message is written with it: thread, message and attachments are stored together or not at all. Attachments with empty `content` become an attachment-only first message. Every attached document or transaction is admitted against the company named in the body and the caller's authority before anything is written. When an open thread already exists for one of `transactionIds`, that thread is returned with 200 and nothing is written.

## Request body

- CreateAccountantThreadInput
  - `customerId` string, uuid: The customer company. Required on `/accountant/threads`, where the path does not name it.
  - `companyId` string, uuid: Accepted as an alias of `customerId`.
  - `subject` string, required
  - `content` string, nullable: Text of the first message. May be empty when attachments are present.
  - `transactionIds` string[]
  - `category` 'categorization' | 'documentation' | 'approval' | 'general'
  - `blocksClose` boolean
  - `attachments` ThreadAttachmentInput[]
    - `type` 'file' | 'link' | 'document' | 'transaction'
    - `label` string
    - `url` string, nullable: An http(s) URL or a root-relative path. Required for `link`; ignored for `document` and `file`.
    - `refId` string, uuid: Required for `document`, `file` and `transaction`.

## Response `200`

An open thread already existed for the given transactions; it is returned unchanged

- AccountantThreadSummaryResponse
  - `success` boolean
  - `data` object: The thread summary the accountant thread list returns. It carries no attachments.

## Other responses

- `201`: Thread created
- `401`: Authentication required
- `403`: Insufficient permissions or not a company member
- `404`: An attached document or transaction does not resolve for the caller in this company. A reference that belongs to another company, one that does not exist and one the caller has no authority over get the same answer. Nothing is written.
- `422`: Validation error, or `THREAD_ATTACHMENT_NOT_ACCEPTED`: an attached document the caller may see has no stored file or its scan verdict is not clean. Nothing is written.

---

[API](https://skmtc.dev/medianfi/apis/median-api.md) · [All operations](https://skmtc.dev/medianfi/apis/median-api/llms.txt) · [OpenAPI document](https://skmtc.dev/medianfi/apis/median-api/revisions/20090ea32b0d?raw)
