Get started
Pagination and sorting
List endpoints return one page at a time. You choose the page and its size in the query string, and the response tells you how many rows and pages there are.
Query parameters
| Parameter | Meaning |
|---|---|
page | Page number, starting at 1. Default 1. |
pageSize | Rows per page: 10, 20 or 50. Default 10. |
sort | Field to sort by. Add - for descending, for example -createdAt. Sessions are newest first by default. |
q | Search text. Only GET /v1/flows uses it, to search flow titles. |
List response
Lists return data.list with the rows, count with the total number of rows, and page, pageSize and pageCount.
{
"response": {
"status": "success"
},
"data": {
"list": [
{
"id": "01JD7Z1W3J8X0V4Q9T6M2K5R8N",
"status": "completed"
}
],
"count": 1,
"page": 1,
"pageSize": 10,
"pageCount": 1
}
}Reading every page
Keep requesting the next page until page reaches pageCount:
async function* allSessions(status) {
for (let page = 1; ; page++) {
const res = await fetch(`https://api.myid.ir/v1/verifications?status=${status}&pageSize=50&page=${page}`, {
headers: { Authorization: `Bearer ${process.env.MYID_API_KEY}` },
});
const { data } = await res.json();
yield* data.list;
if (page >= data.pageCount) return;
}
}
for await (const session of allSessions('completed')) {
console.log(session.id, session.outcome);
}