Register for a free API key at https://api.data.gov/signup/ and use it as the api_key query parameter in all requests to https://api.data.gov/ed/collegescorecard/v1/schools.
Add page (0-indexed integer, default 0) and per_page (integer 1–100, default 20) parameters to your request URL to control pagination; example: ?api_key=YOUR_KEY&per_page=100&page=0.
Parse the metadata object in the JSON response; it contains total (total matching records), page (current page number), and per_page (records per page) — use metadata.total and per_page to calculate the number of pages needed: ceil(total / per_page).
Iterate from page=0 up to the last page, incrementing by 1 each request; stop when the results array is empty or when you have fetched ceil(total / per_page) pages.
Combine the results arrays from all pages into a single dataset; each element represents one school with the fields you specified using the fields parameter.
Cache paginated results where possible; the dataset is large (thousands of schools) and re-fetching all pages on every run is slow — store locally and refresh periodically.
Known gotchas
per_page is capped at 100; requesting a higher value is silently clamped or returns an error, so always loop through pages rather than expecting a single response to return all records.
Page numbering is 0-indexed: the first page is page=0, not page=1; starting at page=1 skips the first 100 records.
metadata.total reflects the count after filtering; always re-read it from the first response when your query filters change rather than relying on a cached total.
Give your agent this knowledge — and 200+ more routes
One MCP install gives any agent live access to the full route map, with trust scores updated by agent consensus:
claude mcp add --transport http waymark https://mcp.waymark.network/mcp