Skip to content

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.

  • Error bodies arrive with HTTP 200. An invalid parameter answers 200 with {"response": {"serviceNotification": [{"notificationCode": "AwardAPI-002", ...}]}}. Unwrapping raises APIError instead of returning an empty page, which would look like a legitimate miss.
  • There are two error codes with HTTP 200: AwardAPI-002 names the invalid parameters, and AwardAPI-004 is a fatal processing error (for example a malformed date range or an offset window past 10,000). AwardAPI-001 fires when the request carries no parameter at all; rpp alone satisfies the requirement, so a plain search() without filters works.
  • The documented rpp cap of 25 is stale. The live server accepts larger pages and clamps them silently to 3000: a request with rpp=10000 echoes rpp: 3000 in the metadata. The dialect caps page_size at 3000 client-side.
  • One query reaches at most 10,000 records. A request whose offset + rpp exceeds the window answers the AwardAPI-004 fatal error body; the last request that fits exactly (for example offset=9000&rpp=1000) succeeds. The client checks the window before sending and raises ConfigurationError; 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 on id if a strict set matters.
  • metadata.totalCount is display-capped: a broad query reports exactly 10,000 even when more records match. count() returns the cap for such queries.
  • printFields is documented as "no longer functional"; the client does not wrap field selection.
  • The sortKey values have fixed directions: startDate sorts descending, every other field ascending. A direction suffix such as awardTitle:desc is accepted and ignored.
  • The id filter takes one award number. A comma list answers with only the first id, so batch_get is disabled.
  • An unknown or malformed id in /v1/awards/{id}.json answers an empty award list with HTTP 200, not a 404. get() raises NotFoundError; exists() reads the same route because the gateway answers every HEAD with 200.
  • /v1/awards/{id}/projectoutcomes.json answers the same body as /v1/awards/{id}.json today. The outcomes report travels inside the record in projectOutComesReport.
  • The person lists (pi, fundsObligated, primaryProgram) arrive as JSON arrays; a scalar string would appear as a one-element list through the SafeList coercion.
  • The piMiddeInitial field of the wire format spells "middle" with two d's; the client maps it to pi_middle_initial.
  • jrnl carries 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}, and pgmRefsLookup/{query}/{limit}. A .json suffix 404s on these routes.
  • The limit path segment caps the answer at 300 records in the web UI.
  • orgNames maps organization codes to long names and ignores a q parameter; the full list is a few kilobytes.
  • pgmRefsLookup answered an empty list for every tested input, including documented program reference codes. The client wraps the route as a ProgramReference list; the record shape beyond the code key the web UI reads is unverified.

Facets and exports

  • GET /v2/refine returns facet buckets for a search: a JSON object keyed by filter field names such as inst.ctry_code and org_code_dir, each a list of {key, docCount}. The client exposes it as client.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-files names the files and carries a presigned download URL per file. The separate /v2/s3/download-url?filename=... route answers 404 on api.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_awards yields typed ExportAward records.

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.