Skip to main content

Order and cancel pathology requests

Order a request​

POST /api/v1/marketplace/requests

Example: Order a pathology request
Request
POST /api/v1/marketplace/requests HTTP/1.1
Host: api.onearly.com
Authorization: Bearer oe_sk_live_au_8b2e4d6f0a1c3e5b7d9f1a2c4e6b8d0f
Content-Type: application/json

{
"externalId": "pms_req_20261124_0001",
"title": "Blood tests",
"group": {
"name": "Example Physio",
"externalId": "pms_group_123"
},
"requester": {
"externalId": "pms_requester_456",
"name": "Jane Smith",
"providerNumber": "2429591X"
},
"subject": {
"email": "bob.smith@example.com",
"mobilePhone": "+61400000000",
"name": "Bob Smith",
"dateOfBirth": "1988-10-10",
"externalId": "pms_subject_789"
},
"services": [
{
"slug": "full-blood-count",
"title": "FBC"
}
],
"attachments": [
{
"label": "Clinical notes",
"value": "Fatigue for six weeks. Query iron deficiency."
}
]
}
Response
HTTP/1.1 201 Created
Content-Type: application/json

{
"nodeLineageUuid": "ffce4630-e0ad-4481-b2f8-a59bbb1f49e7",
"kind": "pathology",
"schemaVersion": "1",
"title": "Full Blood Count (FBC) pathology request",
"category": "MARKETPLACE",
"group": {
"name": "Example Physio",
"externalId": "pms_group_123"
},
"externalId": "pms_req_20261124_0001",
"requester": {
"externalId": "pms_requester_456",
"name": "Jane Smith",
"providerNumber": "2429591X"
},
"attachments": [],
"files": [],
"bookings": [],
"services": [
{
"uuid": "324dd2ff-31d1-5318-a7c7-40b4604783a1",
"slug": "full-blood-count",
"title": "Full Blood Count (FBC)",
"description": "Blood test: Full blood count (FBC).",
"category": "pathology",
"status": "ACTIVE",
"benefitEligibility": "no"
}
],
"status": "created",
"createdAt": "2026-11-24T05:45:53.994Z",
"steps": [],
"subjectResolution": {
"outcome": "matched_existing",
"matchedBy": "email",
"identifierPriority": [
"mobilePhone",
"email"
]
}
}
FieldRequiredNotes
titleYesUp to 500 characters. Required but not shown: the request is named after its tests, from the catalogue.
groupYesThe clinic or site in your system that is ordering: name (up to 200 characters) and optional externalId
subjectYesThe patient. At least one of email or mobilePhone. See Who the patient is.
servicesYes1 to 100 tests, each with slug (an ACTIVE pathology catalogue slug, such as full-blood-count) and title. title is required but replaced by the catalogue's title, which is what the patient and doctor see.
externalIdNoYour id for the request, echoed on the response. Not used to de-duplicate: see the warning below.
requesterNoThe practitioner ordering: externalId, name, providerNumber
attachmentsNo1 to 50 clinical notes for the reviewing OnEarly doctor, each with a label, a value or both. Not shown to the patient. Omit the field rather than sending an empty list.
performAsNo{ "principalType": "GROUP", "actorUuid": "<your group>" }. It must name the key's own group, or the create answers 403. Omit it to order as the key's group.
shareWithNoemail or mobilePhone: share the request through that identifier only, which must be given. Omit it to use both.

Every service must be an ACTIVE pathology catalogue row; see Choose tests. A slug that is unknown or not ACTIVE is refused with 404 NOT_FOUND (Service not found: <slug>). An ACTIVE row from another category, such as an imaging service, is refused with 400 VALIDATION_ERROR.

A successful create answers 201 with the request in the same shape as a path workflow, with kind set to pathology. Keep nodeLineageUuid: every other pathology route takes it. status is created and steps is empty. Read progress from …/progress instead.

Don't retry a create blindly

Sending the same create twice orders the tests twice. A 201 means the request exists. If a create times out with no response, list your requests and check the newest createdAt values before sending again. The list doesn't carry externalId.

Who the patient is​

OnEarly looks up both subject.email and subject.mobilePhone, or only the shareWith identifier when you send shareWith.

  • If one identifier matches an account, the request goes to that account. No second account is made for an identifier that matches nothing.
  • If neither identifier matches an account, OnEarly creates one for the patient. The create is refused instead when the identifiers belong to someone whose account is in another region (code INVITE_NOT_SENT, which currently arrives with HTTP status 500) or to a deleted account (404 NOT_FOUND).
  • If the two identifiers belong to two different accounts, subject.identifierPriority decides which one wins (default ["mobilePhone", "email"]). The other identifier is dropped and never used to contact anyone.
  • The patient is never added to your group or invited into it. The request is shared with their account directly.
  • shareWith limits the lookup, any new account and the sharing to that one identifier.

mobilePhone must be in E.164 format, such as +61412345678. Send name and dateOfBirth (YYYY-MM-DD) where you hold them.

The create response includes subjectResolution, which you can't fetch later:

FieldMeaning
outcomematched_existing (an existing account was used) or created_new
matchedByemail or mobilePhone, when outcome is matched_existing
identifierPriorityThe order actually applied
discardedIdentifierPresent only when the two identifiers belonged to different people. Check for it and follow up with the patient.

List requests​

GET /api/v1/marketplace/requests

Your group's requests, newest first.

ParameterNotes
limit1 to 100, default 25
afterpageInfo.endCursor from the previous page

A page can hold fewer than limit requests even when more follow, so keep following pageInfo.endCursor while pageInfo.hasNextPage is true.

Example: List pathology requests
Request
GET /api/v1/marketplace/requests?limit=25 HTTP/1.1
Host: api.onearly.com
Authorization: Bearer oe_sk_live_au_8b2e4d6f0a1c3e5b7d9f1a2c4e6b8d0f
Response
HTTP/1.1 200 OK
Content-Type: application/json

{
"requests": [
{
"nodeLineageUuid": "ffce4630-e0ad-4481-b2f8-a59bbb1f49e7",
"kind": "pathology",
"requestRecordUuid": "ffce4630-e0ad-4481-b2f8-a59bbb1f49e7",
"pathologyRequestAuUuid": "ffce4630-e0ad-4481-b2f8-a59bbb1f49e7",
"createdAt": "2026-11-24T05:45:53.994Z",
"requestingGroup": {
"actorUuid": "2a4b6c8d-0e1f-4a2b-9c3d-4e5f6a7b8c02",
"name": "Example Physio"
},
"subjectActorUuid": "3b5c7d9e-1f2a-4b3c-8d4e-5f6a7b8c9d03",
"resultsStored": 1
}
],
"pageInfo": {
"endCursor": "eyJjcmVhdGVkQXQiOiIyMDI2LTExLTI0In0",
"hasNextPage": false
}
}

Each item in requests[]:

FieldNotes
nodeLineageUuidThe request's id, for every other pathology route
kindpathology, or radiology for an imaging request ordered under your group in OnEarly
requestRecordUuidThe request's own record. The id named in some error messages. For a request made through this API it is the same as nodeLineageUuid.
pathologyRequestAuUuidDeprecated. The same id as requestRecordUuid.
createdAtWhen the request was ordered
requestingGroupactorUuid and name of the group it was ordered under
subjectActorUuidThe patient's account, or null when they have none
resultsStoredHow many lab results are stored. A count only: read them from …/results.

Cancel a request​

DELETE /api/v1/marketplace/requests/{nodeLineageUuid}

Cancelling deletes the request for everyone, with its Doctor Review and the patient's access to it. It answers 204 with no body.

You can cancel only while no doctor has given a verdict and nothing has started on the request: the patient hasn't chosen a collection centre, given a Medicare card or paid, and no referral has gone to the lab and no results have arrived. Check ahead of time with canDelete on …/summary. It is read without locks, so the cancel itself can still be refused.

After that point the cancel answers 409 with code CONFLICT, and metadata.reason says why: reviewed (a doctor has given a verdict) or started (one of those steps has happened). A 409 with no metadata means the request changed while it was being cancelled; try again.

Example: Cancel a request a doctor has reviewed
Request
DELETE /api/v1/marketplace/requests/ffce4630-e0ad-4481-b2f8-a59bbb1f49e7 HTTP/1.1
Host: api.onearly.com
Authorization: Bearer oe_sk_live_au_8b2e4d6f0a1c3e5b7d9f1a2c4e6b8d0f
Response
HTTP/1.1 409 Conflict
Content-Type: application/json

{
"error": true,
"message": "Pathology request ffce4630-e0ad-4481-b2f8-a59bbb1f49e7 has been reviewed by a doctor and can no longer be deleted",
"code": "CONFLICT",
"metadata": {
"reason": "reviewed"
}
}