---
title: "Set the legal entity of a file that has none (#5669)"
method: POST
path: "/accountant/companies/{customerId}/documents/{documentId}/entity"
tags: ["Accountant Portal"]
---

# Set the legal entity of a file that has none (#5669)

`POST /accountant/companies/{customerId}/documents/{documentId}/entity`

## Request

- Base URL: `https://api.medianfi.com/api/v1`
- URL: `https://api.medianfi.com/api/v1/accountant/companies/{customerId}/documents/{documentId}/entity`
- Auth: HTTP bearer

Human only: a signed-in accountant assigned to the client. Never a service principal or an API key. Only a file with no entity, no link to money and no amount, vendor or invoice number; a file that has an entity is never moved (409 DOCUMENT_ASSIGNMENT_CONFLICT). The entity must be one of the client's own and not a group. One `document.entity_set` audit row keeps the entity, the reason and who, in the same transaction. It starts no work and posts nothing.

## Path parameters

- `customerId` string, uuid, required
- `documentId` string, uuid, required

## Request body

- object
  - `entityId` string, uuid, required
  - `reason` string, required

## Response `200`

The accountant document DTO, with its entity

## Other responses

- `401`: Authentication required
- `403`: Insufficient permissions or not a company member
- `404`: Resource not found
- `409`: Request conflicts with the durable onboarding state
- `422`: Request failed validation

## Changes

- **2026-12-01** `c0b9022c18ac`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/medianfi/apis/median-api/changes/accountant/companies/:customerId/documents/:documentId/entity/post.md)

---

[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/4f4c2d34276b?raw)
