---
title: "Apply an accountant document match"
method: POST
path: "/accountant/companies/{customerId}/documents/{documentId}/match"
tags: ["Accountant Documents"]
---

# Apply an accountant document match

`POST /accountant/companies/{customerId}/documents/{documentId}/match`

## Request

- Base URL: `https://api.medianfi.com/api/v1`
- URL: `https://api.medianfi.com/api/v1/accountant/companies/{customerId}/documents/{documentId}/match`
- Auth: one of:
  - HTTP bearer
  - API key in header `X-API-Key`

## Request body

- MatchDocumentInput
  - `transactionId` string, uuid, required

## Response `200`

Matched public document projection

- DocumentResponse
  - `success` boolean, required
  - `data` Document, required
    - `id` string, uuid, required
    - `entityId` string, uuid, nullable, required
    - `type` 'invoice' | 'bill' | 'receipt' | 'contract' | 'statement', required
    - `status` 'needs_review' | 'reviewed' | 'processed' | 'archived', required
    - `name` string, required
    - `vendorName` string, nullable, required
    - `customerName` string, nullable, required
    - `invoiceNumber` string, nullable, required
    - `amountCents` integer, nullable, required: Document total in the persisted currency's authoritative minor units; null only for true-empty intake.
    - `amountPaidCents` integer, nullable, required: Server-owned sum of applied, same-entity, same-currency payment matches; null with a true-empty document amount.
    - `outstandingAmountCents` integer, nullable, required: Exact amountCents minus amountPaidCents; null with a true-empty document amount.
    - `currency` string, nullable, required: Certified ISO 4217 currency; null only for true-empty document money.
    - `minorUnitExponent` 2 | null, nullable, required: Public scale authority for every non-null document amount.
    - `paymentStatus` 'open' | 'partial' | 'paid' | 'null', nullable, required: Server-owned bill rollup status; null for non-bills.
    - `uploadedAt` string, date-time, required
    - `dueDate` string, date, nullable, required
    - `sizeBytes` integer, nullable, required
    - `transactionId` string, uuid, nullable, required
    - `category` string, nullable, required
    - `docDate` string, date, nullable, required
    - `sourceProvider` string, nullable, required
    - `sourceRefs` object[], required
      - `type` string, required
      - `id` string, required
      - `label` string, nullable, required
    - `externalViewUrl` string, nullable, required
    - `hasProposedMatch` boolean, required: Derived. True when the engine has a proposed (not yet applied) match for this document. Drives the feed's "Review match" call-to-action.
    - `possibleDuplicateOf` object, nullable, required: Derived on the documents list only; null on every other response. The earliest-created live document of the same company, entity and type with the same counterparty (vendor, or customer when there is no vendor), invoice number, document date and amount. Null when this document is that earliest one, has no such twin, or is missing any of the four fields. A marker only: both documents stay listed.
      - `id` string, uuid, required
      - `name` string, required
    - `downloadUrl` string: Optional short-lived signed download authority when a file is available to the authenticated actor.

## Other responses

- `401`: Authentication required
- `403`: Insufficient permissions or not a company member
- `404`: Resource not found
- `409`: Document match conflicts with current accounting state
- `422`: Request failed validation

---

[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)
