Skip to content
Payments · Secret guide

Leaked Mercury Production API Token: what to do in the first hour

Critical severityDetected onlyLast verified · 5 min read

A Mercury production API token is the credential your software uses to talk to a Mercury business bank account. Depending on the permissions it was given, it can read balances and transactions, and it can start payments that move money out of the account. A production token therefore deserves the same care as online banking access. If it appears in a public place, revoke it first, then check whether any transfer was started that you did not approve.

Check your GitHub account for leaked secrets — free

Provider
Mercury
Severity
Critical
Impact
Payments and customer data
Checked live by LeakWatch
No

What a Mercury Production API Token looks like

Mercury tokens begin with a fixed word that names the environment, followed by a short type code, a long random body and a fixed closing word. The production form uses the word production in its prefix. Mercury’s documentation shows tokens with a secret-token: label in front when they are used in requests, so a copied header can carry that label as well:

mercury_production_<type>_…_yrucrem

The closing part is a fixed reversal of the word mercury, which makes the string easy to spot in a search. A sandbox token has the word sandbox in place of production. Sandbox tokens work only against the sandbox environment and cannot touch real accounts, so a sandbox value is less urgent, but it should still be removed from the repository. Never assume a value is harmless because it looks like a test value.

How Mercury tokens get leaked

  • Committed environment files. A .env file with a Mercury variable, pushed to a public repository because the ignore rules did not cover it.
  • Accounting and automation scripts. Scripts that reconcile transactions or pay invoices often keep the token in a file on a shared drive, and that file is copied around.
  • CI and deployment logs. A pipeline that prints its variables, or a debug step that echoes an HTTP request including the authorization header.
  • Shared snippets. A request example pasted into a ticket, a forum or a chat, with the real token left in place of the placeholder.
  • Browser code. A token placed in a front-end application, where anyone who opens the page can read it.

What to do in the first hour

  1. Revoke the token in your Mercury dashboard. Mercury’s guidance is to revoke an exposed token immediately and then generate a new one. Do this before you clean the repository. Only an admin on your account can usually create or manage API tokens, so ask one to act now if you cannot.
  2. Review recent transfers. Open the transactions list and filter to the period since the token may have been exposed. Look for outgoing payments, new recipients, and approvals you did not give. Mercury’s approval flow may stop some payments, but do not rely on it.
  3. Check who else can act. Review the team members and their roles, and look for anyone you did not add.
  4. Issue a replacement with the narrowest scope that your job needs. Read-only tokens are enough for reporting. Keep payment-capable tokens separate and store them in a secret manager, not in the code.
  5. Check the other secrets. A file that held a banking token often held other keys too, such as accounting software tokens or cloud credentials. Rotate those as well. The order of steps is in I accidentally pushed an API key to GitHub.
  6. Clean the repository only after the rotation. Remove the value from the files, add the file to .gitignore, and decide whether to rewrite history. Any clone made before the cleanup still holds the old value.

Not sure what else leaked? Run a free scan.

Not sure what else leaked? Run a free scan.

Revoke it at Mercury

Sign in to Mercury and open the account settings. API tokens are managed from the settings area, and the revoke action is next to the token you want to remove. Mercury’s documentation says that an exposed token should be revoked and replaced from the dashboard. Third-party guides place the list under a settings or profile menu, and they say a token is shown only once when it is created, so store the new one immediately. We could not confirm the current menu labels from Mercury’s own pages during this review, so follow what the dashboard shows. Mercury’s API documentation is on docs.mercury.com, which describes the token types and how they are sent.

How LeakWatch detects it

The rule is called Mercury Production API Token. It looks for the fixed mercury_production_ prefix, a short type code of three to six lowercase letters, a long alphanumeric body of 40 to 50 characters, and the closing _yrucrem marker, followed by a quote, a space, a semicolon, an escaped line break or the end of the line. Sandbox tokens and values with other prefixes are not reported by this rule. The severity is critical, with the impact class for payment data. This type is not checked live: LeakWatch does not send the token to Mercury.

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 a sandbox token move real money?

No. Sandbox tokens belong to a separate test environment and do not work against production accounts. They are still worth removing from the repository, because test values are often copied into production configuration by mistake.

Will revoking the token stop an approved payment?

A revoked token cannot make new requests. Check the transaction list for anything pending, and cancel or report what you did not approve through the dashboard or to Mercury support.

Do I need to tell my bank?

If you see transfers you did not authorize, contact Mercury support straight away, and tell your accountant or auditor. Keep a record of the times you revoked the token and what you found, because it helps with any review.

Get alerted next time a secret leaks — create a free account

LeakWatch is not affiliated with Mercury.