Skip to content

Pagination

List endpoints (such as workspaces, models, and workflows) are cursor-paginated.

Parameter Default Notes
limit 20 Page size. Minimum 1, maximum 100.
cursor Opaque cursor from the previous page’s next_cursor. Omit for the first page.
Terminal window
curl "https://api.app.layer.ai/api/v1/workspaces/$WORKSPACE_ID/models?limit=50" \
-H "Authorization: Bearer $LAYER_TOKEN"

Paginated responses wrap the items alongside a pagination object:

{
"models": [ /* … up to `limit` items … */ ],
"pagination": {
"next_cursor": "eyJvZmZzZXQiOjUwfQ",
"has_more_results": true,
"total_count": 214
}
}
Field Meaning
next_cursor Pass as cursor to fetch the next page. null on the last page.
has_more_results true if another page exists.
total_count Total number of matching items.

Keep requesting with the previous next_cursor until has_more_results is false:

Terminal window
cursor=""
while : ; do
resp=$(curl -s "https://api.app.layer.ai/api/v1/workspaces/$WORKSPACE_ID/models?limit=100&cursor=$cursor" \
-H "Authorization: Bearer $LAYER_TOKEN")
# …process resp.models…
cursor=$(echo "$resp" | jq -r '.pagination.next_cursor // empty')
[ -z "$cursor" ] && break
done