NationGraph Grants API

The Grants API from NationGraph — 7 operation(s) for grants.

OpenAPI Specification

nationgraph-grants-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: Nationgraph Accounts Grants API
  version: 0.2.36
tags:
- name: Grants
paths:
  /api/v3/grants/metadata:
    get:
      tags:
      - Grants
      summary: Get Grants Metadata
      operationId: get_grants_metadata_api_v3_grants_metadata_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GrantMetadataResponse'
      security:
      - HTTPBearer: []
  /api/v3/grants/institutions:
    get:
      tags:
      - Grants
      summary: Get Grant Institutions
      operationId: get_grant_institutions_api_v3_grants_institutions_get
      security:
      - HTTPBearer: []
      parameters:
      - name: search
        in: query
        required: true
        schema:
          type: string
          minLength: 2
          maxLength: 200
          title: Search
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GrantInstitutionOptionsResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/v3/grants/{id}:
    get:
      tags:
      - Grants
      summary: Get Grant
      operationId: get_grant_api_v3_grants__id__get
      security:
      - HTTPBearer: []
      parameters:
      - name: id
        in: path
        required: true
        schema:
          type: string
          title: Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/app__types__grant__GrantResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/v3/grants/search:
    post:
      tags:
      - Grants
      summary: Search Grants
      operationId: search_grants_api_v3_grants_search_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/app__types__grant__GrantSearchFilters'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PaginatedResponse_GrantDetailResponse_'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
      - HTTPBearer: []
  /api/v3/grants/{grant_id}/transactions:
    get:
      tags:
      - Grants
      summary: Get Grant Transactions
      operationId: get_grant_transactions_api_v3_grants__grant_id__transactions_get
      security:
      - HTTPBearer: []
      parameters:
      - name: grant_id
        in: path
        required: true
        schema:
          type: string
          format: uuid
          title: Grant Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/GrantTransactionResponse'
                title: Response Get Grant Transactions Api V3 Grants  Grant Id  Transactions Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/internal/grants/{id}:
    get:
      tags:
      - Grants
      summary: Get Grant
      operationId: get_grant_api_internal_grants__id__get
      security:
      - HTTPBearer: []
      parameters:
      - name: id
        in: path
        required: true
        schema:
          type: string
          title: Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/app__internal__types__grant__GrantResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/internal/grants/search:
    post:
      tags:
      - Grants
      summary: Search Grants
      description: 'Search grants.


        The ``query`` field accepts a websearch-style query string evaluated against

        the grant search vector (title + description, english config, stemming on).

        See GrantSearchFilters docstring for syntax.


        All filters are optional. ~1.27M rows; fully unbounded queries are fine

        for browsing (matches RFP endpoint behavior, differs from PO which

        requires bounding filters).'
      operationId: search_grants_api_internal_grants_search_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/app__internal__types__grant__GrantSearchFilters'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PaginatedResponse_GrantResponse_'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
      - HTTPBearer: []
components:
  schemas:
    GrantDetailResponse:
      properties:
        id:
          type: string
          title: Id
        title:
          type: string
          title: Title
        description:
          anyOf:
          - type: string
          - type: 'null'
          title: Description
        funding_agency:
          type: string
          title: Funding Agency
        awardee_name:
          anyOf:
          - type: string
          - type: 'null'
          title: Awardee Name
        total_obligated_amount:
          type: number
          title: Total Obligated Amount
        period_of_performance_start_date:
          anyOf:
          - type: string
            format: date
          - type: 'null'
          title: Period Of Performance Start Date
        period_of_performance_end_date:
          anyOf:
          - type: string
            format: date
          - type: 'null'
          title: Period Of Performance End Date
        last_modified_date:
          type: string
          format: date
          title: Last Modified Date
        grant_link:
          anyOf:
          - type: string
          - type: 'null'
          title: Grant Link
        outlayed_amount:
          anyOf:
          - type: number
          - type: 'null'
          title: Outlayed Amount
        external_grant_id:
          anyOf:
          - type: string
          - type: 'null'
          title: External Grant Id
        transaction_count:
          type: integer
          title: Transaction Count
          default: 1
        institution_name:
          anyOf:
          - type: string
          - type: 'null'
          title: Institution Name
        institution_state:
          anyOf:
          - type: string
          - type: 'null'
          title: Institution State
        institution_type:
          anyOf:
          - type: string
          - type: 'null'
          title: Institution Type
        institution_id:
          anyOf:
          - type: string
          - type: 'null'
          title: Institution Id
        relevance_rank:
          anyOf:
          - type: number
          - type: 'null'
          title: Relevance Rank
        score:
          anyOf:
          - type: number
          - type: 'null'
          title: Score
        relevance_score:
          anyOf:
          - type: number
          - type: 'null'
          title: Relevance Score
        decay_score:
          anyOf:
          - type: number
          - type: 'null'
          title: Decay Score
        transactions:
          items:
            $ref: '#/components/schemas/GrantTransactionResponse'
          type: array
          title: Transactions
          default: []
      type: object
      required:
      - id
      - title
      - funding_agency
      - total_obligated_amount
      - last_modified_date
      title: GrantDetailResponse
    FundingStatusEnum:
      type: string
      enum:
      - active
      - expired
      - no_funding_period
      title: FundingStatusEnum
    PaginatedResponse_GrantDetailResponse_:
      properties:
        results:
          items:
            $ref: '#/components/schemas/GrantDetailResponse'
          type: array
          title: Results
        total:
          type: integer
          title: Total
        offset:
          type: integer
          title: Offset
        limit:
          type: integer
          title: Limit
      type: object
      required:
      - results
      - total
      - offset
      - limit
      title: PaginatedResponse[GrantDetailResponse]
    GrantMetadataResponse:
      properties:
        funding_agencies:
          items:
            type: string
          type: array
          title: Funding Agencies
      type: object
      required:
      - funding_agencies
      title: GrantMetadataResponse
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    app__types__grant__GrantResponse:
      properties:
        id:
          type: string
          title: Id
        title:
          type: string
          title: Title
        description:
          anyOf:
          - type: string
          - type: 'null'
          title: Description
        funding_agency:
          type: string
          title: Funding Agency
        awardee_name:
          anyOf:
          - type: string
          - type: 'null'
          title: Awardee Name
        total_obligated_amount:
          type: number
          title: Total Obligated Amount
        period_of_performance_start_date:
          anyOf:
          - type: string
            format: date
          - type: 'null'
          title: Period Of Performance Start Date
        period_of_performance_end_date:
          anyOf:
          - type: string
            format: date
          - type: 'null'
          title: Period Of Performance End Date
        last_modified_date:
          type: string
          format: date
          title: Last Modified Date
        grant_link:
          anyOf:
          - type: string
          - type: 'null'
          title: Grant Link
        outlayed_amount:
          anyOf:
          - type: number
          - type: 'null'
          title: Outlayed Amount
        external_grant_id:
          anyOf:
          - type: string
          - type: 'null'
          title: External Grant Id
        transaction_count:
          type: integer
          title: Transaction Count
          default: 1
        institution_name:
          anyOf:
          - type: string
          - type: 'null'
          title: Institution Name
        institution_state:
          anyOf:
          - type: string
          - type: 'null'
          title: Institution State
        institution_type:
          anyOf:
          - type: string
          - type: 'null'
          title: Institution Type
        institution_id:
          anyOf:
          - type: string
          - type: 'null'
          title: Institution Id
        relevance_rank:
          anyOf:
          - type: number
          - type: 'null'
          title: Relevance Rank
        score:
          anyOf:
          - type: number
          - type: 'null'
          title: Score
        relevance_score:
          anyOf:
          - type: number
          - type: 'null'
          title: Relevance Score
        decay_score:
          anyOf:
          - type: number
          - type: 'null'
          title: Decay Score
      type: object
      required:
      - id
      - title
      - funding_agency
      - total_obligated_amount
      - last_modified_date
      title: GrantResponse
    GrantInstitutionOptionsResponse:
      properties:
        institutions:
          items:
            type: string
          type: array
          title: Institutions
      type: object
      required:
      - institutions
      title: GrantInstitutionOptionsResponse
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
            - type: string
            - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
      - loc
      - msg
      - type
      title: ValidationError
    GrantStatus:
      type: string
      enum:
      - active
      - expired
      - no_period
      title: GrantStatus
    app__internal__types__grant__GrantSearchFilters:
      properties:
        query:
          anyOf:
          - type: string
            maxLength: 2000
          - type: 'null'
          title: Query
        status:
          anyOf:
          - $ref: '#/components/schemas/GrantStatus'
          - type: 'null'
        period_start_after:
          anyOf:
          - type: string
            format: date
          - type: 'null'
          title: Period Start After
        period_end_before:
          anyOf:
          - type: string
            format: date
          - type: 'null'
          title: Period End Before
        min_amount:
          anyOf:
          - type: number
          - type: 'null'
          title: Min Amount
        max_amount:
          anyOf:
          - type: number
          - type: 'null'
          title: Max Amount
        funding_agencies:
          anyOf:
          - items:
              type: string
            type: array
          - type: 'null'
          title: Funding Agencies
        exclude_funding_agencies:
          anyOf:
          - items:
              type: string
            type: array
          - type: 'null'
          title: Exclude Funding Agencies
        institution_ids:
          anyOf:
          - items:
              type: string
            type: array
          - type: 'null'
          title: Institution Ids
        states:
          anyOf:
          - items:
              type: string
            type: array
          - type: 'null'
          title: States
        source_tables:
          anyOf:
          - items:
              type: string
            type: array
          - type: 'null'
          title: Source Tables
        sort:
          type: string
          enum:
          - last_modified_desc
          - period_end_asc
          - period_end_desc
          - amount_desc
          - relevance
          title: Sort
          default: last_modified_desc
        offset:
          type: integer
          title: Offset
          default: 0
        limit:
          type: integer
          title: Limit
          default: 100
      type: object
      title: GrantSearchFilters
      description: "Search filters for grants.\n\nThe ``query`` field accepts a websearch-style query string evaluated against\nthe ``search_vector`` column (title + description, english config — stemming\nenabled). Same syntax as RFPs:\n\n    bare words:    \"cybersecurity grant\"        implicit AND\n    quoted phrase: '\"emergency connectivity\"'   exact phrase\n    OR:            \"ESSER OR ARP\"               literal OR keyword\n    exclude:       \"covid -relief\"              prefix - to exclude\n    combined:      '\"emergency connectivity\" OR \"school safety\"'\n\nAll filters are optional. The grants table is ~1.27M rows; fully unbounded\nqueries are fine for browsing."
    PaginatedResponse_GrantResponse_:
      properties:
        results:
          items:
            $ref: '#/components/schemas/app__internal__types__grant__GrantResponse'
          type: array
          title: Results
        total:
          type: integer
          title: Total
        offset:
          type: integer
          title: Offset
        limit:
          type: integer
          title: Limit
      type: object
      required:
      - results
      - total
      - offset
      - limit
      title: PaginatedResponse[GrantResponse]
    app__types__grant__GrantSearchFilters:
      properties:
        include_words:
          anyOf:
          - items:
              type: string
            type: array
          - type: 'null'
          title: Include Words
        exclude_words:
          anyOf:
          - items:
              type: string
            type: array
          - type: 'null'
          title: Exclude Words
        keyword_logic:
          anyOf:
          - type: string
          - type: 'null'
          title: Keyword Logic
          default: OR
        title_only:
          type: boolean
          title: Title Only
          default: false
        min_amount:
          anyOf:
          - type: number
          - type: 'null'
          title: Min Amount
        max_amount:
          anyOf:
          - type: number
          - type: 'null'
          title: Max Amount
        funding_agencies_include:
          anyOf:
          - items:
              type: string
            type: array
          - type: 'null'
          title: Funding Agencies Include
        funding_agencies_exclude:
          anyOf:
          - items:
              type: string
            type: array
          - type: 'null'
          title: Funding Agencies Exclude
        funding_period_start:
          anyOf:
          - type: string
            format: date
          - type: 'null'
          title: Funding Period Start
        funding_period_end:
          anyOf:
          - type: string
            format: date
          - type: 'null'
          title: Funding Period End
        funding_statuses:
          anyOf:
          - items:
              $ref: '#/components/schemas/FundingStatusEnum'
            type: array
          - type: 'null'
          title: Funding Statuses
        selected_states:
          anyOf:
          - items:
              type: string
            type: array
          - type: 'null'
          title: Selected States
        selected_institution_types:
          anyOf:
          - items:
              type: string
            type: array
          - type: 'null'
          title: Selected Institution Types
        institutions_include:
          anyOf:
          - items:
              type: string
            type: array
          - type: 'null'
          title: Institutions Include
        offset:
          type: integer
          title: Offset
          default: 0
        limit:
          type: integer
          title: Limit
          default: 100
      type: object
      title: GrantSearchFilters
    GrantTransactionResponse:
      properties:
        id:
          type: string
          title: Id
        institution_id:
          anyOf:
          - type: string
          - type: 'null'
          title: Institution Id
        total_obligated_amount:
          type: number
          title: Total Obligated Amount
        outlayed_amount:
          anyOf:
          - type: number
          - type: 'null'
          title: Outlayed Amount
        period_of_performance_start_date:
          anyOf:
          - type: string
            format: date
          - type: 'null'
          title: Period Of Performance Start Date
        period_of_performance_end_date:
          anyOf:
          - type: string
            format: date
          - type: 'null'
          title: Period Of Performance End Date
        last_modified_date:
          anyOf:
          - type: string
            format: date
          - type: 'null'
          title: Last Modified Date
        source_url:
          anyOf:
          - type: string
          - type: 'null'
          title: Source Url
        action_type:
          anyOf:
          - type: string
          - type: 'null'
          title: Action Type
        action_type_description:
          anyOf:
          - type: string
          - type: 'null'
          title: Action Type Description
        awardee_name:
          anyOf:
          - type: string
          - type: 'null'
          title: Awardee Name
      type: object
      required:
      - id
      - institution_id
      - total_obligated_amount
      - outlayed_amount
      - period_of_performance_start_date
      - period_of_performance_end_date
      - last_modified_date
      - source_url
      - action_type
      - action_type_description
      title: GrantTransactionResponse
    app__internal__types__grant__GrantResponse:
      properties:
        id:
          type: string
          title: Id
        external_grant_id:
          anyOf:
          - type: string
          - type: 'null'
          title: External Grant Id
        title:
          anyOf:
          - type: string
          - type: 'null'
          title: Title
        description:
          anyOf:
          - type: string
          - type: 'null'
          title: Description
        funding_agency:
          anyOf:
          - type: string
          - type: 'null'
          title: Funding Agency
        awardee_name:
          anyOf:
          - type: string
          - type: 'null'
          title: Awardee Name
        awardee_state:
          anyOf:
          - type: string
          - type: 'null'
          title: Awardee State
        total_obligated_amount:
          anyOf:
          - type: number
          - type: 'null'
          title: Total Obligated Amount
        outlayed_amount:
          anyOf:
          - type: number
          - type: 'null'
          title: Outlayed Amount
        period_of_performance_start_date:
          anyOf:
          - type: string
            format: date
          - type: 'null'
          title: Period Of Performance Start Date
        period_of_performance_end_date:
          anyOf:
          - type: string
            format: date
          - type: 'null'
          title: Period Of Performance End Date
        last_modified_date:
          anyOf:
          - type: string
            format: date
          - type: 'null'
          title: Last Modified Date
        grant_link:
          anyOf:
          - type: string
          - type: 'null'
          title: Grant Link
        transaction_count:
          anyOf:
          - type: integer
          - type: 'null'
          title: Transaction Count
        source:
          anyOf:
          - type: string
          - type: 'null'
          title: Source
        created_at:
          anyOf:
          - type: string
            format: date-time
          - type: 'null'
          title: Created At
        updated_at:
          anyOf:
          - type: string
            format: date-time
          - type: 'null'
          title: Updated At
        institution_id:
          anyOf:
          - type: string
          - type: 'null'
          title: Institution Id
        institution_name:
          anyOf:
          - type: string
          - type: 'null'
          title: Institution Name
        institution_state:
          anyOf:
          - type: string
          - type: 'null'
          title: Institution State
        institution_type:
          anyOf:
          - type: string
          - type: 'null'
          title: Institution Type
        status:
          anyOf:
          - $ref: '#/components/schemas/GrantStatus'
          - type: 'null'
        days_until_end:
          anyOf:
          - type: integer
          - type: 'null'
          title: Days Until End
        relevance:
          anyOf:
          - type: number
          - type: 'null'
          title: Relevance
      type: object
      required:
      - id
      title: GrantResponse
      description: Lean grant response — drops the institution-metadata bloat from the v3 shape.
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer