Govern OpenAI API Key Creation and Expiration: Service Accounts, User Keys, Maximum Lifetimes, Rotation, and Validation
Why API key governance is now an administrator-level control, not just a developer habit
OpenAI’s production best-practices guidance now gives administrators a clearer policy surface for governing how new API keys are created and how long newly created keys may live. The documented controls matter because unmanaged API keys are not merely developer conveniences; they are credentials that can authorize billable API usage, connect applications to production workflows, and create security and continuity risk when ownership is unclear. A practical governance program should therefore decide who may create keys, whether keys should belong to users or service accounts, what maximum lifetime is acceptable, how replacements are validated, and how exceptions are reviewed before they become permanent shadow infrastructure.
The core options documented by OpenAI are direct and consequential: administrators can allow only service-account keys, allow only user-owned project keys, or disable all new key creation. OpenAI also documents maximum key lifetime controls at the organization and project level. Project-level maximums cannot exceed the organization-level maximum, and organization restrictions take precedence over project restrictions. These controls apply to new key creation; existing keys are unaffected by the policy change. That last sentence should drive the first operational warning in every rollout plan: changing the key-creation policy is not the same as inventorying old credentials, rotating secrets, revoking leaked keys, correcting application configuration, or proving that production traffic has moved to a replacement.
For administrators, the useful mental model is a two-part gate. The first gate controls what types of new keys may be created at all: service-account-only, user-owned project keys only, or no new key creation. The second gate controls the maximum lifetime that can be assigned to newly created keys, with organization policy setting the ceiling for projects. A restrictive organization policy can prevent a project from creating keys outside the organization’s boundary, but it does not retroactively change a key that already exists. A project may also be configured with a shorter maximum lifetime than the organization allows when a team wants tighter control for a high-risk environment, a temporary integration, a vendor pilot, or a heavily audited application.
This guide treats OpenAI’s documented controls as one layer in a larger operating model. OpenAI’s guidance on API key safety emphasizes protecting keys, avoiding hard-coding, and rotating keys when needed. OpenAI’s production guidance also recommends secure secret storage, usage monitoring, separate staging and production projects, spend alerts and hard limits, rate-limit planning, and security or compliance review. Those recommendations are complementary rather than interchangeable. A policy that blocks new user-owned keys will not detect a key pasted into an old CI variable. A maximum lifetime will not tell you whether the key was scoped to the right project. A spend limit will not identify which application path is still using a credential scheduled for revocation. A reliable governance program needs policy, inventory, ownership, validation, monitoring, and accountable human approval.
This playbook covers enterprise Codex deployment with governance-first onboarding, access control, and usage governance prompts for teams. The The Codex Enterprise Deployment Playbook: 12 Prompts for Team Onboarding, Access Control, and Usage Governance article is a focused companion for Service Account Governance because it is the strongest fit for governing non-human or team access patterns because it directly addresses onboarding, access control, and operational governance rather than unrelated account-security or plugin topics.
The three documented key-creation modes and what each one is good for
OpenAI documents three API Key Governance choices for new key creation: allow only service-account keys, allow only user-owned project keys, or disable all new key creation. Each option solves a different operational problem. The right default depends on whether workloads are machine-run or human-operated, whether teams have mature service-account ownership, how quickly keys can be rotated, and whether the organization is trying to freeze credential growth during cleanup. Administrators should avoid treating any one option as universally correct, because the safest policy for a production automation platform may be a poor fit for a small research workspace with named human accountability and short-lived experiments.
Option 1: allow only service-account keys for new key creation
A service-account-only policy directs new key creation toward non-human identities. This can be a strong fit for production workloads, back-end services, scheduled jobs, server-to-server integrations, deployment pipelines, and shared applications where access should continue when an employee changes roles or leaves the organization. The operational advantage is ownership continuity: the key belongs to a service account associated with a project or workload rather than to an individual’s day-to-day user identity. That makes it easier to document which system depends on the credential, who approves rotation, where the secret is stored, and what alerting should trigger when usage deviates from expectation.
The service-account-only option is not a substitute for governance discipline. A service account can still be over-permissioned, poorly named, embedded in code, copied into an uncontrolled environment, or left active after an application is retired. Administrators should require a named human owner, a backup owner, a project association, an environment label, a rotation runbook, and monitoring coverage for every service-account key. A practical naming standard might identify the workload, environment, owning team, and rotation tier without embedding confidential business context. A service account used by a production billing assistant, for example, should have a clearer owner and approval path than a temporary prototype used in a sandbox.
Use a service-account-only policy when the organization wants new credentials to be created for durable systems rather than personal convenience. This is usually appropriate for production applications, internal platforms, API gateways, batch jobs, integration middleware, and CI/CD systems that are managed by platform or application teams. It is also useful where auditability requires separating human console access from application runtime access. The required compensating controls are least privilege, scoped projects, secure secret storage, separate staging and production projects, rotation testing, and clear incident procedures when a key is suspected of exposure.
Option 2: allow only user-owned project keys for new key creation
A user-owned-project-key policy allows new keys to be created only as user-owned keys within projects. This can be appropriate when the primary governance need is named human accountability for experimentation, prototyping, evaluation, or personally operated development tasks. A user-owned key ties the credential to a specific user rather than a service account, which can help administrators identify the person responsible for the credential’s purpose and lifecycle. In a small research project, a short-lived user-owned key may be easier to approve, monitor, and revoke than a service identity created for an experiment that may never become an application.
The drawback is continuity risk. If a key is tied to an individual and that individual leaves, changes teams, loses access, or is unavailable during an incident, the dependent workload may become difficult to manage. For that reason, user-owned keys should not become invisible production dependencies. If a prototype graduates into a shared service, the migration plan should include moving the workload to an approved service account, storing the secret in an approved secret manager or runtime environment, updating deployment configuration, validating traffic under the replacement key, and revoking the original only after continuity is proven. OpenAI’s production guidance to replace a key before expiry, update applications, verify the replacement, and then revoke the old key is particularly important in this transition.
Use user-owned project keys when the work is exploratory, human-supervised, short-lived, or limited to a controlled development environment. Administrators should still apply maximum lifetimes, require secure storage, prohibit hard-coding, and monitor usage. A user-owned key is not safer merely because a human owns it; the security outcome depends on how it is stored, whether the user has appropriate project access, whether the key is rotated, and whether usage is reviewed. If the organization cannot reliably distinguish experiments from production dependencies, user-owned keys should be constrained to non-production projects and short expiration windows.
Option 3: disable all new key creation
Disabling all new key creation is the most restrictive documented mode. It can be useful during incident response, credential inventory cleanup, merger or reorganization work, platform migration, policy redesign, or a temporary freeze while administrators establish ownership of existing keys. This mode should be understood as a creation freeze, not a complete credential-control solution. OpenAI documents that these controls affect new key creation only, so disabling new key creation does not revoke existing keys, shorten their lifetime, rotate them, identify where they are stored, or stop existing applications from using them.
A creation freeze is most effective when paired with an explicit exception process. If all new key creation is disabled but teams still need to maintain critical services, the organization should define who may approve exceptions, what evidence is required, how long the exception lasts, where the key will be stored, and how the replacement will be validated. Without an exception process, teams may delay security work, reuse older credentials, route requests through uncontrolled services, or treat emergency approvals as informal. The freeze should also have an exit condition, such as completion of inventory, replacement of unmanaged keys, approval of a service-account standard, or verification that spend and usage monitoring cover the current project structure.
Use a no-new-keys policy when uncontrolled credential growth is a larger near-term risk than developer velocity. This is appropriate during suspected key leakage, major access-control redesign, vendor offboarding, or a governance reset after discovering unknown production dependencies. It is less appropriate as a permanent default unless the organization has a central platform team that provisions credentials through a controlled workflow. Even then, administrators should document how sanctioned workloads receive keys, how urgent rotations are handled before expiry, and how blocked teams request a reviewed change rather than creating workarounds.
This migration runbook covers moving OpenAI Daybreak access into a primary organization with project access, user roles, API keys, validation, and a 14-day cutover. The Migrate OpenAI Daybreak Into Your Primary Organization: Project Access, User Roles, API Keys, Validation, and the 14-Day Cutover article is a focused companion for OpenAI Project Roles because it explicitly discusses OpenAI project access and user roles alongside API keys, matching the marker’s focus on role-based project administration.
Policy precedence: organization settings set the boundary for projects
OpenAI’s documented precedence rule is simple: organization restrictions take precedence over project settings. In practice, this means administrators should design the organization policy as the highest-level boundary and then use project settings for narrower local constraints where appropriate. If the organization permits only service-account keys, a project cannot rely on a looser project-level preference to allow user-owned project keys. If the organization defines a maximum key lifetime, a project maximum cannot exceed that organization maximum. Project-level policy is therefore useful for making a project stricter, not for escaping the organization’s baseline.
This precedence model prevents fragmented governance, but it can surprise teams that are used to managing their projects independently. Before changing organization-level policy, administrators should identify which projects will be affected when users attempt to create new keys after the change. The failure mode to avoid is not that existing applications immediately stop because OpenAI documents that existing keys are unaffected; the more common disruption is a team discovering during a deployment, incident, or onboarding process that it can no longer create the type of new key it expected. A rollout announcement should therefore explain the new allowed key types, the maximum lifetime rule, the exception path, the rotation procedure, and the support channel for blocked workloads.
The fact that existing keys are unaffected by creation governance is a safety feature and a risk. It reduces the chance that a policy change accidentally breaks running systems, but it also means old credentials remain in place until administrators inventory and handle them. A mature rollout should separate “policy activation” from “legacy key remediation.” Policy activation controls future creation. Legacy remediation identifies current keys, maps each key to an owner and workload, checks storage practices, validates whether the key belongs in its current project, plans replacement if needed, verifies new traffic, and revokes the old credential only after the application has proven continuity.
Maximum lifetime settings deserve the same distinction. OpenAI’s guidance supports maximum key lifetime enforcement for newly created keys, and project limits cannot exceed organization limits. That does not mean every existing key suddenly receives a new expiration date. Administrators should not communicate maximum lifetime policy as retroactive rotation. Instead, they should pair the new setting with a remediation schedule for older keys, prioritizing production, high-spend projects, keys with unclear ownership, keys used from unusual environments, and keys stored outside approved secret-management systems.
Decision table: choose a governance mode by ownership, accountability, environment, and rotation capability
The following decision table is a practical recommendation framework, not an OpenAI policy table. It translates OpenAI’s documented governance options into operating choices administrators can apply during rollout planning. Use it to identify a default for each project class, then confirm the decision against your organization’s risk tolerance, staffing model, and ability to rotate keys without outage. When in doubt, choose the more restrictive policy for production and the more explicit approval path for exceptions.
| Workload pattern | Primary ownership model | Human accountability requirement | Typical environment | Rotation capability | Recommended key-creation mode | Operational warning |
|---|---|---|---|---|---|---|
| Customer-facing production application | Application team, platform team, or service owner | Named service owner plus backup approver | Production project separated from staging | Must support tested replacement before revocation | Allow only service-account keys | Do not revoke the old key until traffic, permissions, error rates, and billing behavior are verified under the replacement. |
| Internal automation or scheduled batch job | Owning team responsible for job reliability | Named owner, backup owner, and documented escalation path | Production or controlled internal project | Should support scheduled rotation with a maintenance window if needed | Allow only service-account keys | Do not let a personal user key become a hidden dependency for a recurring business process. |
| CI/CD integration or deployment pipeline | Platform engineering or release engineering | Change owner and release approver | Build, test, staging, or production deployment environment | Must be rehearsed because a failed rotation can block releases | Allow only service-account keys, with short maximum lifetime where feasible | Store secrets in approved CI secret storage; never print keys in logs, prompts, build output, or deployment summaries. |
| Short-lived research evaluation | Individual researcher or evaluation lead | Named human directly accountable for scope and cleanup | Development, sandbox, or evaluation project | Can usually tolerate short expiration and manual replacement | Allow only user-owned project keys | Require non-production data handling rules and prevent the key from migrating into shared automation. |
| Prototype likely to become a shared service | Initial human owner, later application team | Named prototype owner plus graduation reviewer | Development project first; staging before production | Rotation must be proven before production launch | User-owned project keys for prototype; service-account keys before shared operation | Make service-account migration an explicit launch gate rather than an afterthought. |
| Vendor-managed integration | Internal sponsor plus vendor-management owner | Internal human approver must remain accountable | Dedicated project when possible, not a shared production project | Requires coordinated rotation window and contract-aware offboarding | Prefer service-account keys with tightly documented ownership; disable ad hoc user key creation | Do not send real keys in email, tickets, chat prompts, screenshots, or unapproved vendor systems. |
| Incident response after suspected credential exposure | Security incident lead and platform administrator | Incident commander approves changes and revocation timing | Affected projects and emergency replacement path | Must prioritize containment and verified continuity | Disable all new key creation temporarily, then create approved replacements through exception workflow | A creation freeze does not revoke exposed keys; revocation must be deliberate and coordinated with application validation. |
| Legacy environment with unknown key owners | Temporary remediation owner until each workload is mapped | Security or platform lead accountable for inventory | Mixed development and production projects | Often weak until dependencies are mapped | Disable all new key creation during inventory, then move production workloads toward service accounts | Do not assume a key is unused because its owner is unknown; verify usage before revocation. |
| Classroom, lab, or training workspace | Instructor, lab administrator, or program owner | Named adult administrator or institutional owner | Training or sandbox project with limited budget exposure | Short lifetime and reset between cohorts are usually appropriate | User-owned project keys only, or disable all new key creation if credentials are centrally issued | Do not let learners share keys publicly or include credentials in assignments, repositories, notebooks, or screenshots. |
The table intentionally separates ownership from environment because the same technical workload can have different governance needs depending on where it runs. A data transformation script in a sandbox can use a short-lived user-owned key under direct human supervision. The same script in a nightly production pipeline should use a service account, approved secret storage, monitoring, and a tested rotation path. Administrators should document these distinctions in policy language so teams do not infer that a key type is approved for all contexts merely because it is allowed in one project.
Rotation capability is the most overlooked column in the table. OpenAI recommends creating a replacement key before expiry, updating applications to use it, verifying the replacement, and only then revoking the old key. That sequence assumes the team knows where the old key is used, can deploy configuration changes safely, can observe whether traffic moved, and can respond if errors appear. If a team cannot perform those steps, shortening maximum lifetime may expose operational fragility before it improves security. The answer is not to avoid expiration forever; the answer is to build a rotation runbook, rehearse it in staging, and shorten lifetimes as proof improves.
What “existing keys are unaffected” should change in your rollout plan
OpenAI’s statement that governance controls affect new key creation only should be repeated in administrator communications because it prevents two dangerous assumptions. The first dangerous assumption is that enabling a stricter policy automatically secures the current estate. It does not. Existing keys must still be inventoried, protected, rotated where needed, and revoked when no longer required. The second dangerous assumption is that changing the policy will break every running service immediately. OpenAI’s documented behavior says existing keys are not changed by the creation policy itself, so administrators can activate a future-facing policy while separately scheduling legacy remediation.
A clean rollout plan should have at least four tracks. The first track is policy design: choose the organization default, decide whether projects need stricter local rules, and define maximum lifetime boundaries. The second track is communication: tell project owners what key types can be created, what lifetimes are allowed, how to request exceptions, and what will happen to existing keys. The third track is inventory: map current keys to owners, projects, environments, applications, storage locations, and usage patterns without asking anyone to paste key values into tickets or documents. The fourth track is remediation: replace or revoke keys according to risk, continuity requirements, and verified traffic migration.
The distinction also affects audit evidence. A screenshot or configuration export showing a new service-account-only policy proves that future creation is constrained at that moment; it does not prove that all existing credentials are service-account keys, unexposed, rotated, or stored correctly. Auditors, security reviewers, and enterprise administrators should request evidence of both control configuration and legacy handling. Useful evidence includes a dated policy decision, a project list, owner attestations, rotation records, spend-monitoring configuration, incident procedures, and validation logs showing that replacement keys carried expected traffic before old keys were revoked. None of that evidence should include actual API key secrets.
How maximum key lifetime fits with creation governance
Creation governance answers “what kind of key can be created.” Maximum key lifetime answers “how long a newly created key may remain valid.” OpenAI documents that administrators can enforce a maximum key lifetime at the organization or project level, and that project limits cannot exceed organization limits. This lets administrators define a broad organizational ceiling while allowing stricter limits for sensitive projects. For example, a production project handling high-risk workflows may require shorter key lifetimes than a low-risk internal development project, provided the project setting remains within the organization maximum.
Maximum lifetime is most effective when the organization can rotate without guessing. A key that expires on a predictable schedule creates a forced maintenance event; that event is safe only when applications can load new secrets, deployments can be coordinated, observability can confirm success, and owners are available before expiry. The recommended sequence is to create the replacement key before the old one expires, update the application or secret store, verify that the replacement is working, and then revoke the old key. Administrators should build dashboards, alerts, calendar reminders, or ticket workflows around that sequence rather than relying on memory.
There is a tradeoff between shorter lifetimes and operational resilience. Very short lifetimes reduce the window in which a stolen key can remain useful, but they also increase rotation frequency, change volume, and outage risk for teams with immature automation. Longer lifetimes reduce operational churn but can leave exposed or forgotten credentials active for longer. The practical decision rule is to set the organization maximum at a level the organization can actually enforce, then use stricter project settings for teams that have demonstrated reliable rotation and monitoring. Over time, as rotation becomes routine, administrators can revisit the organization maximum and shorten it through a planned change rather than an emergency mandate.
Expiration controls should also be coordinated with spend controls. OpenAI’s spend-limit guidance is relevant because a compromised or misused key can create financial exposure before anyone notices. Spend alerts and hard limits do not replace key governance, but they provide a second line of detection and containment. A team rotating keys should know which project spend limits apply, which alerts are monitored, and who responds when usage spikes during or after a credential change. If a replacement key is accidentally used by the wrong workload, spending and usage patterns may reveal the misconfiguration before users report a functional failure.
Recommended opening policy language for administrators
The following sample policy language is a recommendation, not a quotation from OpenAI and not legal advice. It is written for administrators who need a concise starting point for internal review. Adapt it to your organization’s security standards, data-classification rules, procurement requirements, incident-response process, and employment or education context. Do not include actual API keys, account identifiers, private customer data, or confidential architecture details in policy tickets or review prompts.
Sample policy proposal: New OpenAI API keys must be created only through approved project governance settings. Production and shared automation workloads must use service-account keys with a named human owner, backup owner, approved secret-storage location, documented rotation procedure, and monitoring coverage. User-owned project keys are limited to authorized development, evaluation, training, or research work and must not become production dependencies. The organization-level maximum key lifetime sets the ceiling for all projects; project owners may choose stricter maximum lifetimes when their rotation process is tested. Disabling all new key creation may be used during incident response, inventory cleanup, or governance transitions. Existing keys are not automatically changed by these settings and must be inventoried, validated, rotated, or revoked through a separate remediation process.
This kind of language is useful because it states both the control and the boundary of the control. It tells developers what to do for production, tells researchers where user-owned keys may fit, gives administrators a basis for project exceptions, and explicitly rejects the misconception that existing credentials are fixed automatically. Security teams should add concrete review requirements: where secrets may be stored, which projects are approved for staging and production, who approves exceptions, how expiry reminders are generated, what logs are reviewed, and what evidence is retained after rotation.
Enterprise administrators should also define human approval points. Human approval is mandatory before publishing credentials, changing permissions, revoking a key that may support production, disabling key creation in a way that could block incident response, approving a vendor integration, or making legal or financial commitments. Automated workflows can prepare inventories, draft tickets, remind owners, and compare usage patterns, but a qualified human owner should approve consequential changes. This rule protects against both accidental outage and unreviewed expansion of access.
Start with a governance map before changing settings
Before enabling a stricter organization policy, administrators should create a governance map that describes the current project structure and intended end state. The map does not need to contain secrets. It should list projects, environments, workload categories, accountable owners, desired key-creation mode, maximum lifetime target, spend-limit posture, monitoring owner, and exception path. This document turns a vague security objective into a change plan that can be reviewed by platform engineering, security, finance, legal operations, education administrators, or business owners depending on the environment.
| Governance map field | Why it matters | Safe example value | Do not include |
|---|---|---|---|
| Project name or internal identifier | Links policy to the project where keys are created and usage is billed | “Staging evaluation project” or an approved internal project reference | API key values, private customer names unless required and approved |
| Environment | Separates development, staging, training, and production risk | Development, staging, production, classroom lab | Secrets, live credentials, unnecessary network details |
| Allowed new key type | Documents whether service-account keys, user-owned keys, or no new keys are allowed | Service-account-only for production | Unreviewed exceptions or informal side agreements |
| Maximum lifetime target | Connects expiration policy to operational rotation capability | Use the approved organization maximum or a stricter project maximum | Unsupported claims about retroactive expiration |
| Human owner and backup owner | Ensures someone can approve rotation, investigate usage, and respond to incidents | Team role or approved internal owner reference | Personal information that is not needed for governance |
| Secret-storage location category | Confirms keys are not hard-coded or stored in uncontrolled documents | Approved secret manager, CI secret store, managed runtime variable | Actual secret values, screenshots exposing keys, command history with credentials |
| Rotation evidence | Shows whether the team can replace a key before expiry without outage | Last successful staging rotation date and validation ticket reference | Raw logs containing keys, private user data, or confidential prompts |
The governance map should be reviewed before the organization-level setting is changed because organization precedence can override project expectations. If a project currently expects user-owned keys for onboarding or evaluation, a service-account-only organization policy may require a new workflow. If a project has no tested rotation procedure, a short maximum lifetime may create recurring emergency work. The map lets administrators identify those mismatches early and either adjust the rollout order or define a temporary exception that expires after remediation.
A safe first step is to classify projects by environment and consequence. Production and shared automation should receive the strictest ownership and validation requirements. Staging should mirror production closely enough to rehearse rotation before a production change. Development and research projects may allow user-owned keys if data handling, spend limits, and expiration are controlled. Training environments should assume that learners may accidentally expose credentials and should use short lifetimes, budget constraints, and cleanup between cohorts. Incident-response or unknown-ownership environments may require disabling new key creation while inventory is completed.
Opening checklist for a controlled rollout
The checklist below is a recommended workflow for the beginning of an API key governance rollout. It deliberately starts with discovery and decision records rather than immediate revocation. Revoking a key without verifying dependencies can break production systems; leaving unknown keys untouched indefinitely can create security and financial exposure. A controlled rollout balances both risks by constraining future creation, mapping the current estate, and rotating with proof.
- Record the intended organization default. Decide whether the organization should allow only service-account keys, allow only user-owned project keys, or disable all new key creation. Document why the choice fits the organization’s workload mix and risk posture.
- Identify projects that need stricter settings. Use project-level controls to make sensitive projects more restrictive, remembering that project limits cannot exceed organization limits and organization restrictions take precedence.
- Set a maximum lifetime that matches real rotation capability. Choose an organization maximum that teams can meet, then use stricter project maximums for teams with tested rotation and monitoring.
- Communicate that existing keys are
Build the credential inventory before enforcing stricter lifetimes
OpenAI’s production best-practices guidance recommends secure secret storage, usage monitoring, separate staging and production projects, spend controls, and planned key rotation, but those controls depend on knowing which credentials exist, who owns them, what they can access, and what will break when they expire. Because OpenAI states that creation restrictions and maximum lifetime settings apply to newly created keys rather than automatically changing existing keys, an administrator should treat inventory as the first operational artifact, not as a cleanup task after enforcement.
A practical inventory should be maintained outside source code and outside chat prompts, with access limited to administrators, security staff, and workload owners who need it for rotation and incident response. The inventory should not store plaintext API keys. It should store metadata, references to the approved secret location, and evidence that the credential is being used by an approved workload. If your current spreadsheet contains copied key values, replace those values with non-secret identifiers, secret-manager paths, creation dates, and owner details before expanding access.
The first pass can start with known projects, deployment systems, and secret stores, then move outward to application configuration, CI/CD variables, container orchestration secrets, serverless environment variables, notebook environments, and integration settings. The goal is not to search developer laptops for secrets by asking people to paste them into tickets or prompts; the goal is to find authoritative records and deployment paths while avoiding new leakage during the audit.
Inventory field What to record Why it matters for expiration and rotation Operational warning Credential identifier A non-secret label such as an internal asset ID, key nickname, or secret-manager object reference. Lets administrators discuss a key without exposing the key value and supports audit trails during replacement. Do not paste the actual API key into the inventory, ticket, pull request, prompt, document, or screenshot. Owner The accountable human owner and backup owner, ideally mapped to a team or service ownership record. Expiration notices, rotation approvals, and emergency decisions need a person who can authorize changes. A distribution list is not enough unless it maps to a named on-call or service owner for urgent action. Project The OpenAI project associated with the key and the internal business system that consumes it. OpenAI’s documented governance model includes project-level controls that must remain within organization-level limits. Do not assume a project-level setting can override a stricter organization restriction; OpenAI states organization restrictions take precedence. Environment Development, staging, production, sandbox, classroom, research, or another approved environment label. OpenAI recommends separate staging and production projects; inventory should expose accidental cross-environment sharing. A production key reused in staging is a rotation and incident-response risk because tests can affect production usage and spending. Workload The application, job, service, notebook, integration, or workflow that uses the key. Rotation verification requires knowing which process should produce traffic after the replacement is deployed. A key assigned to “misc automation” or “AI experiments” is not ready for a maximum-lifetime policy. Permissions and role intent The intended access pattern, project role context, service-account purpose, and any relevant administrative boundary. Least-privilege review should happen before renewing a credential, not after another year of use. Do not treat expiration as a substitute for permission design; a short-lived overbroad key can still cause harm during its lifetime. Creation date The date the key was created, based on the platform record or local governance record. Creation date determines the age of the credential and helps identify keys created before the new governance policy. For legacy keys without reliable dates, mark the date as unknown and prioritize them for owner confirmation or retirement. Expiry or required rotation date The actual expiration date where available and the internal rotation deadline used for planning. OpenAI recommends replacing a key before expiry, updating applications, verifying the replacement, and only then revoking the old key. Do not schedule rotation on the expiry date; leave enough time for testing, rollback, and owner approval. Storage location The approved secret-manager path, vault reference, CI/CD variable name, or managed configuration reference. Rotation cannot be completed safely if teams cannot find every authorized storage location that must be updated. Storage location should identify where the secret is managed, not reveal the secret value. Usage signal Recent usage evidence, expected traffic pattern, last verified deployment, or monitoring reference. Usage monitoring helps distinguish active credentials from candidates for retirement and validates replacement traffic. Absence of observed traffic is not proof that a key is unused; batch jobs and disaster-recovery paths may be quiet for long periods. Dependencies Downstream applications, scheduled jobs, vendor integrations, data pipelines, alerts, and runbooks that rely on the key. Dependency mapping prevents hidden breakage when revoking the old key after replacement. Ask owners to identify consequential workflows, but do not ask them to paste credentials or sensitive payloads as proof. Emergency contact The on-call channel, escalation path, business owner, and security contact for urgent revocation or spend containment. Credential incidents require quick decisions about revocation, application rollback, and spend controls. Emergency contacts must be reachable during the workload’s operating hours, not only during a quarterly access review. For small teams, the inventory can begin as a restricted administrative table, but it should still follow the same non-secret structure used by larger enterprises. For larger organizations, the inventory should be linked to service catalogs, change-management records, and deployment ownership so that a departing employee, reorganized team, or archived repository does not leave an active credential without an accountable owner.
This guide covers AI agent security with emphasis on credential management, containment, and the risks of agents operating against real systems. The AI Agents Are Hacking Real Systems: Complete Guide to AI Agent Security, Credential Management, and Containment in 2026 article is a focused companion for Secrets Management because it is the most relevant candidate for secrets management because it specifically includes credential management and containment rather than generic management prompts.
Inventory workflow: discovery without creating new leakage
A safe discovery workflow begins with administrative records and approved secret stores, then validates with workload owners. OpenAI’s help article on API key safety warns against sharing API keys and recommends keeping keys secret, so the discovery process should never ask developers, educators, analysts, or contractors to paste a key into a form, email, chat, ticket, screenshot, or model prompt. The administrator should request metadata, not secret material.
- List known OpenAI projects and administrative owners. Record the project name, business purpose, environment label, and owner. If a project has no owner, classify it as a governance exception before making new keys available to it.
- Enumerate approved storage systems. Query secret managers, deployment variables, and platform configuration records for OpenAI-related secret references. Export only metadata such as secret names, paths, labels, last modified dates, and access policy references.
- Map references to workloads. Connect each secret reference to the service, job, or integration that consumes it. If the secret-manager path is used by multiple workloads, treat each workload as a separate dependency for rotation planning.
- Confirm usage signals. Compare expected usage with monitoring and spend signals. OpenAI’s production guidance recommends usage monitoring, and its spend-limit guidance supports budget-oriented controls, so unexplained usage should trigger owner review before renewal.
- Assign an expiration plan. For each credential, record the target replacement date, verification method, revocation date, and fallback owner. This date may be earlier than the platform expiration to allow safe deployment and validation.
- Mark unknowns explicitly. Do not hide missing owners, unknown creation dates, or unclear storage locations. Unknowns are rotation risks and should be visible in the exception queue.
Security teams should treat screenshots as sensitive artifacts if they display configuration pages that include key prefixes, secret names, project identifiers, environment paths, usage patterns, or internal service names. Even when a screenshot does not show the full key, it can expose enough context for social engineering or targeted access attempts. Prefer structured metadata exports, redacted evidence, and access-controlled audit records.
Define maximum lifetime policy with a replacement window, not just an expiry number
OpenAI’s production best-practices documentation says administrators can enforce a maximum key lifetime at the organization or project level, and that project limits cannot exceed organization limits. A maximum lifetime is therefore a governance boundary for newly created keys, not a complete rotation program by itself. The policy must also specify how early teams must replace a key, how verification is performed, who approves exceptions, and when the old key is revoked.
A conservative design is to separate the platform maximum from the operational replacement window. The maximum sets the latest possible expiration for newly created keys under the applicable organization and project controls. The replacement window tells teams to create a new key, update the application, verify traffic, and revoke the old key before expiration. OpenAI recommends creating a replacement before expiry, updating applications, verifying the replacement, and only then revoking the old key; that sequence should be written directly into local policy.
Policy element Administrator decision Recommended evidence Common failure mode Organization maximum lifetime Set the broad upper bound for newly created keys across the organization. Approved security policy, risk acceptance, and rollout communication. Setting a strict maximum before teams know which production services depend on long-lived legacy keys. Project maximum lifetime Set a project-specific maximum that is equal to or stricter than the organization maximum. Project owner approval and environment classification. Assuming a project can use a longer lifetime than the organization permits, even though OpenAI states it cannot. Replacement lead time Require replacement sufficiently before expiry to allow deployment, monitoring, rollback, and revocation. Change ticket, deployment record, and post-deployment usage verification. Waiting until the expiration day and discovering that a batch job, vendor integration, or production deployment process has a frozen configuration. Revocation deadline Define when the old key must be revoked after replacement is verified. Revocation timestamp, owner confirmation, and monitoring evidence showing expected traffic on the replacement. Leaving both old and new keys active indefinitely after a successful cutover. Exception duration Limit exceptions to a specific period with a named approver and renewal review. Risk rationale, compensating controls, review date, and emergency contact. Using “temporary” exceptions as permanent bypasses for unmanaged workloads. The policy should also distinguish credential lifetime from personnel lifecycle. A user-owned key tied to a developer, analyst, educator, or contractor creates different offboarding and accountability questions than a service-account key tied to a workload. OpenAI’s documented controls allow administrators to permit only service-account keys, only user-owned project keys, or no new key creation; the lifetime policy should be consistent with whichever creation mode the organization selects.
Project-versus-organization precedence in practical terms
OpenAI’s documented precedence rule is straightforward: organization restrictions take precedence over project settings, and project maximum lifetimes cannot exceed the organization maximum. Administrators should express this in operational language because teams often assume project owners can grant themselves exceptions. A project can be stricter than the organization boundary, but it cannot loosen an organization-wide restriction.
For example, if the organization policy allows only service-account keys for new creation, a project should not be documented as permitting newly created user-owned keys unless the organization restriction changes. If the organization maximum lifetime is shorter than a project’s desired setting, the project must adapt by improving rotation automation, redesigning ownership, or requesting a formal exception to the organization policy rather than relying on a project-level configuration that exceeds the boundary.
This precedence matters during mergers, lab environments, education programs, and subsidiary deployments. A central administrator may set a conservative organization policy while individual projects have different maturity levels. The safe operating assumption is that the organization setting defines the ceiling and creation-mode boundary; project owners can narrow the local posture for higher-risk workloads, production applications, or regulated business processes.
Recommended policy wording: Organization-level controls define the maximum permitted API-key creation and lifetime posture. Project-level controls may be stricter for a specific environment, workload class, or risk profile. Project-level settings must not be documented, requested, or approved as exceeding the organization maximum. Any business need that conflicts with the organization boundary must go through the exception process before new credentials are created.Policy documents should explicitly state that changing the organization or project setting does not inventory, rotate, revoke, or secure existing credentials automatically. OpenAI’s guidance for these controls is about new key creation and newly created key lifetimes. Existing keys require a separate inventory, owner confirmation, planned replacement, validation, and revocation workflow.
Separate staging and production before you shorten lifetimes
OpenAI’s production guidance recommends using separate staging and production projects. That recommendation becomes more important when maximum lifetimes are enforced because a shared key can turn a routine staging test into a production outage, spend spike, or incident investigation. If one key is used across environments, rotation timing must satisfy every dependency at once, and a failure in a non-production deployment can block safe revocation for production.
Staging and production separation should appear in the inventory as an environment field and in the policy as a hard rule for new credentials. A staging workload should use a staging project and a staging secret reference. A production workload should use a production project and a production secret reference. Development notebooks, classroom demonstrations, and research prototypes should not borrow production keys for convenience.
Environment pattern Governance interpretation Rotation implication Recommended administrator action Separate staging and production projects with separate keys Aligned with OpenAI’s recommendation to separate staging and production projects. Each environment can be rotated and verified independently. Use this as the target state for new work and for remediating legacy keys. Separate projects but shared deployment secret Project separation exists on paper but rotation coupling remains. Updating one secret may unexpectedly affect multiple deployment paths. Split the secret-manager entries and redeploy each environment with its own reference. One project serving staging and production Environment boundaries are weak for usage monitoring, spend analysis, and incident response. Expiration and revocation can affect both environments simultaneously. Create an environment separation plan before imposing aggressive lifetime limits. Production key copied into local development or notebooks High-risk pattern inconsistent with secure handling and least-privilege expectations. The key may leak through logs, notebook outputs, local history, screenshots, or prompts. Revoke and replace after impact review; move developers to approved non-production credentials. For enterprise administrators, the decision rule should be simple: do not grant longer lifetimes to compensate for mixed environments. Mixed environments should be treated as remediation work. If a production key is used in staging because a test suite needs realistic behavior, create a staging equivalent with appropriate spend controls and representative test data rather than sharing a production credential.
Staging rotation rehearsal before production cutover
A staging project should be used to rehearse the exact replacement sequence before applying it to production. The rehearsal should include creating a replacement key under the current governance rules, updating the secret-manager value, redeploying the workload, confirming expected usage signals, checking application logs for authentication errors, validating spend alerts where applicable, and revoking the previous staging key after successful verification.
That rehearsal is not proof that production will succeed, because production may have different traffic volume, deployment freezes, network controls, approval rules, or downstream dependencies. It does, however, test the team’s runbook and reveal missing owners, undocumented configuration paths, and brittle deployment steps. The production cutover should still require human approval, a rollback plan, and monitoring during the verification window.
Example staging rehearsal evidence checklist: - Replacement key was created under the approved project and creation mode. - Secret-manager reference was updated without exposing the key in logs or tickets. - Deployment completed through the normal release path. - Expected staging traffic appeared after deployment. - Authentication failures did not increase beyond the agreed threshold. - Spend and rate-limit monitoring were reviewed for abnormal behavior. - Old staging key was revoked only after replacement verification. - Production owner approved or rejected proceeding to production.Founders and small teams often skip staging because the first application has only one deployment. That shortcut becomes expensive when a key expires unexpectedly or when a leaked credential must be revoked quickly. Even a lightweight staging project with limited test traffic and capped spend can provide enough separation to practice rotation and verify application behavior before touching production.
Require approved secret-manager storage and ban keys in informal systems
OpenAI’s API key safety guidance advises keeping API keys secret and avoiding exposure in code or public places, while the production best-practices guidance recommends secure secret storage rather than hard-coding. A local governance policy should convert that guidance into enforceable handling rules: API keys belong in approved secret-management systems or managed deployment configuration, not in repositories, source files, prompts, tickets, screenshots, email threads, slide decks, spreadsheets with broad access, browser notes, or personal password documents used outside the organization’s approved process.
The prohibition should be broad because leakage often happens during support and collaboration, not only during development. A developer may paste a key into a pull-request comment while debugging. A founder may send a screenshot of an environment-variable page to a contractor. A teacher may include a key in a classroom notebook. A legal-technology professional may add a key to a matter support ticket. A knowledge worker may paste a configuration block into a prompt asking an AI assistant to “fix it.” Each pattern creates a copy outside the intended control plane and should be treated as a security event or at least a reportable handling violation.
Location Policy status Reason Required response if found Approved secret manager or managed deployment secret Allowed when access is limited and audited according to local policy. Supports controlled access, rotation, deployment updates, and incident response. Verify owner, workload, environment, and rotation schedule in the inventory. Application source code or configuration committed to a repository Prohibited. Repository history, forks, build logs, and developer clones can preserve the secret after removal. Assume exposure, replace the key, review access, and follow incident-response procedures. Issue trackers, support tickets, chat tools, or email Prohibited. Collaboration systems often have broad access, retention, indexing, and notification copies. Remove or restrict the content where possible, rotate the key, and educate the sender. AI prompts or generated debugging transcripts Prohibited. Prompts and transcripts can be stored, reviewed, exported, or shared outside the secret-management boundary depending on product and policy. Do not ask the model to inspect real keys; replace exposed credentials and use placeholders in future prompts. Screenshots, recordings, slide decks, and documentation images Prohibited if they display key values or sensitive credential context. Images are easy to forward and difficult to search reliably for secret exposure. Remove the artifact, rotate if a key or sufficient secret material was visible, and replace with redacted diagrams. Local shell history, notebooks, and ad hoc scripts Prohibited unless the local handling pattern is explicitly approved and does not expose the key. Interactive tools often persist commands, outputs, checkpoints, and temporary files. Clean up according to internal procedures, rotate if exposure is plausible, and move to managed environment variables or secret injection. The policy should also define what a safe example looks like. Documentation, training, runbooks, and prompts should use placeholders such as
<OPENAI_API_KEY_SECRET_REFERENCE>,OPENAI_API_KEYas an environment-variable name, or a secret-manager path that does not reveal the secret value. Do not use a string that resembles a real key, because readers may copy it into scanners, logs, or examples and normalize unsafe handling.Safe documentation pattern: Application reads the API key from the approved runtime secret injection mechanism. The runbook records the secret-manager reference, not the key value. Environment variable name: OPENAI_API_KEY Inventory storage-location field: <approved-secret-manager>/<team>/<service>/openai-api-key Never include: - the plaintext key - a screenshot containing the key - a terminal transcript that printed the key - a prompt asking an AI system to inspect the keyAdvanced ChatGPT, Work, and Codex users need an additional warning: secret-safe prompting is part of API-key governance. If a troubleshooting request requires configuration context, provide redacted variable names, non-secret error messages, deployment architecture, and policy constraints. Do not provide real API keys, bearer tokens, OAuth client secrets, account identifiers that are not necessary, or proprietary payloads. Human approval remains mandatory before changing permissions, revoking production credentials, updating deployment configuration, or sending external communications about a credential incident.
Create an exception process that is narrower than the policy
Any maximum-lifetime policy will encounter workloads that cannot immediately comply: legacy deployments without automated redeploys, vendor-managed integrations, research systems with irregular usage, or production services operating under change freezes. The answer should not be an undocumented bypass. The answer should be a time-limited exception with accountable approval, compensating controls, and a specific remediation plan.
An exception process should begin with the question, “Why can this workload not comply with the standard maximum lifetime and replacement window?” If the reason is inconvenience, missing ownership, or unclear deployment steps, the request should usually become a remediation task rather than an exception. If the reason involves a valid operational constraint, the exception should document the risk, limit the duration, require monitoring, and name the person responsible for returning the workload to standard policy.
Exception field Required content Approval rule Expiration rule Workload and project The exact workload, OpenAI project, environment, and owner. Must be approved by the project owner and security or platform governance owner. Exception ends when the workload is remediated or on the stated review date, whichever comes first. Reason standard policy cannot be met A concrete blocker such as vendor release timing, deployment freeze, or missing rotation capability. Generic claims such as “too risky” or “too busy” require escalation and a remediation plan. The blocker must have an owner and target resolution date. Compensating controls Monitoring, spend alerts, reduced permissions, restricted storage access, additional review, or shorter manual check-ins. Controls should reduce risk without pretending that the exception is equivalent to compliance. Controls remain active until the exception closes and the key is rotated or retired. Emergency action Who may revoke the key, pause the workload, adjust spend controls, or trigger incident response. Must include an emergency contact reachable during operating hours. Emergency authority should not depend on the original requester being available. Review and closure evidence Rotation proof, deployment verification, usage signal, old-key revocation, and updated inventory. Closure requires evidence, not a verbal statement that the key was changed. Expired exceptions should be reported as governance findings until closed or renewed through formal approval. Exception review should be stricter for production, external-facing services, high-spend workloads, regulated data contexts, legal-technology systems handling client matter context, classroom environments involving minors, and any workflow that can send external messages, trigger purchases, change access, or produce consequential outputs. API-key lifetime policy does not decide whether those workflows are legally or ethically appropriate; it only reduces one class of credential risk. Qualified human review and domain-specific compliance obligations remain separate requirements.
Sample exception request template
The following template is a policy proposal, not an OpenAI form. It is designed to collect enough information for a security or platform team to evaluate a temporary deviation without asking the requester to disclose a secret. Replace bracketed placeholders with local asset names and do not include API keys, tokens, screenshots containing secrets, or confidential payloads.
API key lifetime exception request Requester: - Name: - Team: - Role: - Emergency contact: Credential metadata: - Inventory ID: - OpenAI project: - Environment: - Workload: - Secret-manager reference: - Current expiration or rotation deadline: - Requested exception end date: Reason for exception: - Standard policy requirement that cannot be met: - Concrete blocker: - Why replacement cannot be completed before the deadline: - Business impact if the key expires before remediation: Risk and controls: - Data sensitivity category: - Expected usage pattern: - Spend monitoring in place: - Rate-limit or budget controls reviewed: - Additional logging or alerting: - Permission reduction options considered: - Staging rehearsal completed? yes/no, with evidence reference: Remediation plan: - Owner: - Milestones: - Target date for replacement: - Target date for old-key revocation: - Rollback plan: - Human approver for production change: Approvals: - Workload owner: - Project administrator: - Security/platform reviewer: - Business owner if required:Run rotation as create-replace-validate-revoke, not as a last-minute expiry scramble
Create-replace-validate-revoke rotation is the safest operating pattern for OpenAI API keys because it preserves service continuity while moving applications to a fresh credential. In this guide, the phrase means: create a replacement key before the old key expires, replace the secret in the approved secret store or deployment mechanism, validate that the application is successfully using the replacement, and revoke the old key only after evidence shows the cutover is complete. OpenAI’s production best-practices guidance recommends creating keys with expiration dates and replacing a key before expiry, then updating applications, verifying the replacement, and revoking the old key.
This sequence matters because expiration is not a deployment system. A key reaching its expiration date may stop dependent workloads at the worst possible time, while an administrator who revokes too early may interrupt production traffic even if a replacement key exists somewhere else. Treat the expiration date as a control boundary and the replacement window as the actual change-management period. A practical operating rule is to schedule rotation far enough ahead of expiry that teams can recover from a failed cutover without emergency policy exceptions, new unreviewed keys, or rushed production edits.
Dual-key overlap is the temporary period when both the old key and the replacement key are valid, stored in authorized locations, and intentionally monitored. The overlap is not an excuse to keep redundant credentials indefinitely. It is a controlled safety interval that lets a deployment roll forward, lets health checks prove that the new credential works, and gives the operator a fallback path if the application cannot authenticate with the replacement. The overlap should have an owner, a scheduled end, and an explicit revocation task for the old key.
OpenAI’s documented API-key governance controls are creation and lifetime controls, not a full credential-management system. Administrators can restrict newly created keys to service-account keys, restrict newly created keys to user-owned project keys, or disable new key creation; they can also enforce maximum key lifetimes at the organization or project level, with project settings constrained by the organization maximum. These controls do not rotate, revoke, inventory, or secure existing keys automatically. Existing keys remain a separate operational responsibility that requires inventory, secret-store enforcement, monitoring, incident response, and accountable human approval.
This article explains how to rotate expiring OpenAI project API keys across Codex, CI/CD, and agent workflows without downtime under new expiration and lifetime policies. The Rotate Expiring OpenAI Project API Keys Across Codex, CI/CD, and Agents Without Downtime article is a focused companion for API Key Rotation because it directly matches API key rotation and expiration handling, which is the exact operational outcome needed for this marker.
Define the rotation roles before any key is created
A rotation runbook needs named roles because API keys sit at the boundary between administration, application operations, security, and finance. The key creator should be authorized under the organization’s governance mode. The application owner should confirm which services, jobs, environments, and scheduled tasks depend on the key. The deployment owner should update the secret store or runtime configuration. The security reviewer should confirm least privilege, approved storage, and absence of unnecessary copies. The incident commander role should be predefined for any suspected leak or uncontrolled authentication failure.
For service-account keys, the service owner should be stable across employee changes, and the service account should be mapped to the project and environment it serves. For user-owned project keys, the accountable user should understand that their employment status, role change, or project access change can create operational risk if the key is embedded in shared systems. The correct choice depends on the organization’s operating model; service-account-only creation is not universally correct, and user-owned keys are not inherently wrong when the organization has a clear need, a tight scope, and a reliable offboarding process.
A useful rotation ticket should identify the project, environment, dependent applications, current key owner type, target key owner type, old key identifier as shown in approved admin tooling, planned creation date, planned replacement date, validation method, rollback criteria, final revocation date, and approver. Do not place the full secret value in the ticket, chat, email, pull request, document, screenshot, or model prompt. The record should prove that rotation happened without turning the ticketing system into a secondary credential store.
Use least privilege as the rotation baseline, not as a cleanup afterthought
Least privilege means granting only the access required for the workload to perform its approved function, in the appropriate project and environment, with no unnecessary cross-environment reuse. OpenAI’s production best-practices guidance recommends separating staging and production projects, using secure secret storage instead of hard-coding, monitoring usage, planning for rate limits, and conducting security and compliance review. In rotation planning, those recommendations translate into a rule: do not merely clone the old operational pattern if the old pattern mixed staging and production, lived in source code, or served too many applications.
Rotation is often the first moment when an organization discovers that one key supports a production API, a nightly analytics job, a staging experiment, and a developer’s local script. Replacing that single key with another single key preserves the blast radius. A better rotation plan separates workloads into project-appropriate credentials before the old key is revoked, subject to the organization’s creation governance policy. If new key creation is disabled for most users, the exception path should still allow authorized administrators to create the specific replacement keys required for a controlled split.
Least privilege also requires removing informal copies. If a key appears in a deployment variable, a local shell profile, a notebook, a CI system, and a shared document, the key is not governed merely because the project has a maximum lifetime. The rotation plan should move the active secret into an approved secret-management path and require teams to delete unauthorized copies. Where deletion cannot be proven, treat the key as exposed and prioritize revocation after the replacement validates.
Build health checks that prove the new key is actually carrying traffic
Health checks are objective tests that show the replacement key is valid, authorized for the intended workload, and in use by the correct application path. A superficial test that confirms “the application still responds” is not enough when caches, retry paths, background workers, or fallback credentials could hide a failed cutover. The health check should include authentication success, expected model or API behavior for a safe non-sensitive request, application logs that show the newly deployed configuration version, and usage evidence that aligns with the workload being migrated.
A safe validation request should avoid private data, regulated data, customer secrets, and privileged business content. Use a minimal non-sensitive prompt or fixture designed for operational verification rather than real production payloads. The purpose is to verify connectivity, authorization, request routing, and error handling, not to test model quality or process confidential records. If the workload normally processes sensitive material, validate the credential path with a synthetic input first, then allow the application owner to approve broader production observation under existing privacy and security rules.
Health checks should cover both synchronous and asynchronous execution paths. A web application may authenticate successfully on an interactive request while a background worker continues using the old key from an older container image or a separate secret reference. Scheduled jobs may not run during the initial cutover window. Stream processors, queues, batch pipelines, evaluation harnesses, and notebooks can each have a separate configuration path. The validation plan should list every path and include a time window long enough to observe low-frequency jobs before the old key is revoked.
Validation target What to prove Evidence to capture Common failure pattern Primary application runtime The deployed application can authenticate with the replacement key and complete a safe request. Deployment version, request timestamp, non-sensitive success log, and owner sign-off. The application restarted but still reads an old environment variable or stale secret reference. Background workers Workers use the replacement credential after restart or redeploy. Worker release identifier, job completion log, and absence of authentication errors. Only web containers were updated; workers kept the previous secret until the next scheduled restart. Scheduled jobs Cron-like tasks, batch jobs, and notebooks still run after the secret change. Next scheduled execution result or an approved manual dry run with synthetic data. The job fails hours later because it reads a local file or unapproved copy of the old key. Staging environment The procedure works before production and uses a staging project, not production credentials. Staging rotation ticket, test result, and corrections applied before production. Teams validate against production because staging was never separated or lacks equivalent configuration. Spend and usage telemetry Usage after cutover matches expected workload patterns and does not show unexplained spikes. Usage review, spend alert status, and finance or platform acknowledgement where required. Both old and new keys remain active in different paths, doubling activity or hiding an orphaned integration. Use audit evidence to prove governance without collecting secrets
Audit evidence is the non-secret record that demonstrates a key was created, approved, stored, deployed, validated, and revoked according to policy. Useful evidence includes the governance mode in effect, the maximum-lifetime policy, the project and environment, the service owner, the change ticket, the deployment record, validation logs, spend or usage review notes, revocation confirmation, and exception approval if one was needed. It should never include the API key value itself.
Evidence should be precise enough for a future administrator to understand what happened after the people involved have changed roles. A rotation ticket that says “rotated OpenAI key” is weak evidence. A better record says that the production summarization service in a named project moved from the prior key identifier to the replacement key identifier on a specified date, that the key is stored only in the approved secret manager path, that synthetic health checks passed, that the old key was revoked after confirmation, and that usage was reviewed for abnormal behavior.
Because OpenAI’s governance controls apply to new key creation and maximum lifetime, audit evidence should separate policy enforcement from operational cleanup. An auditor or security reviewer should be able to see that a maximum lifetime was configured for newly created keys and also that old credentials were inventoried, replaced, and revoked by a human-run process. Treat these as two complementary controls. The policy narrows future drift; the inventory and rotation program remediates existing risk.
Plan failed cutover rollback without normalizing permanent dual credentials
Failed cutover rollback is the controlled decision to restore the previous known-good credential path when the replacement key does not work, the application cannot read the new secret, or the deployment introduces unrelated production errors. Rollback is not the same as abandoning rotation. It is a temporary recovery step with a new diagnosis task, a revised deployment plan, and a new revocation date. The old key should remain active only as long as necessary to keep the approved workload running while the failure is corrected.
A rollback decision should be based on predefined criteria. Examples include repeated authentication failures after deployment, error rates outside the service’s acceptable threshold, missing usage evidence for the replacement key, background jobs that cannot be validated before a business-critical deadline, or a mismatch between the key’s project and the workload’s project. Do not revoke the old key while these criteria are unresolved unless there is a confirmed or strongly suspected compromise that requires emergency containment.
The rollback plan should also prevent accidental expansion of access. If the new key fails because it lacks a permission or is scoped to the wrong project, the answer is not to create a broad emergency key and distribute it through chat. The safer approach is to pause, identify the exact missing authorization or configuration issue, create or adjust the replacement through approved administrator procedures if policy allows, redeploy through the normal secret path, and capture the reason for the exception. Human approval is mandatory for permission changes and production redeployments.
Recommended rotation ticket checkpoints 1. Confirm project, environment, workload owner, and key owner type. 2. Create replacement key under the approved governance mode. 3. Store replacement only in the approved secret-management location. 4. Deploy configuration that references the replacement key. 5. Run synthetic health checks without confidential payloads. 6. Confirm expected usage and absence of authentication errors. 7. Monitor scheduled jobs and background workers. 8. Revoke the old key after validation evidence is complete. 9. Record revocation confirmation and close the ticket. 10. If cutover fails, rollback through the previous approved secret path and open a corrective task.Clean up orphan keys before they become incident root causes
Orphan-key cleanup is the process of finding and retiring keys that no longer have a clear owner, active workload, approved storage location, or business purpose. Orphan keys are especially dangerous because they may continue to authenticate even when everyone assumes the system was decommissioned. Creation governance reduces the chance of new uncontrolled credentials, but it does not identify old keys that were created before the policy, copied outside the secret store, or forgotten after a project changed hands.
An orphan-key review should start from the inventory rather than from rumor. Compare known key identifiers, project ownership records, service catalogs, deployment systems, CI variables, secret-manager entries, and usage patterns. If a key has no current owner but shows recent usage, treat it as an investigation, not an immediate deletion, unless security policy requires containment. The usage may belong to an undocumented production dependency, an unauthorized script, or a leaked credential. Each outcome requires a different response.
For keys with no recent usage and no owner, the conservative process is to announce a planned revocation to the relevant project owners, wait through a defined observation window, monitor for errors or support tickets, and then revoke. For keys with recent usage and no owner, assign an investigator to identify the source before revocation where business continuity permits. If the usage pattern suggests leakage, abuse, or unauthorized access, move to the credential incident response process instead of treating it as routine cleanup.
Respond to leaks as security incidents, not as ordinary rotations
Leak response is the emergency process for a key that may have been exposed outside authorized storage, such as in source code, logs, screenshots, browser history, chat, notebooks, package artifacts, or a third-party system. OpenAI’s help guidance on API-key safety recommends keeping keys secret, not sharing them, not exposing them in client-side code, and rotating keys if exposed. In incident mode, the priority changes: contain the credential, preserve necessary evidence, determine scope, review usage and spend, and replace the key safely.
Do not paste a suspected live key into a ticket, model prompt, scanner, email, or public tool to “check” whether it is real. Instead, record where it was found, who had access to that location, when it may have been exposed, which project and workload it appears to affect, and whether any suspicious usage appears in authorized administrative views. If the full value is already present in an internal system, restrict access to the record according to your security policy and avoid creating more copies during the investigation.
Leak response usually compresses the create-replace-validate-revoke sequence, but it should not skip validation unless immediate revocation is necessary to prevent ongoing abuse. If the workload is critical and the key is suspected but not confirmed to be actively abused, create a replacement through the approved path, deploy it quickly, validate essential traffic, and revoke the exposed key. If there is evidence of active misuse, revocation may need to happen before full application validation, with an emergency outage or degraded mode accepted by the accountable business owner.
This cybersecurity prompt collection focuses on threat analysis, incident response, and security audits, providing a practical companion for structuring human-led triage, containment, evidence review, and follow-up after a credential event. The 15 ChatGPT-5.5 Prompts for Cybersecurity Professionals: Threat Analysis, Incident Response, and Security Audits article is a focused companion for Credential Incident Response because the target explicitly centers incident response and security auditing, making it more accurate than the draft DevOps prompt target whose automated bridge summary described a different article.
Investigate usage before and after rotation
Usage investigation is the disciplined review of request activity, spend patterns, application logs, and workload expectations to determine whether a key is being used appropriately. OpenAI’s production best-practices guidance recommends monitoring usage, and its spend-limits guidance supports operational controls such as spend limits and alerts. Usage investigation turns those controls into a rotation and incident-response practice: before rotation, understand normal behavior; during cutover, confirm migration; after revocation, verify that the old key no longer contributes traffic.
Start with a baseline for each key or workload: expected applications, approximate traffic windows, known batch schedules, typical environments, and anticipated owners. Avoid inventing precision where the organization lacks data. The first review may simply distinguish “interactive daytime application traffic,” “nightly batch workload,” and “unknown usage.” That distinction is still useful because unknown usage should block routine revocation until the risk is assessed or the business owner accepts the disruption.
During rotation, usage investigation should answer three questions. First, did traffic shift to the replacement credential or approved workload path after deployment? Second, did the old key continue to show activity after the cutover window, indicating a missed dependency or unauthorized copy? Third, did total usage or spend change unexpectedly, suggesting duplicate traffic, retries, abuse, or a misconfigured loop? These checks protect both availability and cost governance.
After a suspected leak, usage investigation should be more skeptical. Look for spikes, unfamiliar timing, unexpected environments, unusual error patterns, and activity that does not align with the application’s normal behavior. A usage anomaly is not proof of compromise by itself, but it is enough to justify containment steps, deeper log review, and security escalation. If the organization has legal, contractual, or regulatory notification obligations, involve qualified counsel and the appropriate privacy or security leadership rather than making ad hoc promises to customers or partners.
Use spend controls as guardrails, not as substitutes for credential security
Spend controls are budget and alerting mechanisms that help administrators detect and limit unexpected API usage. OpenAI provides spend-limits guidance, and the production best-practices material recommends spend alerts and hard limits as part of operational readiness. These controls are essential for API-key governance because leaked, duplicated, or misconfigured credentials can create financial exposure before a team notices functional errors. Spend controls should be configured alongside rotation policy, not after the first incident.
Spend controls do not secure the key itself. A hard limit may reduce financial blast radius, but it does not tell you where the key was copied, whether data was sent through an unauthorized workflow, or whether an application is still depending on an orphaned credential. Use spend alerts as an early-warning signal and as a validation input during rotation, but continue to enforce secret storage, least privilege, inventory, monitoring, and incident response.
Administrators should align spend controls with project separation. If staging and production share a project or credential, a test loop can interfere with production budget visibility, and a production spike can obscure staging mistakes. Separate projects make it easier to set environment-appropriate limits, route alerts to the right owners, and interpret usage during rotation. This aligns with OpenAI’s production guidance to separate staging and production projects and to monitor usage.
Control Primary purpose What it does not do Operational decision rule Maximum key lifetime Limits how long newly created keys can remain valid before replacement is required. Does not retroactively expire, rotate, or inventory existing keys by itself. Set a lifetime that teams can reliably rotate within, then measure missed rotations as governance failures. Creation restriction Controls whether new keys can be service-account keys, user-owned project keys, or disabled for creation. Does not revoke old keys or prove that existing keys are stored safely. Choose the mode that matches accountability and operational ownership, then run a separate cleanup program. Approved secret storage Keeps active secrets out of source code, chats, local notes, and client-side applications. Does not automatically remove copies already leaked into unauthorized systems. Block production use unless the key is referenced through the approved secret path. Usage monitoring Shows whether workload activity matches expectations before and after rotation. Does not identify every user who saw or copied a key. Investigate unexplained activity before routine revocation and escalate suspicious activity as an incident. Spend alerts and hard limits Reduce financial surprise and detect abnormal usage patterns. Do not prevent data exposure or replace revocation after a leak. Route alerts to both workload owners and platform/security contacts with a documented response path. Write rotation runbooks that include validation, rollback, and revocation evidence
A rotation runbook should be short enough to execute during an operational window and complete enough to prevent improvisation. It should identify prerequisites, creation authority, secret-store path, deployment mechanism, test fixtures, health checks, monitoring windows, rollback triggers, final revocation, and audit evidence. The runbook should also state what operators must not do: do not paste real keys into prompts or tickets, do not hard-code replacements into source, do not distribute keys through chat, do not bypass workspace policy, and do not leave dual-key overlap open-ended.
The strongest runbooks contain separate tracks for routine rotation, urgent pre-expiry rotation, and leak response. Routine rotation can wait for scheduled deployment windows and full validation across all workloads. Urgent pre-expiry rotation prioritizes continuity when a key is close to expiration but not known to be exposed. Leak response prioritizes containment and may require accelerated revocation, spend review, access review, and legal or compliance escalation. Treating all three scenarios as identical creates either unnecessary outages or insufficient containment.
The revocation step deserves its own checklist item because many teams complete the replacement and forget the cleanup. A successful replacement without revocation leaves an unnecessary credential alive. The operator should confirm that the old key is no longer referenced in approved secret stores, no dependent workloads still require it, usage has stopped or is understood, and the application owner has signed off. Only then should the old key be revoked in the normal case.
Sample operating policy for rotation and validation
The following sample policy is a starting point for internal adaptation, not legal advice and not a statement of OpenAI product behavior beyond the cited official guidance. It is intentionally conservative because API keys can authorize paid usage and production workflows. Adjust the wording to match your organization’s roles, approval system, security standards, and contractual obligations.
Sample policy proposal: All OpenAI API keys must be created under the organization’s approved key-creation governance mode and assigned to a documented project, environment, owner, and workload. Newly created keys must follow the maximum lifetime configured by the organization or project, subject to organization precedence. Existing keys are not considered remediated merely because governance controls were enabled; they must be inventoried, replaced, validated, and revoked through the approved rotation process.
Production rotation must follow create-replace-validate-revoke. Operators must create a replacement before expiry, store it only in the approved secret-management system, deploy it through the approved release process, validate application health with non-sensitive fixtures, review usage and spend behavior, and revoke the old key after successful cutover. Dual-key overlap is permitted only for a defined validation window with an owner and scheduled revocation task.
Suspected exposure of an API key is a security incident. The response team must avoid copying the secret into additional systems, preserve non-secret evidence, replace and revoke according to containment needs, investigate usage and spend, and involve security, privacy, legal, or compliance leadership where required. Human approval is mandatory for production changes, permission changes, external notifications, legal commitments, and other consequential actions.
Practical validation workflow for production administrators
Operational workflow recommendation: begin each production rotation with a read-only review of the inventory, not with immediate key creation. Confirm that the key’s owner, project, environment, application, storage path, and dependent jobs are known. If any of those fields are unknown, assign discovery before setting a revocation date. A key with unknown dependencies is an availability risk; a key with unknown storage is a security risk; a key with unknown usage is both.
- Open a rotation ticket. Record the project, environment, workload, owner, current key identifier, target rotation date, expiry date if known, and approvers. Do not include the secret value.
- Confirm policy fit. Verify that new key creation is allowed for the required owner type and that the replacement will comply with the applicable maximum lifetime. Remember that organization restrictions take precedence over project restrictions.
- Create the replacement. Use the approved administrative path and immediately place the secret in the approved secret manager or deployment secret mechanism. Avoid local files, screenshots, chat messages, and ticket comments.
- Update the application reference. Change the runtime secret reference or deployment configuration so the application reads the replacement key. Require human approval for production deployment.
- Run synthetic health checks. Use non-sensitive inputs to confirm authentication, expected application behavior, and logging. Include background workers and scheduled jobs where applicable.
- Review usage and spend. Confirm that activity aligns with the migrated workload and that no unexplained spike appears after deployment.
- Hold a bounded dual-key overlap. Keep the old key active only through the planned validation window or rollback window. Assign an owner to close it.
- Revoke the old key. Revoke only after validation succeeds, unless incident containment requires faster action. Capture non-secret revocation evidence.
- Close with evidence. Attach deployment records, validation results, usage review notes, and approver sign-off. Do not attach secrets.
This workflow deliberately separates authentication validation from business-output validation. A key rotation should prove that the application can authenticate and operate through the new credential path. It should not be used as an opportunity to silently change prompts, model selections, data-retention assumptions, tool permissions, or application behavior. If those changes are needed, treat them as separate releases with their own evaluations, approvals, and rollback plans.
Incident workflow for a suspected exposed OpenAI API key
Operational workflow recommendation: when exposure is suspected, assume that every new copy of the secret increases risk. The first responder should not paste the key into a browser search, a chat assistant, an issue tracker, or a third-party checker. Instead, capture the location of the exposure, restrict access where possible, notify the designated security contact, and determine whether immediate revocation is required. If the key is actively being abused or the exposure is public, revocation may need to happen before a perfect replacement plan exists.
- Contain the source. Remove public access to the exposed location where authorized, or escalate to the owner who can. Preserve necessary metadata without spreading the secret.
- Identify the affected project and workload. Use approved administrative records and inventory. Do not rely on the exposed text alone if the value should not be copied further.
- Review usage and spend. Look for activity outside expected workload patterns, unexplained spikes, unfamiliar timing, or abnormal errors.
- Create and deploy a replacement if continuity is required. Use the approved secret path and accelerated human approval. For non-critical or clearly abused workloads, immediate revocation may take priority.
- Revoke the exposed key. Confirm revocation through the approved administrative view or process and record non-secret evidence.
- Hunt for additional copies. Check repositories, logs, build artifacts, local configuration patterns, notebooks, and documents according to authorized procedures.
- Decide whether notifications or legal review are required. Involve qualified security, privacy, compliance, and legal personnel. Do not improvise external statements.
- Complete corrective actions. Update storage practices, add detection rules where appropriate, revise rotation runbooks, and train the team that created or exposed the key.
The post-incident review should avoid blame-driven shortcuts. The useful questions are operational: Why did the key exist in that location? Why did monitoring not catch it sooner? Was the key overbroad for its workload? Did spend controls alert the right people? Did the governance mode permit unnecessary creation? Were staging and production separated? Were old keys already orphaned? Each answer should become a concrete remediation task with an owner and date.
Common rotation failures and how to prevent them
Operating model: turn key governance into a managed control
An effective OpenAI API key program needs an operating model that survives staff changes, deployment pressure, and incident response. OpenAI’s production best-practices guidance recommends secure secret storage, monitoring usage, separating staging and production projects, using spend controls, and performing security and compliance review; the governance model should translate those recommendations into named responsibilities, review cycles, evidence requirements, and exception expiry rather than leaving them as informal developer habits.
The central rule is simple: administrators can restrict new key creation, set maximum key lifetimes for newly created keys, and choose whether new keys must be service-account keys, user-owned project keys, or disabled entirely. Those settings do not automatically inventory, rotate, revoke, or secure existing credentials. The operating model must therefore cover two tracks at the same time: policy enforcement for future key creation and active remediation of keys that already exist in applications, CI/CD systems, vendor integrations, and local developer environments.
Use the following operating cadence as a recommended baseline, then tighten it where your risk profile requires stricter governance. Every production key should have an owner, a project, a system purpose, an approved storage location, a maximum lifetime aligned to policy, a replacement window before expiry, usage monitoring, and a revocation record. A key that cannot meet those conditions should either be retired, migrated to a better ownership pattern, or placed under a time-limited exception with a named approver.
Operating activity Recommended cadence Primary evidence Failure condition that requires action Key inventory reconciliation Monthly for production; quarterly for all projects Key register without secret values, project mapping, owner attestation Unknown owner, unknown application, missing storage location, or unexplained usage Maximum lifetime review Quarterly and before major application releases Organization policy, project settings, exception list, renewal schedule Project setting exceeds organization policy intent, or keys are expiring without tested replacements Rotation validation Per rotation event Deployment record, traffic validation, error-rate check, old-key revocation confirmation Replacement key created but old key not revoked, or traffic proof is missing Usage and spend monitoring Continuous monitoring with periodic review Usage reports, alert history, spend-limit configuration, incident notes Unexpected project activity, abnormal cost, unexplained model usage, or alert fatigue Offboarding cleanup At user departure, role change, vendor exit, or project closure Access removal ticket, key ownership transfer or revocation record Former user, contractor, or vendor remains associated with active credentials This enterprise guide covers OpenAI spend controls and usage analytics for monitoring, optimizing, and governing AI costs across an organization. The The Enterprise Guide to OpenAI Spend Controls and Usage Analytics: How to Monitor, Optimize, and Govern AI Costs Across Your Organization in 2026 article is a focused companion for Spend Limit Controls because it directly supports spend-limit governance by focusing on OpenAI cost controls, usage visibility, and organizational budget governance.
RACI for administrators, developers, security, finance, and vendors
A RACI matrix prevents the common failure where platform administrators set creation restrictions while application owners assume someone else tested the replacement key. The matrix below is a recommended operating model, not an OpenAI product permission map. Your actual implementation must follow your organization’s identity, project-role, change-management, and procurement procedures.
Task Responsible Accountable Consulted Informed Define organization-level key creation mode and maximum lifetime policy Platform administrator Security or infrastructure leadership Application owners, compliance, finance Engineering teams and support teams Define project-level settings within the organization boundary Project administrator or platform owner Application owner Security, SRE, release management Developers using that project Create replacement key before expiry Authorized project administrator or approved service-account owner Application owner Security and release engineer Operations and support teams Store key in approved secret manager or deployment secret store Release engineer or platform team Application owner Security architecture Developers who maintain deployment code Deploy replacement to application, worker, or CI/CD environment Release engineer Application owner SRE, QA, security Help desk or business stakeholders if downtime risk exists Validate traffic, permissions, errors, and cost after cutover SRE or application team Application owner Finance operations and security monitoring Platform administrator Revoke old key after validation Authorized administrator Application owner Security SRE and release team Approve exceptions and expiry extensions Risk owner or designated exception board Security leadership Application owner, compliance, legal where needed Platform administrator and audit stakeholders Review vendor or contractor access Vendor manager or application owner Business system owner Security, procurement, legal Platform administrator The accountable party should be the person who can accept the risk of downtime, leakage, unexpected spend, and business interruption. A platform team can configure organization policy, but it cannot safely certify continuity for every application unless the application owner validates real traffic, background jobs, failure handling, and downstream dependencies. A security team can require shorter lifetimes, but it should not bypass release testing by forcing expiry dates that applications cannot meet.
Policy-as-code opportunities without assuming OpenAI product behavior
Policy-as-code can make key governance repeatable, but it should not be described as an OpenAI API feature unless the official documentation explicitly supports that behavior. Treat policy-as-code as your organization’s wrapper around deployment, infrastructure, CI/CD, ticketing, and audit workflows. It can verify whether internal change requests include required fields, whether deployment manifests reference approved secret locations, whether repository scans find forbidden credential patterns, and whether exception records expire on time.
A safe policy-as-code design avoids storing, printing, or validating real API key values. It should evaluate metadata and configuration evidence: project name, environment, owning team, secret-manager reference, rotation due date, exception identifier, approval status, and last validation time. If a scanner detects a likely secret in source code, logs, tickets, chat, or documentation, route it to the incident process rather than copying it into more tools for analysis.
Recommended policy-as-code checks
- No secret literals in repositories: block commits or pull requests that appear to add API keys, tokens, or environment files containing live credentials. The scanner output should redact sensitive values and provide only file path, line number, detector type, and remediation instructions.
- Approved storage reference required: require production deployments to reference an approved secret manager, deployment secret store, or equivalent controlled mechanism rather than plaintext configuration files or manual copy-paste procedures.
- Owner and rotation metadata required: require every production OpenAI credential reference to include an owning team, escalation contact, project, environment, purpose, and next rotation date in an internal registry.
- Exception identifier required for policy deviations: if a key cannot meet the normal maximum lifetime, require an approved exception ID with an expiry date and compensating controls.
- Staging before production: require evidence that the replacement was tested in a non-production environment where feasible, especially when the application uses background workers, batch jobs, or asynchronous queues.
- Revocation evidence required: do not close the rotation ticket until the old key has been revoked after the replacement is verified. The evidence should never include the key value.
The following sample is intentionally generic and uses metadata only. It is not an OpenAI API endpoint example, and it must not be modified to include real credentials. Use it as a pattern for internal admission checks, pull-request templates, or deployment gates.
{ "control": "openai_credential_reference_required_metadata", "decision": "deny_if_missing_required_fields", "required_fields": [ "owning_team", "business_owner", "technical_owner", "environment", "openai_project", "secret_store_reference", "rotation_due_date", "validation_plan", "rollback_plan" ], "forbidden_fields": [ "api_key_value", "raw_secret", "token", "password" ], "exception_fields": { "required_when_policy_deviation_exists": [ "exception_id", "exception_owner", "exception_expiry_date", "compensating_controls" ] } }Policy-as-code should also validate the workflow around human approval. External messages, production submissions, payments, purchases, bookings, destructive operations, permission changes, publication, legal commitments, and other consequential actions require accountable human approval. A deployment gate can require a checkbox or approval record, but the actual authorization must come from a qualified owner who understands the system impact.
Exception expiry: make deviations temporary, narrow, and reviewable
Exceptions are sometimes necessary during migrations, vendor transitions, incident recovery, or legacy application refactoring. They become dangerous when they are open-ended, inherited by new systems, or approved without compensating controls. A key governance exception should expire automatically, identify the smallest affected scope, and require reapproval before extension. If the exception concerns a production system, the business owner and security owner should both understand the risk.
Exception field Required content Operational reason Exception owner Named person accountable for closing or renewing the exception Prevents inherited risk with no accountable decision-maker Scope Project, application, environment, vendor, and key ownership pattern Prevents one exception from becoming a blanket bypass Policy deviation Specific rule being exceeded, such as maximum lifetime or storage pattern Makes the risk measurable and reviewable Expiry date Date when the exception ends unless reapproved Forces remediation planning instead of permanent drift Compensating controls Monitoring, spend limits, shorter review interval, network restrictions, or manual approval gates where applicable Reduces exposure while the normal control is not yet met Exit plan Steps, owner, and target date for returning to standard policy Turns the exception into a tracked remediation item Do not approve exceptions that require sharing raw API keys by email, chat, screenshots, support tickets, documents, spreadsheets, or prompt text. OpenAI’s API key safety guidance recommends keeping API keys secret, avoiding client-side exposure, and not sharing keys. If a process depends on visible key transfer between humans, redesign the process around a controlled secret store, access request, or administrator-mediated rotation.
Quarterly review: what to verify even when no incident occurred
A quarterly review should prove that the program still matches reality. Application teams ship new workers, vendors change staff, CI/CD pipelines accumulate variables, and emergency fixes create undocumented credentials. Because OpenAI’s creation restrictions apply to new key creation and do not remediate existing keys, the review must explicitly compare policy settings against the actual inventory of active credentials and consuming systems.
- Confirm organization and project policy boundaries. Verify that the organization-level restrictions still match the intended governance posture and that project-level settings do not assume a broader allowance than the organization permits. Remember that organization restrictions take precedence over project restrictions.
- Reconcile active keys with the internal registry. Every active key should map to a project, environment, owner, application, storage location, creation date, expiry plan, and last validation record. Do not export or circulate raw key values during the review.
- Review keys created before stricter policy. Since existing keys are unaffected by new creation controls, legacy keys deserve special attention. Prioritize keys with unknown owners, no expiry plan, high usage, broad application scope, or unclear storage.
- Check upcoming expirations. Identify keys that will expire before the next review and verify that replacement work is scheduled early enough for staging, deployment, validation, and revocation.
- Audit exceptions. Close expired exceptions, escalate overdue remediation, and require new approval for any extension. An exception with no owner or exit plan should be treated as a control failure.
- Inspect CI/CD and runtime environments. Confirm that pipeline variables, container secrets, serverless configuration, job schedulers, and deployment systems reference approved secret locations and do not expose secrets in logs.
- Review usage, spend, and anomalies. Compare expected application behavior with observed usage and spend patterns. Unexpected spikes, new workloads, or usage in dormant projects should trigger investigation.
- Validate offboarding records. Confirm that departed employees, contractors, and vendors no longer own or control active key paths, deployment secrets, project access, or emergency break-glass procedures.
The review output should be a concise control report, not a dump of sensitive data. Include the number of keys reviewed, number of unknown owners resolved, exceptions opened or closed, rotations completed, stale keys revoked, upcoming expiry risks, and unresolved action items. Exclude key values, private prompts, customer data, legal material, health information, personal identifiers, and unrelated confidential records.
Offboarding and role changes: remove access before ownership becomes ambiguous
Offboarding is a credential-governance event, not only an identity-management event. When an employee, contractor, vendor engineer, or service owner leaves a role, the organization must determine whether any OpenAI API keys, project permissions, deployment secrets, automation jobs, or monitoring alerts depended on that person. If a user-owned project key was used for a shared workload, the departure may require migration to an approved owner or service-account pattern, depending on your policy and OpenAI project configuration.
Use a role-change checklist whenever a person leaves a team or loses operational responsibility for an OpenAI-consuming system. The checklist should ask whether the person created keys, administered projects, maintained CI/CD secrets, received spend or usage alerts, approved rotations, held vendor contact responsibility, or owned exception records. If the answer is yes or unknown, assign a new owner and verify continuity before revoking access that could break a production system.
- For user-owned keys: identify whether any production or shared workload still depends on that user’s credential. Replace it through the normal create-replace-validate-revoke sequence rather than waiting for account deactivation to expose the dependency.
- For service-account keys: confirm that the departing person cannot access the storage path, deployment variables, logs, rotation procedures, or approval workflow associated with the key.
- For project administrators: reassign ownership of policy settings, exception approvals, key inventory, spend monitoring, and incident escalation before the user leaves.
- For vendors and contractors: verify contractual and operational termination steps, including removal from collaboration tools, ticket queues, deployment systems, project access, and secret-management groups.
Do not treat offboarding as evidence that a key has been revoked unless you can verify the credential state directly through authorized administrative procedures. Removing a person from a workspace, chat group, source repository, or vendor ticketing system does not necessarily remove every credential that was created earlier or copied into an unsafe location.
Vendor access: isolate, monitor, and time-limit third-party use
Vendor access should be designed around isolation and expiration. A vendor should not receive a shared production key by email or chat, and a vendor should not reuse your general application credential for unrelated testing. Where vendor access is necessary, create a scoped project or environment aligned to the business purpose, set a defined end date, document the owner, and monitor usage and spend separately from internal production traffic.
Before granting vendor access, require the vendor manager and security team to answer four operational questions. What exact task requires API access? Which project and environment will isolate that task? Who approves usage and spend? What is the date and procedure for revocation? If the vendor cannot operate through your approved secret-handling and access process, do not compensate by sending raw credentials through informal channels.
Vendor scenario Preferred control Risk to avoid Implementation partner building a prototype Separate non-production project, spend controls, short access window, synthetic or approved test data Prototype key later becoming an unmonitored production dependency Managed service provider operating production workflow Contracted ownership model, approved secret store, named escalation contacts, monitored usage, documented rotation procedure Vendor-controlled credential with no internal revocation path External audit or assessment Read-only evidence package where possible, redacted configuration, no raw key disclosure Turning an audit request into unnecessary credential exposure Temporary incident support Time-boxed access, live supervision, post-incident revocation, evidence capture Emergency access persisting after the incident closes If a vendor relationship ends, revoke or rotate any credentials that could have been accessed by the vendor, remove project access, close secret-store access, and review usage since the last known good state. The review should look for unexpected usage, unusual spend, or activity after the vendor’s approved work period. If exposure is suspected, handle the matter as a security incident rather than a routine cleanup task.
CI/CD handling: keep keys out of logs, build artifacts, and developer prompts
CI/CD systems are common places for API keys to leak because they combine environment variables, logs, build steps, container images, test fixtures, and third-party actions. OpenAI’s key safety guidance recommends keeping keys secret and avoiding exposure in client-side code. Extend that principle to every pipeline stage: keys should not be printed, echoed, embedded in artifacts, copied into generated documentation, included in screenshots, or pasted into AI prompts for troubleshooting.
Use secret references rather than visible key values in pipeline configuration. If your CI/CD platform supports masked secrets, protected environments, approval gates, or restricted variables, configure those controls according to your internal security standards. Do not assume masking is perfect; a script can still transform or leak a secret through debug output, crash dumps, dependency tooling, or command-line arguments.
Recommended CI/CD controls
- Separate environments: use distinct OpenAI projects and credentials for development, staging, and production so a test failure does not expose or consume production capacity.
- Least exposure: make production credentials available only to production deployment and runtime jobs that require them, not to every pull request, fork, lint job, or documentation build.
- No secret echo: disable verbose shell tracing around secret-handling steps and review scripts for commands that print environment variables or full process arguments.
- Artifact inspection: scan built containers, packages, logs, and generated files for accidental credential inclusion before publishing or deployment.
- Rotation readiness: design pipelines so a secret reference can be updated without code changes, emergency rebuilds, or manual edits on individual hosts.
- Human approval for production changes: require an accountable release approver before changing production secret references, deployment permissions, or external-facing behavior.
A safe pipeline test can verify that the application can read an approved secret reference without exposing the secret. The test should report success or failure, project and environment metadata, and application health status. It should never print the credential, include it in an exception message, or upload it as a diagnostic artifact.
# Safe pattern for CI/CD documentation: # - Reference the secret by the CI/CD platform's protected secret mechanism. # - Do not print the value. # - Do not include the value in logs, artifacts, prompts, or support tickets. # - Validate application behavior through a health check and redacted telemetry. OPENAI_API_KEY = "[provided by approved secret store at runtime]" APPLICATION_HEALTH_CHECK = "pass/fail status only; no credential output"Monitoring and metrics that show the control is working
Monitoring should answer two questions: whether applications are working after credential changes, and whether credential use still matches policy. OpenAI’s production guidance recommends monitoring usage and setting spend controls. That monitoring should be tied to application-level telemetry so a rotation can be evaluated by traffic continuity, error rates, latency symptoms, queue backlog, retry volume, and cost behavior rather than by the mere fact that a new key exists.
Metric What it indicates Action if abnormal Percentage of keys with named owners Whether credentials are accountable Freeze new exceptions for ownerless systems and assign remediation owners Percentage of production keys with documented rotation due dates Whether maximum lifetime policy has been operationalized Create rotation tickets before expiry becomes urgent Keys past rotation due date Whether the process is failing or exceptions are being abused Escalate to application owner and security risk owner Old keys not revoked after replacement Whether dual credentials are lingering Validate traffic and revoke old credentials, or document a short exception Unexpected usage in dormant projects Possible forgotten job, misrouted workload, or credential exposure Investigate immediately and consider incident response if unexplained Spend anomalies by project or environment Potential runaway workload, abuse, or deployment mistake Review spend controls, usage source, recent deployments, and alert thresholds Failed authentication or authorization errors after rotation Incomplete deployment or wrong credential reference Use rollback plan only if necessary, then fix deployment and revoke stale key Metrics should not become a surveillance dump. Report the smallest useful set of data to each audience: executives need risk and trend summaries, application owners need upcoming actions and failures, security needs anomalies and exceptions, finance needs spend behavior, and auditors need evidence that controls were performed. None of those audiences needs raw API keys in a dashboard.
Proof-of-continuity checklist before revoking the old key
The most important rotation mistake is revoking the old key before the replacement has carried real workload successfully. OpenAI recommends replacing a key before expiry, updating applications, verifying the replacement, and then revoking the old key. The following checklist turns that sequence into proof that production continuity has been preserved without retaining dual credentials longer than necessary.
- Replacement key created under the correct governance mode. Confirm that the key type matches the approved project policy, such as service-account or user-owned project key, and that it was created within the organization’s maximum lifetime boundary.
- Secret stored in approved location. Verify that the replacement is stored only in the approved secret manager or deployment secret mechanism. Do not paste the key into the ticket, chat, documentation, prompt, or validation report.
- Application configuration updated. Confirm that each runtime, worker, scheduled job, serverless function, container, and pipeline that needs the credential references the new secret version or approved secret path.
- Staging or canary validation completed. Exercise representative requests, background jobs, retries, and failure paths in a controlled environment or limited production canary where feasible.
- Production traffic observed on replacement path. Use redacted telemetry, application logs, usage reporting, or health checks to verify that the updated application is operating as expected. The evidence should show status and timing, not secret values.
- Error and retry rates reviewed. Compare authentication failures, API errors, queue backlog, timeouts, and retry volume before and after cutover. A quiet success message from deployment tooling is not enough.
- Spend and usage reviewed. Confirm that usage appears in the expected project and environment and that spend behavior is consistent with the workload. Unexpected cost movement should be investigated before final closure.
- Rollback window defined and time-boxed. If rollback is still required, document who can authorize it and when the rollback path expires. Avoid leaving the old key active indefinitely as a convenience.
- Old key revoked after validation. Once the replacement is proven, revoke the old key through authorized administrative procedures. Record the revocation event without recording the key value.
- Post-rotation evidence captured. Close the change with owner approval, validation summary, old-key revocation confirmation, exception status if any, and next rotation due date.
If any item fails, do not silently extend the old key. Either roll back under an approved change procedure, open a short exception with a named owner and expiry date, or pause the cutover while the application team fixes the dependency. The worst outcome is an undocumented partial migration where both old and new credentials remain active and nobody knows which workload uses which one.
Conclusion: treat key expiry as a reliability and security program
OpenAI’s documented controls give administrators important levers over future API-key creation and maximum lifetimes, including service-account-only creation, user-owned project-key creation, disabling new key creation, and organization-level precedence over project restrictions. Those controls shape what can be created next; they do not inventory, rotate, revoke, or secure existing keys automatically.
A durable operating model combines an accountable inventory, approved key ownership, maximum lifetimes, secret-manager storage, separate staging and production projects, create-replace-validate-revoke rotation, usage and spend monitoring, incident response, exception expiry, and human approval for consequential changes. No report, ticket, prompt, screenshot, or repository should contain a real key value.
Before closing any rotation, verify that the replacement carries representative traffic, authentication and retry behavior remain healthy, usage appears in the intended project, spend patterns are understood, the old key is revoked after validation, and the evidence record contains owners and dates without credential material. If continuity or attribution is unclear, pause, roll back through the approved procedure, or open a time-boxed exception.
Access 40,000+ AI Prompts for ChatGPT, Claude & Codex — Free!
Subscribe to get instant access to our complete Notion Prompt Library — the largest curated collection of prompts for ChatGPT, Claude, OpenAI Codex, and other leading AI models. Optimized for real-world workflows across coding, research, content creation, and business.
Useful Links
