---
title: "End the company's bookkeeping agent runs left open past their time limit"
method: POST
path: "/accountant/companies/{customerId}/agent/runs/expire-stale"
tags: ["Accountant Portal"]
---

# End the company's bookkeeping agent runs left open past their time limit

`POST /accountant/companies/{customerId}/agent/runs/expire-stale`

## Request

- Base URL: `https://api.medianfi.com/api/v1`
- URL: `https://api.medianfi.com/api/v1/accountant/companies/{customerId}/agent/runs/expire-stale`
- Auth: HTTP bearer

Agent key only. Ends every run of the company still open 8 minutes after it started, as failed with zero usage, under the same attempt and given-up rules as any failed run. Answers how many it ended. Mounted only when the deployment enables the bookkeeping agent (default off); otherwise 404.

## Path parameters

- `customerId` string, uuid, required

## Response `200`

Success envelope with `expired`, the number of runs ended

- object

## Other responses

- `401`: Authentication required
- `403`: Insufficient permissions or not a company member
- `404`: Resource not found

## Changes

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

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