Pagination
List endpoints (such as workspaces, models, and workflows) are cursor-paginated.
Request
Section titled “Request”| 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. |
curl "https://api.app.layer.ai/api/v1/workspaces/$WORKSPACE_ID/models?limit=50" \ -H "Authorization: Bearer $LAYER_TOKEN"Response envelope
Section titled “Response envelope”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. |
Iterating
Section titled “Iterating”Keep requesting with the previous next_cursor until has_more_results is false:
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" ] && breakdone