Labs
This endpoint focuses on retrieving user lab results. It supports filtering by lab metric type, startDate, and includes pagination capabilities to manage large data sets effectively.
Properties
- Name
user_id
- Type
- string
- Description
UUID of the user. This must be a valid UUID that represents the user whose workout data is being requested.
Get Lab Test Data
This endpoint allows you to retrieve lab test data for a specified user. By default, it returns lab results sorted in descending order.
Optional attributes
- Name
startDate
- Type
- string
- Description
The start date to filter the lab data. Must be in ISO 8601 format. Defaults to the earliest workout record if not provided.
- Name
type
- Type
- string
- Description
The type of lab metrics to filter by. Must be a valid lab metric. If not provided, all workout types are returned.
- Name
sort
- Type
- string
- Description
Specifies the sort order of the lab data, either
asc
for ascending ordesc
for descending. Defaults to descending if not provided.
- Name
page
- Type
- integer
- Description
The page number of results to return. Must be an integer greater than 0. Defaults to 1.
- Name
pageSize
- Type
- integer
- Description
The number of results per page. Must be an integer between 1 and 10,000. Defaults to 1,000.
Request
curl -G https://api.onetwentyone.ai/api/v1/labs/user/123e4567-e89b-12d3-a456-426614174000 \
-H "Authorization: Bearer {token}" \
-d startDate="2022-01-01" \
-d type="serumALT" \
-d sort="asc" \
-d page=1 \
-d pageSize=3
Response
{
"pagination": {
"current_page": 1,
"has_more": true,
"next_page": "/api/labs/user/123e4567-e89b-12d3-a456-426614174000?date=2022-01-01&type=serumALT&page=2&pageSize=3",
"prev_page": null
},
"data": [
{
"display_name": "ALT",
"fhir_id": "id1h3Z62DlZuq9Z8I4s9rA",
"user_id": "123e4567-e89b-12d3-a456-426614174000",
"loinc": "1742-6",
"unit_string": "U/L",
"value": 22,
"lab_metric": "serumALT",
"sample_type": "http://loinc.org",
"date": "2022-01-01T09:15:00+00:00"
},
{
"display_name": "ALT",
"fhir_id": "0b4sGHn2H2jvDcFWp8N7XQ",
"user_id": "123e4567-e89b-12d3-a456-426614174000",
"loinc": "1742-6",
"unit_string": "U/L",
"value": 18,
"lab_metric": "serumALT",
"sample_type": "http://loinc.org",
"date": "2022-01-12T14:45:00+00:00"
},
{
"display_name": "ALT",
"fhir_id": "6g9Z4XwEkvHBAFthKjs9kA",
"user_id": "123e4567-e89b-12d3-a456-426614174000",
"loinc": "1742-6",
"unit_string": "U/L",
"value": 19,
"lab_metric": "serumALT",
"sample_type": "http://loinc.org",
"date": "2022-01-22T18:30:00+00:00"
}
]
}