Skip to content

Upstream quirks

Facts of the NIH RePORTER API v2 that shape how the client works.

Paging and depth caps

  • Both routes page with offset and limit only. There are no cursors and no page numbers.
  • limit accepts 1 to 500; a larger value is rejected with a 400 whose body is {"message": "..."}. The API default page size is 50.
  • The offset cap differs per route: 9,999 on publications and 14,999 on projects. The API rejects a larger offset with a 400 (Requested limit exceeded. Maximum offset is 9,999.). The client raises ConfigurationError before sending such a request.
  • The documented intent is also that an offset must not exceed the total of the query. A query with a small total answers offset 0 with the matching records and is not a reliable way to detect exhaustion; iterate() stops on the first empty page.
  • Deep-offset project queries are slow. offset=14999 on the projects route repeatedly timed out client-side at 90 seconds while the same route with a filter answered in under a second. Prefer narrow filters over deep paging.

POST bodies

  • Both routes are POST searches. Filter keys travel inside criteria, while offset, limit, include_fields, exclude_fields, sort_field, and sort_order stay at the top level. The wire format is snake_case, which the API documentation uses throughout; the OpenAPI document at https://api.reporter.nih.gov/swagger/v2/swagger.json instead names the same fields camelCase and is outdated on this point.
  • Unknown criteria keys are silently ignored: {"criteria": {"bogus_field": 1}} answers 200 with the unfiltered total. A misspelled filter changes nothing instead of failing, so prefer the typed ProjectFilters and PublicationFilters.
  • Some typed criteria still 400 on bad values: a bare string in full_study_sections (the API wants objects such as {"srg_code": "SBIA"}) or an unknown funding_mechanism code.
  • On the publications route, the appl_ids criterion matches the publications of the application's whole project family. Querying one application id answered with 580 records across more than 50 core project numbers, so appl_id cannot key a batch lookup; batch_get() on publications accepts pmid and core_project_num only. Both criteria match several records per id, and records sort by coreproject desc, so the resource sends one id per request; batch_get() still returns one record per id.
  • Unknown fields raise ConfigurationError in batch_get(field=...). The API silently ignores unknown criteria keys, so sending an unmapped field would answer with unfiltered records.
  • The publications_search criterion that the OpenAPI document lists on the projects criteria is ignored by the live API under both spellings.

Field selection and sorting

  • include_fields and exclude_fields take the CamelCase property names of the routes (ApplId, ProjectNum, OrgName), while records come back with snake_case keys (appl_id, project_num, org_name).
  • sort_field and sort_order travel as two top-level keys; sort_order is asc or desc and defaults to asc.
  • The publications route answers with sort_field: coreproject and sort_order: desc when the request names no sort; the projects route answers with sort_field: null.

Response shapes

  • Every search answer is {"meta": {...}, "results": [...]}. meta.total is the full count of the query. meta.search_id and meta.properties.URL appear on project answers and reference the same search in the RePORTER web application; a top-level search_id payload key replays it.
  • Publication records carry exactly three fields with camelCase wire keys: coreproject, pmid, and applid. One PMID can appear in several records, once per linked project.
  • Project records use snake_case keys and carry dates as YYYY-MM-DDTHH:MM:SS strings; the models validate them into datetime. arra_funded and multiyear_award_flag arrive as "Y"/"N" strings and validate into bool.
  • covid_response is a string in the route documentation but arrives as a list (["Reg-CV"]) on records that have it.
  • Error bodies are {"message": "..."} objects; some validation failures answer with an HTML-escaped JSON array string inside that message.