*MCP › Reference › Finance › Treasury*

# Link a payment to a document

> Ties an already recorded payment to the invoice, credit note, quote, proforma or purchase order it settles.

It is a plural sub-resource because a payment can end up tied to several documents. Returns the full payment, with `linkedDocuments` as they now stand, the same projection as its GET.

TOOL `filmo_treasury_payments_link` · `treasury:write` · 120/min

## Arguments

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `paymentId` | string | Yes | Treasury payment identifier. |
| `linkedDocumentType` | string | Yes | Type of the document the payment is linked to. `invoice`, `creditNote`, `supplierInvoice`, `quote`, `proforma`, `salesReceipt`, `simpleCreditNote`, `purchaseOrder` |
| `linkedDocumentId` | string | Yes | Document the payment is linked to. |
| `idempotencyKey` | string | No | Idempotency key chosen by the client (a UUID is recommended). Repeating the same key with the same arguments within 24 h returns the stored response without executing again; with different arguments it responds 422. It is the safe way to retry after a network failure. |
| `ifMatch` | string | No | Optimistic locking: the meta.etag you got from the detail read of this resource (or "*"). If the resource changed since, the call fails with 412 precondition_failed before writing anything; read it again and retry. Omit it to write unconditionally. |

## Result

On success the result carries `structuredContent` with `data` and `meta`. These are the attributes of `data`.

| Name | Type | Description |
| --- | --- | --- |
| `id` | string | Payment identifier. |
| `direction` | string | in when money comes in (a collection) and out when it goes out (a payment). |
| `amount` | string | Payment amount as a decimal string, in the indicated currency. |
| `currency` | string | Payment currency, as an ISO 4217 code. |
| `date` | string<date-time> | Payment date in ISO 8601 UTC. |
| `type` | string | normal, or deposit when it is an advance payment. |
| `treasuryAccountId` | string | Treasury account the payment goes through. |
| `contactId` | string | Customer or supplier of the payment; null if not declared. |
| `reference` | string | External reference of the payment; null if it has none. |
| `linkedDocuments` | object[] | Documents the payment is assigned to; empty if it is not linked to any. |
| `linkedDocuments.type` | string | Kind of the linked document. `invoice`, `creditNote`, `supplierInvoice`, `quote`, `proforma`, `salesReceipt`, `simpleCreditNote`, `purchaseOrder` |
| `linkedDocuments.id` | string | Identifier of the linked document. |
| `linkedDocuments.amount` | string | Amount of this payment assigned to the document, as a decimal string. |
| `createdAt` | string<date-time> | Creation date in ISO 8601 UTC. |
| `updatedAt` | string<date-time> | Last modification date in ISO 8601 UTC. |

*Call · filmo_treasury_payments_link*

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "filmo_treasury_payments_link",
    "arguments": {
      "paymentId": "paym_8f2a1c",
      "linkedDocumentType": "invoice",
      "linkedDocumentId": "https://example.com"
    }
  }
}
```

*Result (generated from the schema)*

```json
{
  "structuredContent": {
    "data": {
      "id": "id_8f2a1c",
      "direction": "<direction>",
      "amount": "1234.50",
      "currency": "EUR",
      "date": "2026-09-01T08:00:00Z",
      "type": "<type>",
      "treasuryAccountId": "trea_8f2a1c",
      "contactId": "cont_8f2a1c",
      "reference": "<reference>",
      "linkedDocuments": [
        {
          "type": "invoice",
          "id": "id_8f2a1c",
          "amount": "1234.50"
        }
      ],
      "createdAt": "2026-09-01T08:00:00Z",
      "updatedAt": "2026-09-01T08:00:00Z"
    },
    "meta": {
      "idempotencyKey": "<the key you sent, or the one the server generated>",
      "rateLimit": {
        "limit": 120,
        "remaining": 119,
        "reset": 42
      }
    }
  }
}
```

## The same operation by REST

This tool runs [`POST /api/v1/treasury/payments/{paymentId}/links`](https://docs.filmo.io/rest-api/endpoint-reference/treasury/link-a-payment-to-a-document).

---

Canonical URL: https://docs.filmo.io/mcp/tools/treasury/filmo-treasury-payments-link  
Last updated: 2026-10-25