PATCH /api/v2/orders/{id}) corrects an order you already placed: the participant’s details, the test reason, the agency and job category, the location, the package, or when the order expires. It applies the same rules as an edit made in the Origin One app. The token needs the order.update scope.
An edit that changes the order notifies the participant again and regenerates the order’s documents by default. Set
resendNotifications or reIssueDocuments to false in settings to turn either off.Send only what changes
The body is a JSON Merge Patch shaped like the order you read:- A member you leave out keeps its value.
- A member set to
nullis cleared, where the field allows it (such asparticipant.middleNameoragency). - An array replaces the whole list, except
participant.identifiers, which is merged bytype(see Identifiers).
application/merge-patch+json or application/json; both mean the same. This request fixes a misspelled last name and nothing else:
Say why the order changes
Every request carries asettings member. It says why the order changes, how a new collection site is chosen, and what to send afterwards. It is not part of the order and is never returned.
Documents and notifications go out once per request, and only when the order actually changed. They’re sent shortly after the response, not during it, and sending is retried if it fails.
What you can change
Any other member returns
400 Bad Request with the code unrecognizedKeys.
Identifiers
participant.identifiers is merged by type, not replaced:
- Each entry replaces the stored identifier of its
type. - An entry with
"value": nullremoves the identifier of thattype. - A
typeyou leave out is kept.
driverLicense with a value needs its issuingState. With order.participant.read, you can send an ssn back masked, exactly as the order returns it, and it is kept; a masked ssn that doesn’t match the stored one returns 400 Bad Request. Without that scope, a masked ssn always returns 400 Bad Request. Send the full number to change it.
order.update. Reading them back in the response needs order.participant.read, as on every order response.
The response
A successful request always returns200 OK with the up-to-date order, including when the patch changed nothing (for example, a body with only settings). The participant’s identifiers are included only when your token also has order.participant.read.
Avoid overwriting someone else’s change
Every response from Get an order and Update an order carries anETag header naming that version of the order. To change the order only if nobody else has changed it since you read it, send that value back in If-Match:
If-Matchis optional. Without it, the change applies to whatever the order holds now.- The
ETagdescribes the order as your token sees it, so use one your own token received. Another token with different scopes can get a differentETagfor the same order. - The comparison is weak: the
W/prefix is optional. - When the order has changed since that version, the response is
409 Conflictwith the codeconflictand nothing is saved. Get the order again, reapply your change, and retry with the newETag.
Errors
See Errors for the error body.
If a request fails partway
Every part of the patch is validated before anything is saved, so a400, 409, or 422 means nothing changed. The order is then saved section by section: location and package, then test reason and agency, then the participant, then the expiry. If a request fails after that (a 5xx), the sections saved before the failure stay saved, and their documents and notifications still go out.
To finish the edit, get the order, see which changes were saved, and send a patch with the rest, with the new ETag in If-Match. That patch’s settings decide whether documents and notifications go out again:
- Documents are regenerated from the order as it is when they’re sent, so they may show only the saved part. Keep
reIssueDocumentson to regenerate them from the finished order. - Set
resendNotificationstofalseif the participant shouldn’t be notified a second time.