National Institutes of Health (NIH) Stats API

Data statistics

Operations 3

GET /stats/size Study Sizes #
GET /stats/field/values Field Values #
GET /stats/field/sizes List Field Sizes #

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/nih-stats-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Discovery needs no key. Ratings and market analysis are Pro.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

nih-stats-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: ClinicalTrials.gov REST Stats API
  description: This API is made available to provide users meta data, statistics, and the most recent version of the clinical trials available on ClinicalTrials.gov.
  version: 2.0.5
servers:
- url: https://clinicaltrials.gov/api/v2
  description: This server
tags:
- name: Stats
  description: Data statistics
paths:
  /stats/size:
    get:
      summary: Study Sizes
      description: Statistics of study JSON sizes.
      tags:
      - Stats
      operationId: sizeStats
      parameters: []
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GzipStats'
        '400':
          description: Bad Request
          content:
            text/plain:
              schema:
                $ref: '#/components/schemas/errorMessage'
  /stats/field/values:
    get:
      summary: Field Values
      description: Value statistics of the study leaf fields.
      tags:
      - Stats
      operationId: fieldValuesStats
      parameters:
      - name: types
        in: query
        style: pipeDelimited
        explode: false
        description: Filter by field types
        required: false
        schema:
          type: array
          default: []
          items:
            $ref: '#/components/schemas/FieldStatsType'
        examples:
          example1:
            value:
            - ENUM
            - BOOLEAN
          example2:
            value:
            - INTEGER
            - NUMBER
      - name: fields
        in: query
        style: pipeDelimited
        explode: false
        description: 'Filter by piece names or field paths of leaf fields.

          See [Data Structure](/data-api/about-api/study-data-structure) for the available values.


          If specified, must be non-empty comma- or pipe-separated list of fields to return.'
        required: false
        schema:
          type: array
          minItems: 1
          items:
            type: string
            pattern: ^[a-zA-Z][a-zA-Z0-9\-. ]*$
        examples:
          example1:
            value:
            - Phase
          example2:
            value:
            - Condition
            - InterventionName
          example3:
            value:
            - protocolSection.armsInterventionsModule.armGroups.interventionNames
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FieldValuesStatsList'
        '400':
          description: Bad Request
          content:
            text/plain:
              schema:
                $ref: '#/components/schemas/errorMessage'
        '404':
          description: Not Found
          content:
            text/plain:
              schema:
                $ref: '#/components/schemas/errorMessage'
  /stats/field/sizes:
    get:
      summary: List Field Sizes
      description: 'Sizes of list/array fields.


        To search studies by a list field size, use `AREA[FieldName:size]` search operator.

        For example, [AREA\[Phase:size\] 2](https://clinicaltrials.gov/search?term=AREA%5BPhase:size%5D%202)

        query finds studies with 2 phases.'
      tags:
      - Stats
      operationId: listFieldSizesStats
      parameters:
      - name: fields
        in: query
        style: pipeDelimited
        explode: false
        description: 'Filter by piece names or field paths of leaf fields.

          See [Data Structure](/data-api/about-api/study-data-structure) for the available values.


          If specified, must be non-empty comma- or pipe-separated list of fields to return.

          If unspecified, all available stats will be returned.'
        required: false
        schema:
          type: array
          items:
            type: string
            pattern: ^[a-zA-Z][a-zA-Z0-9\-. ]*$
            minLength: 1
        examples:
          example1:
            value:
            - Phase
          example2:
            value:
            - Condition
            - Intervention
          example3:
            value:
            - protocolSection.armsInterventionsModule.armGroups.interventionNames
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ListSizesList'
        '400':
          description: Bad Request
          content:
            text/plain:
              schema:
                $ref: '#/components/schemas/errorMessage'
        '404':
          description: Not Found
          content:
            text/plain:
              schema:
                $ref: '#/components/schemas/errorMessage'
components:
  schemas:
    ListSizesList:
      type: array
      items:
        $ref: '#/components/schemas/ListSizes'
    GzipStats:
      type: object
      properties:
        averageSizeBytes:
          type: integer
          format: int32
        largestStudies:
          type: array
          items:
            $ref: '#/components/schemas/StudySize'
        percentiles:
          type: object
        ranges:
          type: array
          items:
            $ref: '#/components/schemas/DistItem'
        totalStudies:
          type: integer
          format: int32
      additionalProperties: false
      required:
      - averageSizeBytes
      - largestStudies
      - percentiles
      - ranges
      - totalStudies
    FieldStatsType:
      type: string
      enum:
      - ENUM
      - STRING
      - DATE
      - INTEGER
      - NUMBER
      - BOOLEAN
    EnumStats:
      type: object
      properties:
        field:
          type: string
        missingStudiesCount:
          type: integer
          format: int32
        piece:
          type: string
        topValues:
          type: array
          items:
            $ref: '#/components/schemas/ValueCount'
        type:
          $ref: '#/components/schemas/FieldStatsType'
        uniqueValuesCount:
          type: integer
          format: int64
      additionalProperties: false
      required:
      - field
      - missingStudiesCount
      - piece
      - type
      - uniqueValuesCount
    errorMessage:
      type: string
      description: A text message describing an error
    StudySize:
      type: object
      properties:
        id:
          type: string
        sizeBytes:
          type: integer
          format: int32
      additionalProperties: false
      required:
      - id
      - sizeBytes
    ValueCount:
      type: object
      properties:
        studiesCount:
          type: integer
          format: int32
        value:
          type: string
      additionalProperties: false
      required:
      - studiesCount
      - value
    FieldValuesStatsList:
      type: array
      items:
        $ref: '#/components/schemas/FieldValuesStats'
    LongestString:
      type: object
      properties:
        length:
          type: integer
          format: int32
        nctId:
          type: string
        value:
          type: string
      additionalProperties: false
      required:
      - length
      - nctId
      - value
    BooleanStats:
      type: object
      properties:
        falseCount:
          type: integer
          format: int32
        field:
          type: string
        missingStudiesCount:
          type: integer
          format: int32
        piece:
          type: string
        trueCount:
          type: integer
          format: int32
        type:
          $ref: '#/components/schemas/FieldStatsType'
      additionalProperties: false
      required:
      - falseCount
      - field
      - missingStudiesCount
      - piece
      - trueCount
      - type
    StringStats:
      type: object
      properties:
        field:
          type: string
        longest:
          $ref: '#/components/schemas/LongestString'
        missingStudiesCount:
          type: integer
          format: int32
        piece:
          type: string
        topValues:
          type: array
          items:
            $ref: '#/components/schemas/ValueCount'
        type:
          $ref: '#/components/schemas/FieldStatsType'
        uniqueValuesCount:
          type: integer
          format: int64
      additionalProperties: false
      required:
      - field
      - missingStudiesCount
      - piece
      - type
      - uniqueValuesCount
    ListSizes:
      type: object
      properties:
        field:
          type: string
        maxSize:
          type: integer
        minSize:
          type: integer
        piece:
          type: string
        topSizes:
          type: array
          items:
            $ref: '#/components/schemas/ListSize'
        uniqueSizesCount:
          type: integer
          format: int64
      additionalProperties: false
      required:
      - field
      - piece
      - uniqueSizesCount
    DateStats:
      type: object
      properties:
        field:
          type: string
        formats:
          type: array
          items:
            type: string
        max:
          type: string
        min:
          type: string
        missingStudiesCount:
          type: integer
          format: int32
        piece:
          type: string
        type:
          $ref: '#/components/schemas/FieldStatsType'
      additionalProperties: false
      required:
      - field
      - formats
      - missingStudiesCount
      - piece
      - type
    ListSize:
      type: object
      properties:
        size:
          type: integer
        studiesCount:
          type: integer
          format: int32
      additionalProperties: false
      required:
      - size
      - studiesCount
    FieldValuesStats:
      anyOf:
      - $ref: '#/components/schemas/EnumStats'
      - $ref: '#/components/schemas/StringStats'
      - $ref: '#/components/schemas/DateStats'
      - $ref: '#/components/schemas/IntegerStats'
      - $ref: '#/components/schemas/NumberStats'
      - $ref: '#/components/schemas/BooleanStats'
    DistItem:
      type: object
      properties:
        sizeRange:
          type: string
        studiesCount:
          type: integer
          format: int32
      additionalProperties: false
      required:
      - sizeRange
      - studiesCount
    NumberStats:
      type: object
      properties:
        avg:
          type: number
          format: double
        field:
          type: string
        max:
          type: number
          format: double
        min:
          type: number
          format: double
        missingStudiesCount:
          type: integer
          format: int32
        piece:
          type: string
        type:
          $ref: '#/components/schemas/FieldStatsType'
      additionalProperties: false
      required:
      - field
      - missingStudiesCount
      - piece
      - type
    IntegerStats:
      type: object
      properties:
        avg:
          type: number
          format: double
        field:
          type: string
        max:
          type: integer
          format: int64
        min:
          type: integer
          format: int64
        missingStudiesCount:
          type: integer
          format: int32
        piece:
          type: string
        type:
          $ref: '#/components/schemas/FieldStatsType'
      additionalProperties: false
      required:
      - field
      - missingStudiesCount
      - piece
      - type
externalDocs:
  description: Introduction on clinicaltrials.gov
  url: https://clinicaltrials.gov/data-about-studies/learn-about-api