ApiKey
ApiKey
ApiKey Command (choco apikey)
This lists API keys that are set or sets an api key for a particular source so it doesn’t need to be specified every time.
Anything that doesn’t contain source and key will list API keys.
Usage
choco apikey [<options/switches>]
choco setapikey [<options/switches>]
Examples
choco apikey
choco apikey -s https://somewhere/out/there
choco apikey list
choco apikey list -s https://somewhere/out/there
choco apikey add -s="https://somewhere/out/there/" -k="value"
choco apikey add -s "https://push.chocolatey.org/" -k="123-123123-123"
choco apikey add -s "http://internal_nexus" -k="user:password"
choco apikey remove -s https://somewhere/out/there
For source location, this can be a folder/file share or an http location. When it comes to urls, they can be different from the packages url (where packages are searched and installed from). As an example, for Chocolatey’s community package package repository, the package url is https://community.chocolatey.org/api/v2/, but the push url is https://push.chocolatey.org (and the deprecated https://chocolatey.org/ as a push url). Check the documentation for your choice of repository to learn what the push url is.
For the key, this can be an apikey that is provided by your source repository. With some sources, like Nexus, this can be a NuGet API key or it could be a user name and password specified as ‘user:password’ for the API key. Please see your repository’s documentation (for Nexus, please see https://ch0.co/nexus2apikey).
:choco-info: NOTE
See scripting in how to pass arguments (
choco -?
) for how to write proper scripts and integrations.
Connecting to Chocolatey.org (Community Package Repository)
In order to save your API key for https://push.chocolatey.org/, log in (or register, confirm and then log in) to https://push.chocolatey.org/, go to https://push.chocolatey.org/account, copy the API Key, and then use it in the following command:
choco apikey add -k <your key here> -s https://push.chocolatey.org/
Exit Codes
Exit codes that normally result from running this command.
Normal:
- 0: operation was successful, no issues detected
- -1 or 1: an error has occurred
- 2: nothing to do, apikey already set (enhanced)
:choco-info: NOTE
Starting in v2.3.0, if you have the feature ‘useEnhancedExitCodes’ turned on, then choco will provide enhanced exit codes that allow better integration and scripting.
If you find other exit codes that we have not yet documented, please file a ticket so we can document it at https://github.com/chocolatey/choco/issues/new/choose.
Options and Switches
:choco-info: NOTE
Options and switches apply to all items passed, so if you are running a command like install that allows installing multiple packages, and you use
--version=1.0.0
, it is going to look for and try to install version 1.0.0 of every package passed. So please split out multiple package calls when wanting to pass specific options.
Includes default options/switches (included below for completeness).
-?, --help, -h
Prints out the help menu.
--online
Online - Open help for specified command in default browser application.
This option only works when used in combintation with the -?/--help/-h
option. Available in 2.0.0+
-d, --debug
Debug - Show debug messaging.
-v, --verbose
Verbose - Show verbose messaging. Very verbose messaging, avoid using
under normal circumstances.
--trace
Trace - Show trace messaging. Very, very verbose trace messaging. Avoid
except when needing super low-level .NET Framework debugging.
--nocolor, --no-color
No Color - Do not show colorization in logging output. This overrides
the feature 'logWithoutColor', set to 'False'.
--acceptlicense, --accept-license
AcceptLicense - Accept license dialogs automatically. Reserved for
future use.
-y, --yes, --confirm
Confirm all prompts - Chooses affirmative answer instead of prompting.
Implies --accept-license
-f, --force
Force - force the behavior. Do not use force during normal operation -
it subverts some of the smart behavior for commands.
--noop, --whatif, --what-if
NoOp / WhatIf - Don't actually do anything.
-r, --limitoutput, --limit-output
LimitOutput - Limit the output to essential information
--timeout, --execution-timeout=VALUE
CommandExecutionTimeout (in seconds) - The time to allow a command to
finish before timing out. Overrides the default execution timeout in the
configuration of 2700 seconds. Supply '0' to disable the timeout.
-c, --cache, --cachelocation, --cache-location=VALUE
CacheLocation - Location for download cache, defaults to %TEMP% or value
in chocolatey.config file.
--allowunofficial, --allow-unofficial, --allowunofficialbuild, --allow-unofficial-build
AllowUnofficialBuild - When not using the official build you must set
this flag for choco to continue.
--failstderr, --failonstderr, --fail-on-stderr, --fail-on-standard-error, --fail-on-error-output
FailOnStandardError - Fail on standard error output (stderr), typically
received when running external commands during install providers. This
overrides the feature failOnStandardError.
--use-system-powershell
UseSystemPowerShell - Execute PowerShell using an external process
instead of the built-in PowerShell host. Should only be used when
internal host is failing.
--no-progress
Do Not Show Progress - Do not show download progress percentages.
--proxy=VALUE
Proxy Location - Explicit proxy location. Overrides the default proxy
location of ''.
--proxy-user=VALUE
Proxy User Name - Explicit proxy user (optional). Requires explicit
proxy (`--proxy` or config setting). Overrides the default proxy user of
''.
--proxy-password=VALUE
Proxy Password - Explicit proxy password (optional) to be used with user
name. Encrypted. Requires explicit proxy (`--proxy` or config setting)
and user name (`--proxy-user` or config setting). Overrides the default
proxy password.
--proxy-bypass-list=VALUE
ProxyBypassList - Comma separated list of regex locations to bypass on
proxy. Requires explicit proxy (`--proxy` or config setting). Overrides
the default proxy bypass list of ''.
--proxy-bypass-on-local
Proxy Bypass On Local - Bypass proxy for local connections. Requires
explicit proxy (`--proxy` or config setting). Overrides the default
proxy bypass on local setting of 'True'.
--log-file=VALUE
Log File to output to in addition to regular loggers.
--skipcompatibilitychecks, --skip-compatibility-checks
SkipCompatibilityChecks - Prevent warnings being shown before and after
command execution when a runtime compatibility problem is found between
the version of Chocolatey and the Chocolatey Licensed Extension.
Available in 1.1.0+
--ignore-http-cache
IgnoreHttpCache - Ignore any HTTP caches that have previously been
created when querying sources, and create new caches. Available in 2.1.0+
-s, --source=VALUE
Source [REQUIRED] - The source location for the key
-k, --key, --apikey, --api-key=VALUE
ApiKey - The API key for the source. This is the authentication that
identifies you and allows you to push to a source. With some sources
this is either a key or it could be a user name and password specified
as 'user:password'.
Command Reference
:choco-info: NOTE
This documentation has been automatically generated from
choco apikey -h
.