Skip to content
medgridehr.comRequest a Demo

Pagination

List endpoints for patients and prescriptions use cursors:

Parameter Description
limit 1 to 200. Default 50.
cursor Pass the previous response’s nextCursor.
updatedSince ISO 8601 timestamp. Only rows changed after it.

Results are ordered by updatedAt ascending, then by id. A response looks like:

{ "data": [ … ], "nextCursor": "clx9…" }

nextCursor is null on the last page.

Iterating all pages

let cursor = null;
do {
const url = new URL("https://ehr.medgrid.com/api/v1/patients");
url.searchParams.set("limit", "200");
if (cursor) url.searchParams.set("cursor", cursor);
const res = await fetch(url, { headers: { Authorization: `Bearer ${KEY}` } });
const { data, nextCursor } = await res.json();
// process data…
cursor = nextCursor;
} while (cursor);

GET /api/v1/prescribers is not paginated; it returns every provider in the clinic.

Was this page helpful?