---
title: "Match a bank transaction to a bill and reflect its pay state"
method: POST
path: "/companies/{companyId}/ap/{id}/match"
tags: ["AR/AP"]
---

# Match a bank transaction to a bill and reflect its pay state

`POST /companies/{companyId}/ap/{id}/match`

## Request

- Base URL: `https://api.medianfi.com/api/v1`
- URL: `https://api.medianfi.com/api/v1/companies/{companyId}/ap/{id}/match`
- Auth: HTTP bearer

DARK — 404s unless company_subledger_flags.ar_ap_items_enabled is true. Creates the applied document_match through the production bill-payment apply path (idempotent, reconciliation-lock safe — never touches a reconciled transaction/JE), then reflects the AP pay state via the existing fail-closed recompute. A covering match settles the bill to paid; a partial one leaves it partially_paid. Re-POST of the same pair converges to the same state rather than a conflict.

## Request body

- object
  - `transactionId` string, uuid, required

## Response `200`

AP item after the match (with availableTransitions)

## Other responses

- `403`: Insufficient role for this company/entity
- `404`: Not found or AR/AP not enabled
- `422`: Validation or business-rule failure

---

[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/20090ea32b0d?raw)
