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
- 200
- 401
- 403
- 404
- 422
- 429
OK
Response Headers
Unauthenticated — the bearer token is missing, revoked, expired, or malformed. Never retry automatically; fix the credential. See the Errors guide.
Forbidden — the token lacks a required scope, the endpoint is not available to API tokens, or the user behind the token lacks the permission. A human must adjust the token scopes or user permissions; do not retry.
Not found — no record with the given identifier (or the route does not exist). Verify the ID before retrying.
Validation failed — the body is a field → messages map (Laravel shape) or the platform envelope with a stable machine-readable code. Fix the payload and resubmit.
Rate limited — platform limit is 1,000 requests/min; individual tokens may carry lower limits. Honor the Retry-After header before retrying. See the Rate Limits guide.