---
title: "Close a \"mail needs you\" task (#4343)"
method: POST
path: "/accountant/tasks/{taskId}/mail-flag-close"
tags: ["Accountant Portal"]
---

# Close a "mail needs you" task (#4343)

`POST /accountant/tasks/{taskId}/mail-flag-close`

## Request

- Base URL: `https://api.medianfi.com/api/v1`
- URL: `https://api.medianfi.com/api/v1/accountant/tasks/{taskId}/mail-flag-close`
- Auth: HTTP bearer

Penny files a `mail_flag` task for Jacob when a client's mail requires him or his response. He closes it as `replied`, `no_reply_needed`, or `sent_back` to Penny with a `note` (required for `sent_back`). The task completes in the same write, and the action (with the note) is stored as its `answer`, stamped with who closed it and when, for Penny to read back from GET /accountant/tasks. Nothing is sent to the client. Only the task's owner while assigned to its customer, or a human super-admin, may close it. Every API key is refused, the agent's service token included. A closed task answers 409 `MAIL_FLAG_ALREADY_CLOSED`; any other task type answers 422.

## Path parameters

- `taskId` string, uuid, required

## Request body

- object
  - `action` 'replied' | 'no_reply_needed' | 'sent_back', required
  - `note` string: Required for sent_back.

## Response `200`

The task, closed

- object
  - `success` true, required
  - `data` object, required
    - `id` string, uuid, required
    - `type` 'mail_flag', required
    - `status` 'completed', required
    - `answer` string, required: The action, then `: <note>` when one was given.

## 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-11-26** `4a2098becaf9`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/medianfi/apis/median-api/changes/accountant/tasks/:taskId/mail-flag-close/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)
