An Octopus Deploy API key acts as the user or service account that owns it. It can call the Octopus REST API with that identity: create releases, trigger deployments, read projects and, depending on permissions, read or change variables, accounts and environments. Because Octopus deploys software to production servers and cloud accounts, a leaked key can mean running code where your application runs, and reading the credentials stored for those deployments. Revoke the key first, then audit what it did.
Check your GitHub account for leaked secrets — free
- Provider
- Octopus Deploy
- Severity
- High
- Impact
- Source code and build access
- Checked live by LeakWatch
- No
What an Octopus Deploy API Key looks like
An Octopus API key starts with API- followed by 26 uppercase letters and digits:
API-XXXXXXXX… (prefix + 26 uppercase letters and digits, masked here)
It is sent in the X-Octopus-ApiKey HTTP header, passed as --apiKey to the Octopus CLI, or stored in a variable such as OCTOPUS_API_KEY or in a CI step that creates releases. Octopus shows the key only once at creation and keeps just a one-way hash, so a key you can read in a file was copied out at that moment. Keys can belong to a person or to a service account. A service account key is usually meant for automation and may have wide rights, so check which one leaked.
How Octopus Deploy API Keys get leaked
- CI pipeline files. A build that creates releases with
--apiKeywritten inline in a workflow or script. - Committed environment files.
OCTOPUS_API_KEYin a.envfile or a Docker compose file. - Terraform and scripts. Provider configuration or PowerShell scripts that pass the key in clear text.
- Build logs. A verbose CLI run that echoes the command line, including the key.
- Shared documentation. A runbook or support ticket with a working curl example for the REST API.
What to do in the first hour
- Revoke the key. Sign in to Octopus, open the profile of the user or service account that owns it, and delete the key from the list of API keys. See the revoke section below.
- Create a new key for the pipeline that needs it, preferably on a service account with limited permissions, and set an expiry date if you can.
- Update your CI secrets and run a test deployment.
- Check the audit trail. Octopus keeps an audit log of changes and deployments. Filter it by the user who owned the key and look at the period of exposure.
- Look at what could have been created or changed. New releases, deployments to production, edited variables, new accounts or targets, new users and API keys, and changes to teams.
- Rotate the secrets stored in Octopus. If the key could read or export variables and accounts, treat cloud credentials and passwords kept there as exposed and replace them.
- Clean up the code and the history. See I accidentally pushed an API key to GitHub.
Not sure what else leaked from the same repository? Run a free scan.
Revoke it at Octopus Deploy
Octopus can be used as Octopus Cloud or self-hosted, so the address depends on your instance. According to the Octopus documentation, you create keys from your profile: click your profile image, choose Profile, then My API Keys. A third-party source says keys are revoked from that same page, which this guide could not confirm in Octopus’s own documentation. Open the Octopus profile page of your instance and look for the section where API keys are listed. A person has not confirmed the exact menu wording for this guide, and the interface can change, so follow the Octopus documentation on creating an API key if it differs. For a service account key, an administrator opens the service account in the user management area.
How LeakWatch detects it
The rule is called Octopus Deploy API Key. It accepts the literal prefix API- in capitals, followed by exactly 26 uppercase letters or digits, as a whole word, and the value must end with a quote, whitespace, a semicolon or the end of the line. Lowercase values, shorter or longer bodies and strings where the key is glued to other letters are not reported. The pattern has no vendor word nearby, so a value that has this exact shape by chance can be reported. The severity is high. This type is not checked live: LeakWatch does not send any request to Octopus with the key it found.
LeakWatch detects this format but does not check it live: it can tell you the key is exposed, not whether it still works. Assume it does until you have revoked it.
FAQ
Can an Octopus API key deploy to production?
Yes if the owner has deployment permission on those environments. The key has the same rights as its owner, so the scope depends on the team roles of that user or service account.
Does Octopus store my key so I can look it up?
No. It keeps a one-way hash only, so a lost key cannot be retrieved. If you cannot find where a leaked key came from, compare the end of the value with your keys list.
Should I use a service account for automation?
Yes, ideally with only the permissions the pipeline needs. A leak then reaches less than a personal key would.