setapikey command (NuGet CLI)
Applies to: package consumption, publishing • Supported versions: all
Saves an API key for a given server URL into
NuGet.Config so that it doesn't need to be entered for subsequent commands.
nuget setapikey <key> -Source <url> [options]
<source> identifies the server and
<key> is the key to save. If
<source> is omitted, nuget.org is assumed.
API key is not used for authenticating with the private feed. Refer to
nuget sources command to manage credentials for authenticating with the source.
API keys can be obtained from the individual NuGet servers. To create and manage APIKeys for nuget.org refer to acquire-an-api-key
The NuGet configuration file to apply. If not specified,
~/.config/NuGet/NuGet.Config(Mac/Linux) is used.
(3.5+) Forces nuget.exe to run using an invariant, English-based culture.
Displays help information for the command.
Suppresses prompts for user input or confirmations.
Server URL where the API key is valid.
Specifies the amount of detail displayed in the output:
Also see Environment variables
nuget setapikey 4003d786-cc37-4004-bfdf-c4f3e8ef9b3a nuget setapikey 4003d786-cc37-4004-bfdf-c4f3e8ef9b3a -source https://example.com/nugetfeed