Skip to main content
All InfraAudit list endpoints return paginated results. Pagination is page-based using page and pageSize (or per_page on some endpoints) query parameters. This page covers the request parameters, the response shape, and a pattern for fetching all results programmatically.

Request parameters

page
integer
default:"1"
The page number to return, 1-indexed.
pageSize
integer
default:"20"
The number of items per page. Maximum is 100. Some endpoints use per_page as an alias.
Example — request page 2 with 50 items per page:
curl "https://api.infraaudit.dev/v1/resources?page=2&pageSize=50" \
  -H "Authorization: Bearer $TOKEN"

Response format

Paginated responses wrap the result set in a data array and include a pagination or meta object:
{
  "data": [
    {
      "id": 21,
      "name": "web-server-21",
      "resource_type": "ec2_instance"
    }
  ],
  "pagination": {
    "page": 2,
    "pageSize": 50,
    "total": 234,
    "totalPages": 5
  }
}
data
array
required
The list of items for the requested page.
pagination.page
integer
required
The current page number.
pagination.pageSize
integer
required
The number of items returned on this page.
pagination.total
integer
required
The total number of items across all pages.
pagination.totalPages
integer
required
The total number of pages at the current pageSize.
Some endpoints return the pagination envelope under a meta key rather than pagination. The field names (total, page, per_page) are the same regardless of which key wraps them.

Fetch all results

To collect every item across all pages, loop until you reach the last page:
page=1
all_items="[]"

while true; do
  response=$(curl -s "https://api.infraaudit.dev/v1/resources?page=$page&pageSize=100" \
    -H "Authorization: Bearer $TOKEN")

  items=$(echo "$response" | jq '.data')
  total_pages=$(echo "$response" | jq '.pagination.totalPages')

  all_items=$(echo "$all_items $items" | jq -s 'add')

  [ "$page" -ge "$total_pages" ] && break
  page=$((page + 1))
done

echo "Total items fetched: $(echo $all_items | jq 'length')"
Use pageSize=100 (the maximum) when fetching all results to minimise the number of requests.