Rotate the secrets your API tests use without breaking CI

Your API tests hold real credentials: a staging API key, a test user's password, an OAuth client secret, and the token CI uses to reach Requestarium. All of them should be rotated now and then, and immediately when someone leaves or a log leaks. Rotation usually fails the same way: someone changes the key in one place, and three pipelines go red at 2 a.m.

Put each secret in one place

If the staging API key is pasted into five GitHub repositories, a GitLab project and a teammate's .env, rotating it means seven changes and a missed one. Instead:

  • A secret environment variable in Requestarium, used as {{apiKey}}. The app, the CLI, CI and teammates all read the same value. It's encrypted at rest and masked in reports.
  • Or your cloud's secret manager (AWS Secrets Manager, Azure Key Vault, Google Cloud Secret Manager), read by the CLI at run time. See AWS Secrets Manager in API tests.

CI then needs nothing but REQUESTARIUM_TOKEN (and cloud credentials, if you use a secret manager).

Rotate with an overlap

For a test API key, OAuth client secret or test user password:

  1. Create the new secret while the old one still works. Most APIs let a key have two active versions.
  2. Update it in one place, from a terminal so it stays out of chat and shell history:

``bash echo "$NEW_KEY" | requestarium env set Staging apiKey - --secret ``

  1. Run a smoke check with the new value:

``bash requestarium run-collection "Orders API" --folder Smoke --env Staging ``

  1. Revoke the old secret in the API you're testing.
  2. Run the smoke check again: if anything still used the old value, you find out now, not at 2 a.m.

For a test user's password, the overlap is a second test user: switch the environment to testUser2, then change testUser1's password at leisure.

Rotate the Requestarium token in CI

CI's own token follows the same pattern:

  1. In Settings → API tokens, create a new token (on the Team plan, an organization token that doesn't belong to a person).
  2. Replace REQUESTARIUM_TOKEN in your CI's secrets.
  3. Re-run the latest pipeline.
  4. Revoke the old token in Settings → API tokens.

One token per pipeline or per repository makes step 4 safe: revoking it can't break another team's CI.

Find what uses a secret before you rotate

  • requestarium env lists each environment's variable names, with secrets marked *.
  • Search your CI files for --var, --env-var and --env-file: anything passed there bypasses the environment, and won't change when you rotate it there.
  • Check personal .env files on the team's machines last. They're the ones that usually lag behind.

When a secret leaks

Skip the overlap: revoke first, then fix. A red pipeline for an hour is better than a working key in the wrong hands. On the Team plan, check the audit log for who changed that environment and when (see audit log).