NuGet Package Content API

The NuGet Package Content API, accessed through the PackageBaseAddress resource, allows clients to download package content files (.nupkg) and package manifests (.nuspec) from a NuGet feed. It uses a flat container structure where packages are organized by lowercase package ID and version, providing direct access to the binary package files.

OpenAPI Specification

nuget-package-content-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: NuGet Catalog Autocomplete Package Content 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: Package Content
  description: Endpoints for enumerating package versions and downloading package content files (.nupkg) and manifests (.nuspec).
paths:
  /{lowerId}/index.json:
    get:
      operationId: listPackageVersions
      summary: Enumerate package versions
      description: Lists all available versions (both listed and unlisted) of a package. The versions returned can be used to construct URLs for downloading specific package content or manifests. Returns a 404 if the package source has no versions of the provided package ID.
      tags:
      - Package Content
      parameters:
      - $ref: '#/components/parameters/LowerId'
      responses:
        '200':
          description: The list of available versions
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/VersionIndex'
        '404':
          description: No package with the given ID exists
  /{lowerId}/{lowerVersion}/{lowerId}.{lowerVersion}.nupkg:
    get:
      operationId: downloadPackage
      summary: Download package content (.nupkg)
      description: Downloads the package content file (.nupkg) for a specific package ID and version. Both the package ID and version must be lowercased and the version must be normalized according to NuGet version normalization rules.
      tags:
      - Package Content
      parameters:
      - $ref: '#/components/parameters/LowerId'
      - $ref: '#/components/parameters/LowerVersion'
      responses:
        '200':
          description: The package content binary stream
          content:
            application/octet-stream:
              schema:
                type: string
                format: binary
        '404':
          description: The package does not exist on the package source
  /{lowerId}/{lowerVersion}/{lowerId}.nuspec:
    get:
      operationId: downloadPackageManifest
      summary: Download package manifest (.nuspec)
      description: Downloads the package manifest file (.nuspec) for a specific package ID and version. The .nuspec is an XML document containing the package metadata as originally authored. Both the package ID and version must be lowercased and the version normalized.
      tags:
      - Package Content
      parameters:
      - $ref: '#/components/parameters/LowerId'
      - $ref: '#/components/parameters/LowerVersion'
      responses:
        '200':
          description: The package manifest XML document
          content:
            application/xml:
              schema:
                type: string
        '404':
          description: The package does not exist on the package source
components:
  schemas:
    VersionIndex:
      type: object
      description: A list of all available versions for a package.
      required:
      - versions
      properties:
        versions:
          type: array
          description: The lowercased, normalized version strings available for download.
          items:
            type: string
  parameters:
    LowerVersion:
      name: lowerVersion
      in: path
      required: true
      description: The package version, normalized and lowercased. SemVer 2.0.0 build metadata must be excluded.
      schema:
        type: string
    LowerId:
      name: lowerId
      in: path
      required: true
      description: The package ID, lowercased using .NET ToLowerInvariant() rules.
      schema:
        type: string
externalDocs:
  description: NuGet Catalog API Documentation
  url: https://learn.microsoft.com/en-us/nuget/api/catalog-resource