Skip to content
BursaryDocs

Building a school picker

GET /v1/schools/autocomplete suggests institutions from a fragment of a name. It is the one endpoint a publishable key reaches and the one a browser can call directly. It doesn’t count against your monthly allowance on any tier.

In the developer console, create a publishable key and register the origins your page is served from, such as https://app.example.com. A request carrying the key from any other origin, or with no Origin header, is refused. So you can’t test a publishable key with curl or from a server.

Never put a secret key in a page. The other /v1 endpoints send no CORS headers, so a browser can’t call them.

GET /v1/schools/autocomplete?q=harvard&state=MA&limit=10
x-api-key: pk_live_...
Parameter Takes
q The text typed so far, up to 100 characters. It ranks from two characters, counted after punctuation is removed.
limit 1 to 20 suggestions. Defaults to 10.
state, control, level, closed, titleIv The same filters as GET /v1/schools. See Making requests.

A request needs a q that ranks or at least one filter, and answers 422 with neither. With q, suggestions are ranked by match. With filters alone, they come most recently changed first. Either way the answer is one page.

A publishable key filters as Startup at most, whatever your plan. The suggestions themselves are the same at every tier.

{
"success": true,
"data": {
"schools": [
{
"id": "019fd39c-0187-7a2e-b4c1-6f0d2e8a9b13",
"name": "Harvard University",
"city": "Cambridge",
"state": "MA",
"address": "Massachusetts Hall",
"phone": "+16174951000",
"phoneExtension": null,
"website": "https://www.harvard.edu/",
"logoUrl": null,
"faviconUrl": null,
"unitid": "166027",
"matchedName": "Harvard University",
"matchedType": "official",
"score": 1
}
]
},
"meta": { "requestId": "01K2...", "timestamp": "..." }
}
  • Show name, city, and state so people can tell campuses apart.
  • Show matchedType when it isn’t official. If someone typed an acronym or a former name, say so beside the result. matchedName and score are null on those results, as Matching and scores explains.
  • Treat a null logoUrl or faviconUrl as no image and show a placeholder. Do the same when the image fails to load. A school can have one, both, or neither.
  • Order by the response, not by score. The list is already ranked.
  • Expect matchedName, matchedType, and score all null on a request with filters and no q. Nothing was matched by name.

address, phone, and website let you show where a school is without a second request. Each is null where the institution published nothing.

When someone picks a school, store its id. Every institution has one. unitid is null for institutions with no IPEDS record, so it can’t be your key. Fetch the full record by id when you need it, with a secret key on your server.

  • Debounce. Every keystroke can be a request. The rate limit applies per key and, for a publishable key, also per visitor address. Rate limits and quotas has the numbers.
  • A 429 from the per-address limit carries no Retry-After. Wait a second or two and try again.
  • A 503 means the search index hasn’t loaded yet. It carries Retry-After. Show the field as unavailable rather than as “no results”.
  • A common word matches too much. university alone returns ten arbitrary universities. Suggest typing more of the name.

autocompleteSchools has the full schema.