Skip to main content

Pagination

All list endpoints in the Patholytix API return paginated results. This guide explains the pagination parameters and response format.

Request parameters

ParameterTypeDefaultDescription
pageNumberinteger11-based page number. Page 1 is the first page. Maximum 100 items per page.
pageSizeinteger25Number of items per page (max 100).
sortstringvariesSort field. Valid values are documented per endpoint.
sortDirectionstringASCASC for ascending, DESC for descending.

Response format

All list endpoints return a paging envelope:

{
"paging": {
"pageNumber": 1,
"pageSize": 25,
"totalItems": 143,
"links": {
"next": "/api/v1/studies?pageNumber=2&pageSize=25",
"prev": null
}
},
"items": [ ... ]
}
FieldTypeDescription
paging.pageNumberintegerThe current page (1-based)
paging.pageSizeintegerThe page size used for this response
paging.totalItemsintegerTotal number of matching items across all pages
paging.links.nextstring | nullURL of the next page, or null if this is the last page
paging.links.prevstring | nullURL of the previous page, or null if this is the first page
itemsarrayThe items on this page

Worked example

List studies — first page of 25:

curl "https://api.dev2.patholytix.com/api/v1/studies?pageNumber=1&pageSize=25" \
-H "Authorization: Bearer YOUR_TOKEN"

Response:

{
"paging": {
"pageNumber": 1,
"pageSize": 25,
"totalItems": 60,
"links": {
"next": "/api/v1/studies?pageNumber=2&pageSize=25",
"prev": null
}
},
"items": [
{
"studyId": "5cd97ae75fdbf7000143cb30",
"name": "Phase II Oncology Study"
}
]
}

Get the next page using the next link:

curl "https://api.dev2.patholytix.com/api/v1/studies?pageNumber=2&pageSize=25" \
-H "Authorization: Bearer YOUR_TOKEN"

Iterating all pages

Use paging.links.next to detect when to stop — it is null on the last page.

import requests

def get_all_studies(token: str) -> list:
base_url = "https://api.dev2.patholytix.com/api"
headers = {"Authorization": f"Bearer {token}"}
page = 1
page_size = 100
all_items = []

while True:
resp = requests.get(
f"{base_url}/v1/studies",
params={"pageNumber": page, "pageSize": page_size},
headers=headers,
)
resp.raise_for_status()
data = resp.json()

all_items.extend(data["items"])

if data["paging"]["links"].get("next") is None:
break

page += 1

return all_items

Sorting

All list endpoints support sorting via sort and sortDirection. Valid sort values differ per endpoint — check the API Reference for the full list.

Studies:

sort valueDescription
createdDateSort by creation timestamp (default)
studyNameSort by study name
updatedDateSort by last update timestamp

Subjects:

sort valueDescription
createdDateSort by creation timestamp (default)
nameSort alphabetically by subject name (SUBJID)
updatedDateSort by last update timestamp

Organs:

sort valueDescription
createdDateSort by creation timestamp (default)
nameSort alphabetically by organ name (MISPEC)
updatedDateSort by last update timestamp
# Most recently updated studies first
curl "https://api.dev2.patholytix.com/api/v1/studies?sort=updatedDate&sortDirection=DESC" \
-H "Authorization: Bearer YOUR_TOKEN"

Page size limits

The maximum pageSize per request is 100. Requests exceeding this limit will receive a 400 Bad Request response.