EndpointsLab Orders

Lab Orders

Function-calling namespace: labOrders

  • Base URL: https://api.aivida.in
  • Engine endpoint: POST /api
  • Auth: Stack token middleware enabled in optional mode.
  • Send token in header: x-stack-access-token: <access_token> (or Authorization: Bearer <access_token>).
  • In optional mode: no token is allowed; invalid token is rejected with 401.

create

Source: backend/endpoints/lab-orders/create

Input Fields

FieldTypeRequiredConstraints
organizationIdstringNo-
selectedLabIdstringNo-
patientIdstringYes-
doctorIdstringNo-
consultationIdstringNo-
orderIdstringNo-
testsarray<object>Yes-
statusstringYes-
prioritystringYes-
notesstringNo-
assignedTostringNo-
completedAtintegerNounix-ms timestamp; nullable
completedBystringNo-
createdAtintegerNounix-ms timestamp; nullable
updatedAtintegerNounix-ms timestamp; nullable

Nested Field Structures

tests item

FieldTypeRequiredConstraints
namestringNo-
codestringNo-
serviceIdstringNo-
itemTypestringNo-
pricenumberNo-
quantityintegerNo-
reviewStatusstringNo-
instructionsstringNo-
statusstringNo-
sampleCollectedAtintegerNounix-ms timestamp; nullable
sampleCollectedBystringNo-
sampleTypestringNo-
processingStartedAtintegerNounix-ms timestamp; nullable
processingStartedBystringNo-
completedAtintegerNounix-ms timestamp; nullable
completedBystringNo-
isExternalbooleanNonullable
externalLabNamestringNo-
externalMarkedAtintegerNounix-ms timestamp; nullable
externalResultUploadedAtintegerNounix-ms timestamp; nullable

Example Request

curl -X POST https://api.aivida.in/api \
  -H "Content-Type: application/json" \
  -H "x-stack-access-token: <access_token_optional>" \
  -d '{
  "namespace": "labOrders",
  "apiName": "create",
  "data": {
    "patientId": "patient_123",
    "tests": [
      {
        "name": "value",
        "code": "value",
        "serviceId": "service_123",
        "itemType": "general",
        "price": 1,
        "quantity": 1,
        "reviewStatus": "scheduled",
        "instructions": "value",
        "status": "scheduled",
        "sampleCollectedAt": 1710201600000,
        "sampleCollectedBy": "value",
        "sampleType": "general",
        "processingStartedAt": 1710201600000,
        "processingStartedBy": "value",
        "completedAt": 1710201600000,
        "completedBy": "value",
        "isExternal": true,
        "externalLabName": "value",
        "externalMarkedAt": 1710201600000,
        "externalResultUploadedAt": 1710201600000
      }
    ],
    "status": "scheduled",
    "priority": "value"
  }
}'

Example Response

{ "status": "ok", "data": {} }

getById

Source: backend/endpoints/lab-orders/get-by-id

Input Fields

FieldTypeRequiredConstraints
idstringYes-
organizationIdstringYes-

Example Request

curl -X POST https://api.aivida.in/api \
  -H "Content-Type: application/json" \
  -H "x-stack-access-token: <access_token_optional>" \
  -d '{
  "namespace": "labOrders",
  "apiName": "getById",
  "data": {
    "id": "id_123",
    "organizationId": "org_123"
  }
}'

Example Response

{ "status": "ok", "data": {} }

getLabReport

Source: backend/endpoints/lab-orders/get-lab-report

Input Fields

FieldTypeRequiredConstraints
organizationIdstringYes-
pageintegerNo-
pageSizeintegerNo-

Example Request

curl -X POST https://api.aivida.in/api \
  -H "Content-Type: application/json" \
  -H "x-stack-access-token: <access_token_optional>" \
  -d '{
  "namespace": "labOrders",
  "apiName": "getLabReport",
  "data": {
    "organizationId": "org_123"
  }
}'

Example Response

{ "status": "ok", "data": {} }

listByOrganization

Source: backend/endpoints/lab-orders/list-by-organization

Input Fields

FieldTypeRequiredConstraints
organizationIdstringYes-
pageintegerNo-
pageSizeintegerNo-

Example Request

curl -X POST https://api.aivida.in/api \
  -H "Content-Type: application/json" \
  -H "x-stack-access-token: <access_token_optional>" \
  -d '{
  "namespace": "labOrders",
  "apiName": "listByOrganization",
  "data": {
    "organizationId": "org_123"
  }
}'

Example Response

{ "status": "ok", "data": {} }

update

Source: backend/endpoints/lab-orders/update

Input Fields

FieldTypeRequiredConstraints
idstringYes-
organizationIdstringNo-
selectedLabIdstringNonullable
patientIdstringNonullable
doctorIdstringNonullable
consultationIdstringNonullable
orderIdstringNonullable
testsarray<object>Nonullable
statusstringNonullable
prioritystringNonullable
notesstringNonullable
assignedTostringNonullable
completedAtintegerNounix-ms timestamp; nullable
completedBystringNonullable
createdAtintegerNounix-ms timestamp; nullable
updatedAtintegerNounix-ms timestamp; nullable

Nested Field Structures

tests item

FieldTypeRequiredConstraints
namestringNo-
codestringNo-
serviceIdstringNo-
itemTypestringNo-
pricenumberNo-
quantityintegerNo-
reviewStatusstringNo-
instructionsstringNo-
statusstringNo-
sampleCollectedAtintegerNounix-ms timestamp; nullable
sampleCollectedBystringNo-
sampleTypestringNo-
processingStartedAtintegerNounix-ms timestamp; nullable
processingStartedBystringNo-
completedAtintegerNounix-ms timestamp; nullable
completedBystringNo-
isExternalbooleanNonullable
externalLabNamestringNo-
externalMarkedAtintegerNounix-ms timestamp; nullable
externalResultUploadedAtintegerNounix-ms timestamp; nullable

Example Request

curl -X POST https://api.aivida.in/api \
  -H "Content-Type: application/json" \
  -H "x-stack-access-token: <access_token_optional>" \
  -d '{
  "namespace": "labOrders",
  "apiName": "update",
  "data": {
    "id": "id_123"
  }
}'

Example Response

{ "status": "ok", "data": {} }