---
title: "Reconcile (void) orphaned Bill.com bills"
method: POST
path: "/api/admin/billcom/orphaned-bills/cleanup"
tags: ["Bill.com Integration"]
---

# Reconcile (void) orphaned Bill.com bills

`POST /api/admin/billcom/orphaned-bills/cleanup`

## Request

- Base URL: `https://api.production.yourmedley.com`
- URL: `https://api.production.yourmedley.com/api/admin/billcom/orphaned-bills/cleanup`
- Auth: none declared

Voids each orphaned Bill.com bill that SGOS is tracking (failed payments carrying a
bill id) and clears the persisted bill id on success, so a payment SGOS reports as
failed no longer corresponds to a payable bill in Bill.com (MED-1237 AC3, AC5).
Idempotent — safe to re-run; already-voided bills are treated as reconciled.

Restricted to Admin (`internal_admin`) because it moves financial state in Bill.com.

## Response `200`

Reconciliation summary

- object
  - `success` boolean
  - `message` string
  - `data` object
    - `total` integer
    - `voided` integer
    - `still_orphaned` integer
    - `details` object[]

## Other responses

- `401`: Unauthorized
- `403`: Forbidden — requires the Admin role
- `500`: Internal server error

---

[API](https://skmtc.dev/withmedley/apis/medley-api.md) - [All operations](https://skmtc.dev/withmedley/apis/medley-api/llms.txt) - [OpenAPI document](https://skmtc.dev/withmedley/apis/medley-api/revisions/40aaac5ca6bd?raw)
