Re-optimise a queued assignment now (ReoptimiseAssignment)
POST/assignments/:assignmentId/reoptimisations
Re-runs the candidate search (AssignmentCost = legs + crossRegionPenalty + scorecardPenalty + bookPressurePenalty, ties to the witness node) over the current read models, skipping excluded nodes and any candidate whose eta is after deliverByLatest. Allowed only while QUEUED. If the best node changes the assignment moves (FulfillmentReassigned is published) and releaseAt follows the new candidate (VirtualQueue); if no candidate is left the assignment becomes UNSOURCEABLE at once (FulfillmentUnsourceable, gap G26). A repeat on unchanged read models changes nothing. A retry with the same Idempotency-Key replays the stored response for 24 hours when it is final (a 200, malformed-request or assignment-locked); a refusal that state can still change is not stored and the retry runs again. The same key with another request is 409 idempotency-key-reused.
Request
Responses
- 200
- 400
- 404
- 405
- 409
- 422
- 500
The assignment after re-optimisation (unchanged if the best candidate is the current one). A replay of the first answer carries Idempotency-Replayed: true (a stored 2xx is replayed; a 5xx and a refusal that releases the key are never stored).
Response Headers
Present, with the value true, only when the response is a replay of the first answer.
idempotency-key-required (no Idempotency-Key header) or idempotency-key-invalid (not 1 to 128 printable ASCII characters), or malformed-request (the body is not valid JSON, has a field other than assignmentVersion, has trailing data after the JSON value, or carries a NUL character).
not-found (ErrNotFound), no assignment has that id; or resource-not-found (the path contains a NUL character).
Response Headers
Present, with the value true, only when the response is a replay of the first answer.
method-not-allowed, the method is not served on this path.
assignment-locked (ErrAssignmentLocked), release-in-flight (ErrReleaseInFlight), node-excluded (ErrNodeExcluded), stale-assignment-version (ErrStaleAssignmentVersion), illegal-transition (ErrIllegalTransition, the assignment is UNSOURCEABLE or CANCELLED), concurrent-update (ErrConcurrentUpdate), or idempotency-key-reused (the Idempotency-Key was already used with a different request). Only assignment-locked is stored and replayed; the other refusals release the key, so a retry under the same Idempotency-Key runs again.
Response Headers
Present, with the value true, only when the response is a replay of the first answer.
candidate-breaks-promise (ErrCandidateBreaksPromise), or validation-failed (ErrValidation), a negative assignmentVersion. Neither is stored: the key is released and a retry runs again.
Response Headers
Present, with the value true, only when the response is a replay of the first answer.
internal-error, an unexpected failure (the detail never carries the internal message).