Skip to main content

Link Entry to Existing Document

POST 

/api/ledger/entries/:entry/relink

Re-link a voided or deleted entry to an EXISTING provider document — the replacement already re-created in the accounting provider — instead of minting a fresh one. Repoints the entry's voided link onto the chosen document in place and records it so the NEXT sync pushes an update to that existing document, never a duplicate create.

Use the candidate returned by List Relink Candidates to supply remote_type and remote_id. The action is guarded: the entry must still be voided/deleted, it must have a voided link on the given connection, and the target document must not already be linked to another entry.

Linking a document also clears any reconcile-screen dismissal recorded against it.

Authentication: Requires Bearer token.

Request body:

  • connection_id (integer, required) — the accounting connection the document belongs to.
  • remote_type (string, required) — the document kind, e.g. xero_bill, xero_invoice, qbo_bill.
  • remote_id (string, required) — the provider document identifier to adopt.
  • remote_status (string, optional) — the document's current provider status (e.g. AUTHORISED), recorded on the link.

Response: 200 with data.relink ({ relinked, status, reason }) and data.entry (the refreshed entry). When relinked is false, reason is one of not_voided, no_parked_link, or already_linked_elsewhere. Returns 404 when the entry does not exist, 422 when the body is invalid.

Requires the accounting.sync permission.

Request

Responses

OK

Response Headers
    Content-Type