Upstream quirks
This page lists where the live NSF services behave differently from their documentation. The references are the v1 award API documentation and the award search web application at https://www.nsf.gov/awardsearch, whose JavaScript bundle declares the v2 lookup routes. Where a quirk affects bibliofabric.nsfawards, the behavior of the client is noted.
The v1 award search
- Error bodies arrive with HTTP 200. An invalid parameter answers 200 with
{"response": {"serviceNotification": [{"notificationCode": "AwardAPI-002", ...}]}}. Unwrapping raisesAPIErrorinstead of returning an empty page, which would look like a legitimate miss. - There are two error codes with HTTP 200:
AwardAPI-002names the invalid parameters, andAwardAPI-004is a fatal processing error (for example a malformed date range or an offset window past 10,000).AwardAPI-001fires when the request carries no parameter at all;rppalone satisfies the requirement, so a plainsearch()without filters works. - The documented
rppcap of 25 is stale. The live server accepts larger pages and clamps them silently to 3000: a request withrpp=10000echoesrpp: 3000in the metadata. The dialect capspage_sizeat 3000 client-side. - One query reaches at most 10,000 records. A request whose
offset + rppexceeds the window answers theAwardAPI-004fatal error body; the last request that fits exactly (for exampleoffset=9000&rpp=1000) succeeds. The client checks the window before sending and raisesConfigurationError;iterate()uses pages of 2500 so the walk ends on a clean boundary. - Offset paging reads a live, changing index. A walk of 7,737 records for one query saw six ids twice: records that shifted between page requests repeat.
iterate()does not deduplicate; dedupe onidif a strict set matters. metadata.totalCountis display-capped: a broad query reports exactly 10,000 even when more records match.count()returns the cap for such queries.printFieldsis documented as "no longer functional"; the client does not wrap field selection.- The
sortKeyvalues have fixed directions:startDatesorts descending, every other field ascending. A direction suffix such asawardTitle:descis accepted and ignored. - The
idfilter takes one award number. A comma list answers with only the first id, sobatch_getis disabled. - An unknown or malformed id in
/v1/awards/{id}.jsonanswers an empty award list with HTTP 200, not a 404.get()raisesNotFoundError;exists()reads the same route because the gateway answers everyHEADwith 200. /v1/awards/{id}/projectoutcomes.jsonanswers the same body as/v1/awards/{id}.jsontoday. The outcomes report travels inside the record inprojectOutComesReport.- The person lists (
pi,fundsObligated,primaryProgram) arrive as JSON arrays; a scalar string would appear as a one-element list through theSafeListcoercion. - The
piMiddeInitialfield of the wire format spells "middle" with two d's; the client maps it topi_middle_initial. jrnlcarries the award's linked publications as objects (title, authors, journal year, pages), not the plain string the XML documentation shows.
The v2 lookup routes
- The lookup routes are not in the v1 documentation. They are declared by the award search web application and served from the same host under
/services/v2/:orgNames,states,countries,instruments,congDistCodeByState/{state},piLookup/{query}/{limit},institutionsLookup/{query}/{limit},programsLookup/{query}/{limit},pgmElesLookup/{query}/{includeAdmin}/{limit}, andpgmRefsLookup/{query}/{limit}. A.jsonsuffix 404s on these routes. - The
limitpath segment caps the answer at 300 records in the web UI. orgNamesmaps organization codes to long names and ignores aqparameter; the full list is a few kilobytes.pgmRefsLookupanswered an empty list for every tested input, including documented program reference codes. The client wraps the route as aProgramReferencelist; the record shape beyond thecodekey the web UI reads is unverified.
Facets and exports
GET /v2/refinereturns facet buckets for a search: a JSON object keyed by filter field names such asinst.ctry_codeandorg_code_dir, each a list of{key, docCount}. The client exposes it asclient.awards.refine(query=...); the filters travel as raw query parameters under the v2 field names.- The fiscal-year exports moved from
download.jsp(now a redirect to the search UI) to an S3 bucket.GET /v2/s3/list-filesnames the files and carries a presigned download URL per file. The separate/v2/s3/download-url?filename=...route answers 404 onapi.nsf.gov; the client uses the URLs from the listing. - A historical year zip is a few kilobytes; recent years are over 150 MB. Each archive holds one JSON file per award with a snake_case schema that differs from the v1 API records; the reader
iter_export_awardsyields typedExportAwardrecords.
Rate limits
No NSF page publishes a rate limit for these APIs. bibliofabric.nsfawards defaults to 2 requests per second and a concurrency of 2 out of courtesy.