---
title: "Record a client's patient-data answer"
method: PUT
path: "/accountant/companies/{customerId}/patient-data"
tags: ["Accountant Portal"]
---

# Record a client's patient-data answer

`PUT /accountant/companies/{customerId}/patient-data`

## Request

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

#4334 (plan F27): records "patient data yes or no, confirmed by" for the client, with the caller as the confirmer, and appends the answer to its append-only history. Turning the restriction on (`hasPatientData: true`) is for a human super-admin (SUPER_ADMIN_USER_IDS) or the client's close reviewer (#2587 p13, the Setup board's Turn on); recording a `no` is a super-admin's alone. Every API key, the cloud-bookkeeping service token and the agent's key get 404, and any other signed-in person gets 403 `PATIENT_DATA_ROLE_REQUIRED`. The answer has the same shape as GET. `expectedState` is the answer the caller read; when it has changed since, nothing is written and the answer is 409 `PATIENT_DATA_STATE_CHANGED`. Changing a recorded `yes` to `no` needs `reason` (422 without it). The one patient-data company refused in code can never be recorded `no` (403 `AGENT_PATIENT_DATA_COMPANY_REFUSED`).

## Path parameters

- `customerId` string, uuid, required

## Request body

- object
  - `hasPatientData` boolean, required
  - `expectedState` 'unset' | 'yes' | 'no', required
  - `reason` string

## Response `200`

Success envelope with the answer now in force

- object
  - `success` boolean, required
  - `data` object, required
    - `companyId` string, uuid, required
    - `state` 'unset' | 'yes' | 'no', required: `unset` until a person records the answer. `unset` and `yes` both mean no model call for the bookkeeping agent, no mail intake stored and no agent run; only `no` allows them.
    - `confirmedByUserId` string, uuid, nullable, required
    - `confirmedAt` string, date-time, nullable, required
    - `confirmedByName` string, nullable: The confirmer's name, for the screen; null when unset or unknown.
    - `turnedOnBy` object, nullable: Who turned the restriction on (the `yes` now in force). Null at `unset` and `no`. `name` is null when the person has none on file.
      - `id` string, uuid, required
      - `name` string, nullable, required
    - `turnedOnAt` string, date-time, nullable: When the restriction was turned on. Null at `unset` and `no`.
    - `viewerCan` object: What the signed-in person may record at this client. `turnOn` is a super-admin or the client's close reviewer; `turnOff` (recording a `no`) is a super-admin.
      - `turnOn` boolean, required
      - `turnOff` boolean, required
    - `history` object[]: Every answer recorded for the client, oldest first (the same items as GET).

## Other responses

- `401`: Authentication required
- `403`: Insufficient permissions or not a company member
- `404`: Resource not found
- `409`: The answer changed since the caller read it (`PATIENT_DATA_STATE_CHANGED`); nothing was written.
- `422`: The body failed validation, or a recorded yes is changed to no without `reason`.

## Changes

- **2026-11-26** `4a2098becaf9`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/medianfi/apis/median-api/changes/accountant/companies/:customerId/patient-data/put.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)
