How to manage Hyperswitch API keys and publishable keys safely
The safe way to manage Hyperswitch API keys is to treat every key as a grant of power, issue each one to a single service or front end, and keep secret keys on servers only. A payments team running self-hosted Hyperswitch needs to give backend services and browser or mobile front ends the access they need without handing either side powers it should not have. In practice, a secret key lets a caller act on payments and merchant data on the server side, while a publishable key is meant to be visible to a client, such as a checkout page, and should carry far less authority. Confusing the two is the most common way a payment credential ends up in public code, so the first control to set is a written rule for which key type each caller may hold.
Teams usually need a managed key process once the deployment has several environments such as sandbox, staging and production, several backend services that each call the API, or shared tenants where one Hyperswitch instance serves more than one merchant or business profile. Each of those multiplies the places a key can leak from and the number of people who can create or reuse one. Before you issue anything, record who may create, view and revoke keys in each environment, which service owns each key, and how a key is removed when that service is retired. The research supplied for this page does not document Hyperswitch's key types, scoping options, expiry settings or rotation mechanics, so confirm each of these in the Hyperswitch docs and the Control Center for the release you run before writing your procedure. Check the Hyperswitch docs first and test the answers in a non-production environment.
Where each key type may live across browser, backend and Hyperswitch
The diagram starts at the customer's browser or mobile app, which holds only the publishable key and calls Hyperswitch through the client SDK. The merchant backend makes server-to-server calls to the Router with the secret key. Control Center operators manage keys through the dashboard, which is also a path into the Router. Check your own architecture against the boundary: any secret key found in browser code, mobile bundles, logs or shared front-end configuration sits outside the boundary. Confirm the exact key types and their permissions for your Hyperswitch version before you write access rules.
Which key types cross each boundary, and where secret keys must never appear.
Key placement and scope options and when each fits
This table compares the ways to place and scope Hyperswitch keys: secret keys for backend calls, publishable keys for front-end SDK use, environment separation, and scoping by business profile or merchant. Read each row for when the option fits, the main risk if it is misused, and what to confirm in the documentation for the release you run. Key permissions can change between releases, so verify each behavior before you build on it.
| Option | When it fits and main risk if misused | Question to confirm for the installed release |
|---|---|---|
| Server-only secret key | Backend calls that create, confirm or refund payments. If it reaches a browser or mobile app, anyone holding it can act as your server. | Which API operations the secret key authorizes, and whether its permissions can be narrowed. |
| Client-side publishable key | Front-end SDK setup on checkout pages. Risk: wiring server-only actions to a key that ships in public code. | Which operations it allows, and whether it can be limited to allowed domains or origins. |
| Separate keys per environment | Sandbox, staging and production each use their own keys. Risk: a production key placed in test configuration. | Whether keys are created per environment and how each is labeled in the Control Center. |
| Per-profile scoping | Brands, regions or legal entities on separate business profiles. Risk: one profile's key used against another profile's connectors. | Whether a key is bound to one profile or merchant account, and how that maps to your hierarchy. |
| Per-merchant scoping on platforms | Platforms acting for connected merchants. Risk: a broad platform key that reaches merchants it was never meant to serve. | Which key type covers on-behalf-of calls and the exact merchant scope it grants. |
| Keys injected at deploy time | Keys supplied from a secrets manager at deployment. Risk: keys committed to source control, written to logs or pasted into tickets. | Whether a secret key is displayed only once, and how rotation and expiry are recorded. |
Who may create and rotate Hyperswitch API keys
Key management sits behind Control Center roles and account access. Anyone who can create, scope or rotate a secret or publishable key first has to be a user in the Hyperswitch Control Center with a role that grants that right. Users must be invited before they can sign in, so the first control is the invitation list itself: confirm who holds an account on each merchant account and business profile, and remove accounts that no longer have a business need. Single sign-on in the Control Center uses OpenID Connect only. SAML is not supported, there is no just-in-time or SCIM provisioning, and roles are managed inside Hyperswitch rather than mapped from your identity provider. Your identity provider can authenticate people, but it cannot grant or revoke key-management rights on its own.
Joiner, mover and leaver steps become manual tasks. When someone joins a payments team, an administrator must send the invitation and assign the role in Hyperswitch, because group membership in your identity provider will not create the account. When someone moves to another team, their old role and profile access must be removed by hand, since a change in the directory does not propagate. When someone leaves, disabling their identity provider account stops single sign-on, but the Hyperswitch user record and any role still need to be removed in Control Center. Write these three steps into your access runbook, name the person who performs each one, and review the user list on a fixed schedule. Confirm with Hyperswitch how user deactivation and session termination behave in your version before relying on them.
Keep the permission design separate from the offboarding checklist. Deciding which roles may rotate secret keys and which may only view or use publishable keys is a least-privilege question that belongs in a separate design. The sibling page on Hyperswitch Control Center roles and permissions covers admins, developers, operators, IAM, support and view-only users, along with patterns for payment teams. Use that design to decide who holds key-management rights, then apply the joiner, mover and leaver steps above to keep the assignments current. The Hyperswitch Control Center SSO documentation is the natural next read for the exact sign-in behavior you will be configuring.
Setting up API keys in a self-hosted Hyperswitch deployment
This sequence sets up secret and publishable API keys in a self-hosted Hyperswitch deployment so that each key has a named owner, a defined scope and a secure home. It finishes with checks that secret keys stay out of front-end code and that rejected calls leave a record.
Confirm the deployed release and Control Center compatibility
The platform team records the router release that is running and checks it against the compatibility matrix on the Hyperswitch releases page, which lists the Control Center and web client versions each release supports. The v1.124.0 release notes state that Superposition became a required dependency, so confirm that the Superposition service is running on any deployment at that version or later. Done when a short record lists the router, Control Center and SDK versions, and the Superposition health check passes.
Define the account and profile hierarchy
Before any key is created, the payments lead maps each brand, legal entity, region and environment onto Hyperswitch organizations, merchant accounts and business profiles. Keys are scoped within this hierarchy, so a wrong mapping is expensive to correct later. The sibling topic on account structure covers the detailed model. Done when a written table lists every environment and service alongside the account and profile that will own its keys.
Invite only named key administrators
The Control Center supports single sign-on through OpenID Connect only, does not provision users automatically, and manages roles inside Hyperswitch rather than from the identity provider. The security lead invites each named administrator individually and assigns the least-privilege role that allows key management. Confirm that no shared or generic accounts exist. Done when the user list in the Control Center matches the approved roster, with one owner for each role.
Create one key set per environment and service
Each administrator creates a separate set of keys for every environment (such as sandbox, staging and production) and for every backend service that calls Hyperswitch. Publishable keys are created only for client-side use, and secret keys stay with server-side services. Name each key by environment, service and owner so it can be traced later. Confirm whether your release provides expiry dates or expiry notifications for keys, and if not, record expiry dates in the inventory. Done when the inventory lists name, environment, service, owner, creation date and expiry tracking for every key, with no key shared across environments.
Store secret keys in the backend secret store
The platform team writes each secret key into the secret manager that your infrastructure already operates, then injects it into the server workload at runtime with access limited to the services that need it. Secret keys must not appear in source repositories, plain-text Helm values files, CI variables that print to logs or container images. Done when a scan of repositories, chart values and pipeline logs finds no secret key values, and each secret has a documented read policy.
Verify the front-end build contains no secret key
The front-end team builds the production bundle and searches the output for the value of every secret key in the inventory, along with the naming pattern used for secret keys. Publishable keys are the only credentials that should appear in browser code. The check is repeated after each build pipeline change, because a single misconfigured environment variable can expose a secret. Done when the search of built artifacts returns zero secret key matches, and the browser network tab shows only publishable keys in client requests.
Confirm rejected calls are logged
The operations team sends a test request with an invalid key and another with a revoked test key, then checks the router output and the log pipeline for both rejections. Each entry should show a timestamp, the endpoint and the failure reason, and it must not contain a key value. If the router does not record rejected authentication attempts in your release, add logging at the gateway in front of it and document the gap. Done when both test rejections appear in the central log store with no key material in the entries.
Security risks in Hyperswitch API key handling
API key mistakes rarely come from one bad decision. They come from a handful of habits that let a secret key travel further than it should, stay active longer than needed, or lose an owner. Each card below names one risk, the control that reduces it, and the artifact you can inspect to confirm the control is working.
Secret keys in source or front-end bundles
A secret key in a repository, build artifact or browser bundle gives anyone who can read that code full server-side API access. Publishable keys are meant for client code, but secret keys must stay on your servers. Control: keep secret keys in a secrets manager or Kubernetes secret injected at runtime. Check: scan the repository history and the built front-end bundle for the secret key prefix, and confirm only publishable keys appear in client code.
Keys shared across environments
When sandbox, staging and production use the same secret key, a test script or misconfigured pipeline can move real payments. Create separate keys per environment and per business profile so each key maps to one place it is allowed to act. Control: a naming and inventory rule that records environment and owner for every key. Check: compare the key inventory against your deployment manifests to confirm no production key is referenced in a non-production config.
Over-broad Control Center administrator access
Users with admin roles in the Control Center can typically create, view and rotate keys beyond what their job needs. Limit the number of people who hold admin rights and assign operator or view-only roles for routine work. Control: role review against the roles documented for Hyperswitch, with admin rights reserved for named key custodians. Check: export the user list with roles and confirm each admin has a documented reason.
Delayed offboarding without SCIM
Hyperswitch Control Center single sign-on uses OpenID Connect only, with no SCIM or JIT provisioning, and roles are managed in Hyperswitch rather than from the identity provider. Disabling a person in your identity provider does not remove their Control Center account. Control: a written offboarding step that removes the Hyperswitch user and reviews any keys they touched. Check: compare current Control Center users against your active staff list every time someone leaves.
SSO setup docsKeys copied into logs and tickets
Secret keys pasted into chat threads, support tickets, debug output or application logs spread far beyond the people who should hold them. Redact keys in logging middleware and forbid pasting keys into tickets. Control: a logging filter that masks the secret key prefix and a support runbook that refers to key IDs, not values. Check: search your log platform and ticketing system for the key prefix over the last retention window.
Unclear ownership of keys from departed staff
A key created by someone who has left may still power a live integration, and nobody knows what depends on it before rotating. Record an owning team and a service consumer for each key at creation time. Control: an ownership register reviewed on each staff change. Check: for each key, confirm an owner who is still employed and a list of the systems that use it.
Rotating Hyperswitch API keys without a payments outage
Rotate a secret key by overlapping two valid keys, never by replacing one in place. The sequence is: issue a new secret key in the Control Center, deploy it to every backend that calls the Hyperswitch router, confirm from logs and metrics that requests are arriving under the new key, and only then revoke the old one. Each step can fail independently, so the team should record which backends hold which key at every point. The overlap window, meaning how long both keys stay valid, is a design decision for your team. It should be long enough to cover your slowest deployment pipeline and any scheduled jobs or batch workers that run infrequently, and short enough that a leaked old key has limited value. Write the window down in your runbook before the first rotation, and name the person who confirms traffic has moved.
Before you rely on any expiry behavior, confirm it against the release you run. The Hyperswitch docs and the Hyperswitch releases on GitHub are the places to check, but the specific question to put to your Juspay contact or to your own testing is whether the installed version sends expiry notifications at all, to which recipients (the account owner, admins or the key's creator), and how many days before expiry. Do not assume a notification exists. If none is sent, your calendar and ticketing system become the control. Keep a register of every secret and publishable key with its owner, creation date and scheduled rotation date, and review it at each release.
Tie rotation to the release cadence. Hyperswitch ships minor releases roughly monthly, and each release comes with a compatibility matrix for Control Center and web client versions. Schedule at least one rotation dry run in a non-production environment against the same release you plan to run in production, so that the key lifecycle is tested alongside the upgrade. Where a release changes how keys or authentication behave, the upgrade test should include a key rotation and a publishable key check. Also rotate keys after an incident, a staff departure with key access or a suspected exposure, and treat those rotations as unplanned runs of the same sequence.
Key handling by environment: local, sandbox and production
Local setups run the Hyperswitch stack on a developer workstation, using the Docker-based setup or a local Minikube cluster. The keys created here exist only to exercise the stack during development. They should be treated as disposable and should never be carried into shared environments.
- Keys used: Secret and publishable keys generated by the local stack during setup, plus connector test credentials for any processor sandbox accounts the developer holds.
- Who holds them: The developer running the stack. No other person or service should depend on these keys.
- Separation: Keep local values in a per-machine environment file or local configuration, and never copy a production values file into a local setup.
- Publishable keys in local front ends: A local checkout page may load a publishable key from the local backend, but the secret key must stay in the server process only.
- Before promotion: Confirm that no key from this tab appears in version control or chat logs, and that the local stack is reachable only from the workstation.
Before reusing any local configuration in another environment, compare it with the setup steps in the Hyperswitch self-hosting documentation and confirm which keys each step creates.
The hosted sandbox lets an integration team test payment flows against a Hyperswitch-hosted environment without running its own infrastructure. Keys issued here serve test traffic only. Confirm the sandbox key model with Hyperswitch before you design your process around it, because the details of key types and expiry behavior can change between releases.
- Keys used: Sandbox secret keys for server-side calls, sandbox publishable keys for client code, and test connector credentials for the processors you are testing against.
- Who holds them: The integration team, with one named owner for each key who can revoke and reissue it. Avoid sharing a single key among several engineers.
- Separation: Store sandbox keys in a different secret store and under different names from production keys, so a deployment cannot read the wrong set.
- Rotation: Rotate sandbox keys on a schedule your team sets, and immediately when someone with access leaves the project.
- Before promotion: Run payment, refund and webhook flows end to end in the sandbox, confirm each key carries only the access its calling service needs, and record which key names the production build will read.
Before relying on sandbox keys for regression testing, ask Hyperswitch how the sandbox handles key expiry and whether it sends any notice ahead of expiry.
The production stack is deployed with Helm on Kubernetes in infrastructure you control. Keys in this environment authorize live payments, so ownership, storage and change control matter more than convenience. Plan these controls before the first deployment, not after the first incident.
- Keys used: Production secret keys for server-side services, production publishable keys for checkout front ends, and live connector credentials.
- Who holds them: A small named group, usually platform and security owners, with a written approval step for creating and rotating keys. Application engineers should not hold live secret keys.
- Separation: Store keys in a dedicated secret manager or in Kubernetes secrets with access limited by namespace and service account. Keep them out of Helm values files and anything committed to git.
- Promotion gate: Before a key goes live, confirm its scope, confirm the calling service and environment match, confirm the rotation procedure has been tested in staging, and record the key in your inventory with one owner.
- Operations: Alert on key use from unexpected sources, and keep a runbook for revoking a key quickly during an incident.
Before go-live, check that every production key has one owner, one consuming service and a rotation path your team has rehearsed.
Limits to confirm before relying on Hyperswitch API keys
The researched Hyperswitch material does not settle how API keys behave in detail, so the items below are checks to run against the docs for your installed version and in your own test environment. Each one changes how you design key ownership, rotation and monitoring for the platform.
Key types and exact permissions
Confirm which key types your installed version issues, including secret keys for server-side calls and publishable keys for client-side use, and what each one may call. Ask whether a secret key can read, create or refund payments, change connector settings or manage other keys. Write the answers into a permission matrix and test each row with a real request before any key reaches production.
Hyperswitch docsScope below merchant or profile level
Find out whether a key can be limited to one business profile, one connector or one merchant account, or whether every key in an account has full access to that account. This decides whether one compromised key exposes one brand or the whole organization. If keys cannot be scoped finely, plan for separate merchant accounts or stricter Control Center roles around them.
Expiry and expiry notifications
Check whether keys can carry an expiry date, and whether Hyperswitch sends any notice before a key expires or after a key has not been used. Without built-in expiry, your rotation schedule becomes a manual calendar task with its own owner. Record the answer, because it sets how often your team must rotate and whether alerts come from the platform or from your monitoring.
Revocation and its timing
Confirm how a key is revoked, who can do it, and how long it takes to stop working after revocation. Ask whether requests already in flight complete and whether cached copies in your services stop authenticating at once. Test revocation in a sandbox with the exact client libraries your services use, so you know the real window of exposure during an incident.
Audit logging of key use
Ask whether each API call records which key made it, the time, the source address and the action taken, and whether those records can be exported to your SIEM. Without this record you cannot tell which integration used a leaked key or prove who changed a setting. Confirm retention for these logs and whether they are kept in your database or only in the hosted dashboard.
Effect of API changes on Control Center
Test whether creating, rotating or revoking keys through the API is reflected in the Control Center immediately, and whether a key created in the dashboard can be managed through the API. Confirm that a change made by one administrator does not hide or break settings another administrator is editing. Document any gap so support staff know which tool to use during an incident.
Questions teams ask before outside help on Hyperswitch API keys
How much work is API key management in a self-hosted Hyperswitch stack?
Key management is a small task in isolation but a recurring one, because every service that calls Hyperswitch, every storefront that loads a publishable key and every environment needs its own keys and rotation plan. The effort comes from inventory and discipline, not from the key creation step itself. Your team has to know which keys exist, which system holds each one, who can create or revoke them and how a rotation reaches every consumer without an outage. Ask any partner to show how they will produce that inventory and the rotation runbook before any fee is discussed. The scope should state whether it covers design only, build of the secret storage and rotation procedure, or ongoing operation.
Can an internal team manage Hyperswitch API keys without outside help?
Yes, many internal platform or payments teams can, provided they have engineers who understand Kubernetes secrets, their secret manager and how the Hyperswitch Control Center issues keys. The usual gaps are not the key screens but the surrounding habits: keeping secret keys out of front-end bundles, separating keys by environment, recording owners and setting a rotation schedule that someone actually runs. An outside partner is most useful for a first design review, for hardening the secret path and for testing that a publishable key cannot reach server-side operations. Decide which of those gaps your team already closes and buy help only for the rest.
What does a partner need from us before starting key work?
A partner needs enough access and context to see every place a key is used, which usually means:
- Read access to the Control Center role list and the people who hold admin or developer roles
- The Hyperswitch release version you run, since Control Center and web client compatibility is tied to release versions
- A list of services, storefronts, mobile apps and CI jobs that call the API or load a publishable key
- Your secret manager, Kubernetes cluster and identity provider setup, including whether Control Center sign-in uses OpenID Connect
- Environment boundaries for development, staging and production
Request read-only access where possible and agree in writing how credentials are handled during the work.
How long does a first API key setup take?
The duration depends on how many services call Hyperswitch, how many environments exist and how much of the secret path already exists. A team with one backend, one storefront and a single environment has a much shorter path than one with several services, mobile apps, partner integrations and separate staging and production clusters. Each additional environment and each additional consumer adds an inventory item, a secret location, a scope decision and a test. No duration is given here because none was supplied for this topic. Ask the partner for a written timeline tied to the inventory they agree to build, and confirm which environments are in the first phase.
How do rotation and upgrades change the effort over time?
Rotation is recurring work, so its cost is ongoing rather than a one-time setup fee. Each rotation touches every consumer of the key, so effort rises with the number of services and environments. Release upgrades add another recurring step: Hyperswitch ships regular minor releases with a compatibility matrix for Control Center and web client versions, and some releases add required dependencies. A key change can ride along with an upgrade, but it should be tested separately so a failed upgrade does not hide a broken rotation. Ask whether the quote includes rotation runs, upgrade testing and retesting, or only the initial design.
What drives the cost of API key work up or down?
Cost follows four drivers: the number of services and environments that hold keys, the identity integration around Control Center access, the number of Hyperswitch release changes you plan to absorb, and the maturity of your existing secret management. Fewer services and a single secret manager shorten the work. Multiple clusters, legacy scripts that embed keys and manual rotation steps lengthen it. Identity integration matters because Control Center SSO uses OpenID Connect only, and users must be invited before they can sign in, so access reviews have to be designed alongside keys. Ask for the quote to list each driver as a line item so you can see what changes the price.
What should we confirm about publishable and secret key handling before a quote?
Confirm first that no secret key is referenced in front-end code, build artifacts or mobile bundles, and that publishable keys are the only key type that ships to browsers and apps. Next, confirm who can create, view and revoke keys in the Control Center, and whether those roles are reviewed on a schedule. Finally, confirm how expiry notifications reach an owner who can act on them. These points define the scope of a security test and the evidence an auditor would ask for. Confirm the exact key types, expiry options and notification behavior with Hyperswitch documentation and your own tenant, since this page does not give those details.
Where to check the current Hyperswitch key and SSO documentation
Start with the official self-hosting guide in the Hyperswitch docs on self-hosting and the SSO page for the Control Center, because the behavior of key and login settings depends on the version you run. Confirm in the self-hosting guide which Helm chart values, secret references and environment settings your deployment needs for the API key and encryption configuration, and record the exact version you have pinned. The Control Center SSO page sets out the constraints you must plan around: sign-in works through OpenID Connect only, SAML is not supported, users must be invited before they can sign in, and roles are managed inside Hyperswitch rather than mapped from your identity provider. Treat those statements as the baseline for who may manage keys in your environment and check them again before every upgrade.
Read the release notes for the exact version you run, not only the latest one. Hyperswitch ships roughly monthly minor releases, and each one on the Hyperswitch releases page lists changes and a compatibility matrix for Control Center and web client versions. The compatibility matrix in each release applies to key-related changes, so check it before you change the Control Center version, the router version or any SDK that embeds a publishable key. Confirm with Hyperswitch whether a key format, scope or expiry behavior changed between your current version and your target version, and schedule key rotation after that check so the rotation and the upgrade do not overlap without a rollback plan.
How DeployOpen scopes and supports Hyperswitch API key work
DeployOpen plans, implements, documents and supports self-hosted open-source platforms inside your own infrastructure. For Hyperswitch API keys and publishable keys, that means agreeing in writing who may create and rotate each key type, building those controls into your environment, and handing over the runbooks your team needs to operate them.
How we scope
- Inventory every secret and publishable key your Hyperswitch setup needs, by merchant account and business profile
- Agree which roles may create, scope, rotate and revoke keys, and record the approval path in the written scope
- Confirm expiry notification recipients, rotation intervals and where secret keys are permitted to live
How we build
- Configure key creation, scoping and rotation in your self-hosted Control Center and API, then test each key type against its intended use
- Keep secret keys in server-side configuration and secrets storage, and verify that no secret reaches front-end code or client SDK bundles
- Test rotation with overlapping keys so checkout and server calls keep working during a planned change
How we hand over
- Deliver a key register listing each key, owner, scope, expiry date, rotation procedure and revocation steps
- Document the role matrix for key management and the expiry notification setup, with a walkthrough for your operations team
- Provide a test log showing publishable and secret key behavior, so your compliance and security teams can review the evidence
How we support
- Engagements are fixed-scope, with scope, deliverables and timelines agreed in writing before work starts
- Ongoing support, upgrades and continuous testing are available as a retainer, including key reviews after Hyperswitch releases
- Confirm with your team which key-related changes need retesting before each upgrade, using the vendor's release notes as input

