Lab Orders
Function-calling namespace: labOrders
- Base URL:
https://api.aivida.in - Engine endpoint:
POST /api - Auth: Stack token middleware enabled in
optionalmode. - Send token in header:
x-stack-access-token: <access_token>(orAuthorization: Bearer <access_token>). - In
optionalmode: no token is allowed; invalid token is rejected with401.
create
Source: backend/endpoints/lab-orders/create
Input Fields
| Field | Type | Required | Constraints |
|---|---|---|---|
organizationId | string | No | - |
selectedLabId | string | No | - |
patientId | string | Yes | - |
doctorId | string | No | - |
consultationId | string | No | - |
orderId | string | No | - |
tests | array<object> | Yes | - |
status | string | Yes | - |
priority | string | Yes | - |
notes | string | No | - |
assignedTo | string | No | - |
completedAt | integer | No | unix-ms timestamp; nullable |
completedBy | string | No | - |
createdAt | integer | No | unix-ms timestamp; nullable |
updatedAt | integer | No | unix-ms timestamp; nullable |
Nested Field Structures
tests item
| Field | Type | Required | Constraints |
|---|---|---|---|
name | string | No | - |
code | string | No | - |
serviceId | string | No | - |
itemType | string | No | - |
price | number | No | - |
quantity | integer | No | - |
reviewStatus | string | No | - |
instructions | string | No | - |
status | string | No | - |
sampleCollectedAt | integer | No | unix-ms timestamp; nullable |
sampleCollectedBy | string | No | - |
sampleType | string | No | - |
processingStartedAt | integer | No | unix-ms timestamp; nullable |
processingStartedBy | string | No | - |
completedAt | integer | No | unix-ms timestamp; nullable |
completedBy | string | No | - |
isExternal | boolean | No | nullable |
externalLabName | string | No | - |
externalMarkedAt | integer | No | unix-ms timestamp; nullable |
externalResultUploadedAt | integer | No | unix-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
| Field | Type | Required | Constraints |
|---|---|---|---|
id | string | Yes | - |
organizationId | string | Yes | - |
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
| Field | Type | Required | Constraints |
|---|---|---|---|
organizationId | string | Yes | - |
page | integer | No | - |
pageSize | integer | No | - |
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
| Field | Type | Required | Constraints |
|---|---|---|---|
organizationId | string | Yes | - |
page | integer | No | - |
pageSize | integer | No | - |
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
| Field | Type | Required | Constraints |
|---|---|---|---|
id | string | Yes | - |
organizationId | string | No | - |
selectedLabId | string | No | nullable |
patientId | string | No | nullable |
doctorId | string | No | nullable |
consultationId | string | No | nullable |
orderId | string | No | nullable |
tests | array<object> | No | nullable |
status | string | No | nullable |
priority | string | No | nullable |
notes | string | No | nullable |
assignedTo | string | No | nullable |
completedAt | integer | No | unix-ms timestamp; nullable |
completedBy | string | No | nullable |
createdAt | integer | No | unix-ms timestamp; nullable |
updatedAt | integer | No | unix-ms timestamp; nullable |
Nested Field Structures
tests item
| Field | Type | Required | Constraints |
|---|---|---|---|
name | string | No | - |
code | string | No | - |
serviceId | string | No | - |
itemType | string | No | - |
price | number | No | - |
quantity | integer | No | - |
reviewStatus | string | No | - |
instructions | string | No | - |
status | string | No | - |
sampleCollectedAt | integer | No | unix-ms timestamp; nullable |
sampleCollectedBy | string | No | - |
sampleType | string | No | - |
processingStartedAt | integer | No | unix-ms timestamp; nullable |
processingStartedBy | string | No | - |
completedAt | integer | No | unix-ms timestamp; nullable |
completedBy | string | No | - |
isExternal | boolean | No | nullable |
externalLabName | string | No | - |
externalMarkedAt | integer | No | unix-ms timestamp; nullable |
externalResultUploadedAt | integer | No | unix-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": {} }