NuGet Search API

The NuGet Search API allows clients to query for packages available on a NuGet package source using the SearchQueryService resource found in the service index. It supports filtering by keyword, target framework, prerelease status, and package type, and returns paginated results with package metadata including versions, descriptions, download counts, and dependency information.

OpenAPI Specification

nuget-search-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: NuGet Catalog Autocomplete Search API
  description: The NuGet Catalog API is an append-only resource that records the full history of all package events on nuget.org, including packages being added, modified, listed, unlisted, deleted, deprecated, and having vulnerability status updated. It provides a chronologically ordered log of every change to the package source, enabling consumers to build and maintain their own local copy of the entire set of packages available on nuget.org. The catalog is indexed by time and uses a hierarchical structure of index, pages, and leaves. Not all package sources implement the catalog resource.
  version: 3.0.0
  contact:
    name: NuGet Support
    url: https://github.com/NuGet/Home/issues
  termsOfService: https://www.nuget.org/policies/Terms
servers:
- url: https://api.nuget.org/v3/catalog0
  description: NuGet.org Catalog
security: []
tags:
- name: Search
  description: Search for packages by keyword, filter by various criteria, and retrieve paginated results with full package metadata.
paths:
  /query:
    get:
      operationId: searchPackages
      summary: Search for packages
      description: Queries for a page of packages matching a specified search query. Results are grouped by package ID and include metadata from the latest version. Unlisted packages never appear in search results. The base URL for this endpoint must be obtained from the service index using the SearchQueryService resource type.
      tags:
      - Search
      parameters:
      - $ref: '#/components/parameters/SearchQuery'
      - $ref: '#/components/parameters/Skip'
      - $ref: '#/components/parameters/Take'
      - $ref: '#/components/parameters/Prerelease'
      - $ref: '#/components/parameters/SemVerLevel'
      - $ref: '#/components/parameters/PackageType'
      responses:
        '200':
          description: Successful search results
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SearchResponse'
components:
  parameters:
    PackageType:
      name: packageType
      in: query
      required: false
      description: The package type name to filter results. Added in SearchQueryService/3.5.0. If empty or not provided, no filter is applied.
      schema:
        type: string
    SearchQuery:
      name: q
      in: query
      required: false
      description: The search terms used to filter packages. If not provided, all packages are returned within the boundaries of skip and take.
      schema:
        type: string
    Skip:
      name: skip
      in: query
      required: false
      description: The number of results to skip for pagination. Defaults to 0. On nuget.org, limited to 3000.
      schema:
        type: integer
        default: 0
        minimum: 0
    Take:
      name: take
      in: query
      required: false
      description: The number of results to return for pagination. The server may impose a maximum value. On nuget.org, limited to 1000.
      schema:
        type: integer
        minimum: 1
    Prerelease:
      name: prerelease
      in: query
      required: false
      description: When true, pre-release packages are included in results. Defaults to false, which excludes pre-release packages.
      schema:
        type: boolean
        default: false
    SemVerLevel:
      name: semVerLevel
      in: query
      required: false
      description: A SemVer version string used to opt-in to SemVer 2.0.0 packages. If excluded, only SemVer 1.0.0 compatible versions are returned. Use 2.0.0 to include SemVer 2.0.0 packages.
      schema:
        type: string
        example: 2.0.0
  schemas:
    SearchResult:
      type: object
      description: A search result representing a package, with metadata from the latest version.
      required:
      - id
      - version
      - versions
      - packageTypes
      properties:
        id:
          type: string
          description: The ID of the matched package.
        version:
          type: string
          description: The full SemVer 2.0.0 version string of the latest package version.
        description:
          type: string
          description: The description of the package.
        versions:
          type: array
          description: All versions of the package matching the prerelease parameter.
          items:
            $ref: '#/components/schemas/SearchResultVersion'
        authors:
          oneOf:
          - type: string
          - type: array
            items:
              type: string
          description: The author or authors of the package.
        iconUrl:
          type: string
          format: uri
          description: The URL to the package icon.
        licenseUrl:
          type: string
          format: uri
          description: The URL to the package license.
        owners:
          oneOf:
          - type: string
          - type: array
            items:
              type: string
          description: The owner or owners of the package on the package source.
        projectUrl:
          type: string
          format: uri
          description: The URL to the project page.
        registration:
          type: string
          format: uri
          description: The absolute URL to the associated registration index.
        summary:
          type: string
          description: A summary of the package.
        tags:
          oneOf:
          - type: string
          - type: array
            items:
              type: string
          description: Tags associated with the package.
        title:
          type: string
          description: The title of the package.
        totalDownloads:
          type: integer
          description: The total number of downloads across all versions.
        verified:
          type: boolean
          description: Whether the package is verified via ID prefix reservation.
        packageTypes:
          type: array
          description: The package types defined by the package author.
          items:
            $ref: '#/components/schemas/PackageType'
    SearchResultVersion:
      type: object
      description: A specific version entry within a search result.
      required:
      - '@id'
      - version
      - downloads
      properties:
        '@id':
          type: string
          format: uri
          description: The absolute URL to the associated registration leaf.
        version:
          type: string
          description: The full SemVer 2.0.0 version string.
        downloads:
          type: integer
          description: The number of downloads for this specific version.
    SearchResponse:
      type: object
      description: The response from a package search query.
      required:
      - totalHits
      - data
      properties:
        totalHits:
          type: integer
          description: The total number of matches, disregarding skip and take.
        data:
          type: array
          description: The search results matched by the request, grouped by package ID.
          items:
            $ref: '#/components/schemas/SearchResult'
    PackageType:
      type: object
      description: A package type defined by the package author.
      required:
      - name
      properties:
        name:
          type: string
          description: The name of the package type.
externalDocs:
  description: NuGet Catalog API Documentation
  url: https://learn.microsoft.com/en-us/nuget/api/catalog-resource