Updated October 20, 2026

Get HeaderSwap for Chrome

Home › Extensions › HeaderSwap for HTTP Headers › Guides › Switch API environments with headers

How to Switch Between API Environments Using Header Sets

By the Pick Ads team · Tested on Chrome · Published October 20, 2026 · Updated October 20, 2026

Answer: Put each environment's headers in its own HeaderSwap profile, such as Local, Staging and Prod, with its token, feature flags and domain filter. Switch profiles to test a different backend without editing code. Premium adds unlimited profiles including Prod, auto-expiry, cloud sync and current-tab-only profiles.

Scenario

Your frontend calls one API gateway. The backend team routes requests by header: X-Env: staging reaches the staging cluster, an Authorization token decides the user, and X-Feature-Checkout: v2 turns on a feature flag. Testing a bug in three environments means changing three headers and three tokens each time. Profiles turn that into one click.

Who this is for: frontend developers, QA engineers and API developers who test the same app against several backends.

Set up environments

  1. Create a Local profile. Add your headers, for example:
    • Authorization: Bearer <local token>
    • X-Env: local
  2. Add a domain filter, such as api.example.com or localhost, so the headers go only to your API.
  3. Label it Local. HeaderSwap offers environment labels: Local/Dev, Staging and Prod.
  4. Duplicate as Staging. This copies headers and filters, so you only swap the token and the X-Env value.
  5. Add Prod if you need it (Premium). Free includes up to 2 profiles; Premium unlocks unlimited profiles, including Prod.
  6. Switch by selecting a profile, then reload the page and confirm in DevTools > Network > Headers.

Example configurations

ProfileFilterHeadersPlan
LocallocalhostAuthorization: Bearer <local>, X-Env: localFree
Stagingapi.example.comAuthorization: Bearer <staging>, X-Env: stagingFree (2nd profile)
Staging + new checkoutapi.example.comStaging headers + X-Feature-Checkout: v2Premium (3rd profile)
Prod read-only checkapi.example.comAuthorization: Bearer <read-only prod>Premium

Header names like X-Env are examples. Use whatever your backend reads. Free allows up to 10 rules per profile, counting headers and redirects (per getpickads.com, 2026-10-20). To point a whole host somewhere else instead, use a regex redirect. See redirect URLs with regex.

Auto-expiry (Premium)

Sync across machines (Premium)

Sign in with Google and turn on Sync to see your profiles on your other computers. According to the HeaderSwap privacy policy:

  • Profiles are stored on Pick Ads' server while Sync is on.
  • Secret-like header values, such as tokens and cookies, are left out unless you turn on Also sync secret header values.
  • A short version history lets you restore an earlier snapshot.
  • Turning Sync off stops uploading.

Leaving secrets out of sync means you re-enter tokens on each machine. That's the safer default.

Safety

  • Always filter by domain. A token without a filter goes to every site.
  • Treat Prod carefully. Prefer read-only tokens, short expiry and a clearly labelled profile.
  • Scope to one tab (Premium) when testing production next to normal browsing.
  • Pause all with one switch when you finish.
  • Check what you share. Share links contain the profile in the URL fragment; HeaderSwap offers to strip tokens and cookies first.

Reliability and maintenance tips

  • Name profiles after the environment and date, for example "Staging – Oct token".
  • Rotate tokens on the server's schedule, and update the profile at the same time.
  • If a switch "doesn't work", check Network > Headers first. Another header extension or a cached response is the usual cause.
  • Keep one profile active at a time unless you deliberately layer them.

When another approach is better

  • CI and automated tests: set headers in the test client or an environment file, not a browser extension.
  • A whole team needs the same setup: keep the config in the repository or a shared API client environment. Share links work for one-off handoffs.
  • The app picks its backend by build variable: switching headers won't help. Use separate builds or a regex redirect.
  • You need mocked responses: use a mocking tool; HeaderSwap only changes headers and redirects.

For the basics of adding headers, see modify request headers in Chrome. For a token-only setup, see add a bearer token.

Last verified: 2026-10-20

FAQ

Is expiry per rule?

Can teammates share sets? Yes, through share links, which are available on Free. The profile is encoded in the link itself and isn't stored on Pick Ads' server, so anyone with the link can read it. Let HeaderSwap remove tokens and cookies before you share. Sync is for your own computers, not a team workspace.

What gets synced? With Premium Sync on, your profiles are stored on Pick Ads' server and appear on your other computers. Secret-like values such as tokens and cookies are left out unless you turn on "Also sync secret header values". A short version history of synced snapshots lets you restore one. Turn Sync off to stop uploads.

Add HeaderSwap to Chrome - Free. Premium is $6.99/month or $69.90/year when you need Prod, auto-expiry and sync (per getpickads.com, 2026-10-20).

Sources

Last verified: 2026-10-20