Skip to main content
The source add command adds a new package source to WinGet’s configuration.

Syntax

winget source add --name <name> [options]

Required Options

-n, --name
string
required
Name for the source (must be unique)

Source Configuration

-a, --arg
string
Source URL or path. Required for most source types.
-t, --type
string
Source type: Microsoft.PreIndexed.Package (default), Microsoft.Rest, Microsoft.PreIndexed.Zip
--trust-level
string
Trust level: None (default) or Trusted
--explicit
flag
Mark source as explicit (won’t be used in default searches)
-p, --priority
number
Source priority (lower number = higher priority). Default: 0

Authentication

--header
string
Custom HTTP header for authentication (format: “Name: Value”)
--accept-source-agreements
flag
Accept source agreements without prompting

Examples

Add a basic custom source:
winget source add --name Contoso --arg https://packages.contoso.com/manifest --type Microsoft.PreIndexed.Package
Add source with authentication:
winget source add --name PrivateSource --arg https://private.company.com --header "Authorization: Bearer eyJ0..."
Add trusted source:
winget source add --name TrustedSource --arg https://trusted.example.com --trust-level Trusted
Add explicit source (opt-in only):
winget source add --name ExplicitSource --arg https://explicit.example.com --explicit
Add source with priority:
winget source add --name HighPriority --arg https://priority.example.com --priority 1
Add local source from ZIP:
winget source add --name LocalSource --arg C:\Sources\index.zip --type Microsoft.PreIndexed.Zip

Source Types

Microsoft.PreIndexed.Package (Default)

Standard WinGet source with pre-indexed package database.
winget source add --name MySource --arg https://example.com/packages

Microsoft.Rest

REST API-based source for enterprise scenarios.
winget source add --name RestSource --arg https://api.example.com --type Microsoft.Rest

Microsoft.PreIndexed.Zip

Offline ZIP file-based source.
winget source add --name OfflineSource --arg C:\offline\packages.zip --type Microsoft.PreIndexed.Zip

Trust Levels

None (Default)

Standard trust level with normal security prompts.

Trusted

Marks source as trusted, which may reduce security prompts:
winget source add --name TrustedCorpSource --arg https://corp.example.com --trust-level Trusted

Explicit Sources

Explicit sources are not searched by default. Users must specify them with --source:
winget source add --name Beta --arg https://beta.example.com --explicit
winget install Package --source Beta

Priority

Control search order with priority. Lower numbers = higher priority:
winget source add --name Primary --arg https://primary.example.com --priority 1
winget source add --name Secondary --arg https://secondary.example.com --priority 2

Exit Codes

  • 0 - Success
  • 0x8A150015 - Source already exists
  • 0x80070005 - Access denied (requires administrator)
Adding sources requires administrator privileges.
Only add sources from trusted providers. Malicious sources could deliver harmful software.

Build docs developers (and LLMs) love