Resync Vendor Deposit with Milestone
POST/api/purchase-orders/:purchase_order/expected-vendor-deposit-milestones/:milestoneKey/resync-deposit
Resolve an out-of-sync schedule milestone by realigning its linked vendor deposit with the milestone's current state — the one-click alternative to deleting and recreating the deposit.
Behavior depends on the deposit's progress: draft / pending-approval deposits are fully realigned (amount and due date update to the milestone's current expectation, and the stored schedule link refreshes); approved / paid / partially-applied deposits have a locked amount, so the resync acknowledges the schedule change (due date + schedule link refresh) while the amount stays as recorded — any under-funding remains visible in the cash-flow shortfall report.
Returns the resynced deposit plus the purchase order's refreshed milestone list. 404 when the milestone key is unknown; 422 when the milestone has no linked deposit, is already in sync, or the deposit is in a terminal state (cancelled, void, refunded, written off).
Direction (mode, optional): realign overwrites the deposit's amount/due date with the schedule's current expectation; keep_amount keeps the recorded amount and only refreshes the due date + frozen schedule snapshot so the milestone stops flagging. When omitted, the server picks the safe default by amount authorship: a deposit whose amount still equals its own frozen snapshot is system-authored → realign; a manually recorded deposit (no snapshot) or a draft whose amount was edited after creation is user-authored → keep_amount (the deposit is the definitive document). Locked non-terminal deposits always acknowledge only (amount never changes); terminal deposits are refused. The milestone list response includes linked_vendor_deposit_amount_is_user_authored (boolean) so clients can present the right default.
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.