Skip to main content
Update an order (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 null is cleared, where the field allows it (such as participant.middleName or agency).
  • An array replaces the whole list, except participant.identifiers, which is merged by type (see Identifiers).
Send the body as 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 a settings 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": null removes the identifier of that type.
  • A type you leave out is kept.
At least one identifier must remain. A 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.
Writing identifiers needs only order.update. Reading them back in the response needs order.participant.read, as on every order response.

The response

A successful request always returns 200 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 an ETag 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-Match is optional. Without it, the change applies to whatever the order holds now.
  • The ETag describes the order as your token sees it, so use one your own token received. Another token with different scopes can get a different ETag for the same order.
  • The comparison is weak: the W/ prefix is optional.
  • When the order has changed since that version, the response is 409 Conflict with the code conflict and nothing is saved. Get the order again, reapply your change, and retry with the new ETag.

Errors

See Errors for the error body.

If a request fails partway

Every part of the patch is validated before anything is saved, so a 400, 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 reIssueDocuments on to regenerate them from the finished order.
  • Set resendNotifications to false if the participant shouldn’t be notified a second time.
Sending the same patch again also works: sections that already saved are unchanged and skipped. If the rest changes the order, documents and notifications go out again unless you turn them off.