Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

feat: add secret rotation for openai

adilson127a4cef9efc
diff --git a/backend/src/ee/routes/v2/secret-rotation-v2-routers/index.ts b/backend/src/ee/routes/v2/secret-rotation-v2-routers/index.ts
index 8ac3c19cfd..7799ef49c9 100644
--- a/backend/src/ee/routes/v2/secret-rotation-v2-routers/index.ts
+++ b/backend/src/ee/routes/v2/secret-rotation-v2-routers/index.ts
@@ -14,6 +14,7 @@ import { registerMsSqlCredentialsRotationRouter } from "./mssql-credentials-rota
import { registerMySqlCredentialsRotationRouter } from "./mysql-credentials-rotation-router";
import { registerOktaClientSecretRotationRouter } from "./okta-client-secret-rotation-router";
import { registerOpenRouterApiKeyRotationRouter } from "./open-router-api-key-rotation-router";
+import { registerOpenAIAdminApiKeyRotationRouter } from "./openai-admin-api-key-rotation-router";
import { registerOracleDBCredentialsRotationRouter } from "./oracledb-credentials-rotation-router";
import { registerPostgresCredentialsRotationRouter } from "./postgres-credentials-rotation-router";
import { registerRedisCredentialsRotationRouter } from "./redis-credentials-rotation-router";
@@ -44,6 +45,7 @@ export const SECRET_ROTATION_REGISTER_ROUTER_MAP: Record<
[SecretRotation.DbtServiceToken]: registerDbtServiceTokenRotationRouter,
[SecretRotation.WindowsLocalAccount]: registerWindowsLocalAccountRotationRouter,
[SecretRotation.OpenRouterApiKey]: registerOpenRouterApiKeyRotationRouter,
+ [SecretRotation.OpenAIAdminApiKey]: registerOpenAIAdminApiKeyRotationRouter,
[SecretRotation.HpIloLocalAccount]: registerHpIloRotationRouter,
[SecretRotation.SupabaseApiKey]: registerSupabaseApiKeyRotationRouter,
[SecretRotation.SalesforceOauthCredentials]: registerSalesforceOauthCredentialsRotationRouter,
diff --git a/backend/src/ee/routes/v2/secret-rotation-v2-routers/openai-admin-api-key-rotation-router.ts b/backend/src/ee/routes/v2/secret-rotation-v2-routers/openai-admin-api-key-rotation-router.ts
new file mode 100644
index 0000000000..6e4bdf62ec
--- /dev/null
+++ b/backend/src/ee/routes/v2/secret-rotation-v2-routers/openai-admin-api-key-rotation-router.ts
@@ -0,0 +1,19 @@
+import {
+ CreateOpenAIAdminApiKeyRotationSchema,
+ OpenAIAdminApiKeyRotationGeneratedCredentialsSchema,
+ OpenAIAdminApiKeyRotationSchema,
+ UpdateOpenAIAdminApiKeyRotationSchema
+} from "@app/ee/services/secret-rotation-v2/openai-admin-api-key";
+import { SecretRotation } from "@app/ee/services/secret-rotation-v2/secret-rotation-v2-enums";
+
+import { registerSecretRotationEndpoints } from "./secret-rotation-v2-endpoints";
+
+export const registerOpenAIAdminApiKeyRotationRouter = async (server: FastifyZodProvider) =>
+ registerSecretRotationEndpoints({
+ type: SecretRotation.OpenAIAdminApiKey,
+ server,
+ responseSchema: OpenAIAdminApiKeyRotationSchema,
+ createSchema: CreateOpenAIAdminApiKeyRotationSchema,
+ updateSchema: UpdateOpenAIAdminApiKeyRotationSchema,
+ generatedCredentialsSchema: OpenAIAdminApiKeyRotationGeneratedCredentialsSchema
+ });
diff --git a/backend/src/ee/routes/v2/secret-rotation-v2-routers/secret-rotation-v2-router.ts b/backend/src/ee/routes/v2/secret-rotation-v2-routers/secret-rotation-v2-router.ts
index 17a41bafe5..7808b27ded 100644
--- a/backend/src/ee/routes/v2/secret-rotation-v2-routers/secret-rotation-v2-router.ts
+++ b/backend/src/ee/routes/v2/secret-rotation-v2-routers/secret-rotation-v2-router.ts
@@ -15,6 +15,7 @@ import { MsSqlCredentialsRotationListItemSchema } from "@app/ee/services/secret-
import { MySqlCredentialsRotationListItemSchema } from "@app/ee/services/secret-rotation-v2/mysql-credentials";
import { OktaClientSecretRotationListItemSchema } from "@app/ee/services/secret-rotation-v2/okta-client-secret";
import { OpenRouterApiKeyRotationListItemSchema } from "@app/ee/services/secret-rotation-v2/open-router-api-key";
+import { OpenAIAdminApiKeyRotationListItemSchema } from "@app/ee/services/secret-rotation-v2/openai-admin-api-key";
import { OracleDBCredentialsRotationListItemSchema } from "@app/ee/services/secret-rotation-v2/oracledb-credentials";
import { PostgresCredentialsRotationListItemSchema } from "@app/ee/services/secret-rotation-v2/postgres-credentials";
import { RedisCredentialsRotationListItemSchema } from "@app/ee/services/secret-rotation-v2/redis-credentials";
@@ -45,6 +46,7 @@ const SecretRotationV2OptionsSchema = z.discriminatedUnion("type", [
DbtServiceTokenRotationListItemSchema,
WindowsLocalAccountRotationListItemSchema,
OpenRouterApiKeyRotationListItemSchema,
+ OpenAIAdminApiKeyRotationListItemSchema,
HpIloRotationListItemSchema,
SupabaseApiKeyRotationListItemSchema,
SalesforceOauthCredentialsRotationListItemSchema,
diff --git a/backend/src/ee/services/secret-rotation-v2/openai-admin-api-key/index.ts b/backend/src/ee/services/secret-rotation-v2/openai-admin-api-key/index.ts
new file mode 100644
index 0000000000..6696466853
--- /dev/null
+++ b/backend/src/ee/services/secret-rotation-v2/openai-admin-api-key/index.ts
@@ -0,0 +1,3 @@
+export * from "./openai-admin-api-key-rotation-constants";
+export * from "./openai-admin-api-key-rotation-schemas";
+export * from "./openai-admin-api-key-rotation-types";
diff --git a/backend/src/ee/services/secret-rotation-v2/openai-admin-api-key/openai-admin-api-key-rotation-constants.ts b/backend/src/ee/services/secret-rotation-v2/openai-admin-api-key/openai-admin-api-key-rotation-constants.ts
new file mode 100644
index 0000000000..f7dbb4ddc4
--- /dev/null
+++ b/backend/src/ee/services/secret-rotation-v2/openai-admin-api-key/openai-admin-api-key-rotation-constants.ts
@@ -0,0 +1,14 @@
+import { SecretRotation } from "@app/ee/services/secret-rotation-v2/secret-rotation-v2-enums";
+import { TSecretRotationV2ListItem } from "@app/ee/services/secret-rotation-v2/secret-rotation-v2-types";
+import { AppConnection } from "@app/services/app-connection/app-connection-enums";
+
+export const OPENAI_ADMIN_API_KEY_ROTATION_LIST_OPTION: TSecretRotationV2ListItem = {
+ name: "OpenAI Admin API Key",
+ type: SecretRotation.OpenAIAdminApiKey,
+ connection: AppConnection.OpenAI,
+ template: {
+ secretsMapping: {
+ apiKey: "OPENAI_ADMIN_API_KEY"
+ }
+ }
+};
diff --git a/backend/src/ee/services/secret-rotation-v2/openai-admin-api-key/openai-admin-api-key-rotation-fns.ts b/backend/src/ee/services/secret-rotation-v2/openai-admin-api-key/openai-admin-api-key-rotation-fns.ts
new file mode 100644
index 0000000000..321d744809
--- /dev/null
+++ b/backend/src/ee/services/secret-rotation-v2/openai-admin-api-key/openai-admin-api-key-rotation-fns.ts
@@ -0,0 +1,190 @@
+import { AxiosError } from "axios";
+
+import {
+ TRotationFactory,
+ TRotationFactoryCheckActiveCredentials,
+ TRotationFactoryGetSecretsPayload,
+ TRotationFactoryIssueCredentials,
+ TRotationFactoryRevokeCredentials,
+ TRotationFactoryRotateCredentials
+} from "@app/ee/services/secret-rotation-v2/secret-rotation-v2-types";
+import { request } from "@app/lib/config/request";
+import { BadRequestError } from "@app/lib/errors";
+import { OPENAI_API_BASE_URL } from "@app/services/app-connection/openai";
+
+import {
+ TOpenAIAdminApiKeyCreateResponse,
+ TOpenAIAdminApiKeyRotationGeneratedCredentials,
+ TOpenAIAdminApiKeyRotationWithConnection
+} from "./openai-admin-api-key-rotation-types";
+
+type OpenAIErrorResponse = { error?: { message: string; type?: string; code?: string } };
+
+const isOpenAIErrorResponse = (data: unknown): data is OpenAIErrorResponse => {
+ return typeof data === "object" && data !== null && "error" in data;
+};
+
+const createErrorMessage = (error: unknown) => {
+ if (error instanceof AxiosError) {
+ if (error.response?.data && isOpenAIErrorResponse(error.response.data)) {
+ const openAIError = error.response.data;
+ if (openAIError.error?.message) {
+ return openAIError.error.message;
+ }
+ }
+ if (error.message) {
+ return error.message;
+ }
+ }
+ return "Unknown error";
+};
+
+export const openAIAdminApiKeyRotationFactory: TRotationFactory<
+ TOpenAIAdminApiKeyRotationWithConnection,
+ TOpenAIAdminApiKeyRotationGeneratedCredentials
+> = (secretRotation) => {
+ const {
+ connection,
+ parameters: { name },
+ secretsMapping
+ } = secretRotation;
+
+ const provisioningApiKey = connection.credentials.apiKey;
+
+ /**
+ * Creates a new admin API key via the OpenAI Admin API.
+ */
+ const $createApiKey = async () => {
+ try {
+ // Suffix with a timestamp so the active and retired keys have distinct names on the
+ // OpenAI platform during the dual-credential window. Deletion is by key id, so the
+ // name itself is only used for identification in the OpenAI dashboard.
+ const keyName = `${name}-${Date.now()}`;
+
+ const { data } = await request.post<TOpenAIAdminApiKeyCreateResponse>(
+ `${OPENAI_API_BASE_URL}/organization/admin_api_keys`,
+ { name: keyName },
+ {
+ headers: {
+ Authorization: `Bearer ${provisioningApiKey}`,
+ "Content-Type": "application/json"
+ }
+ }
+ );
+
+ if (!data.value || !data.id) {
+ throw new Error("Invalid response from OpenAI: missing 'value' or 'id'.");
+ }
+
+ return {
+ apiKey: data.value,
+ keyId: data.id
+ };
+ } catch (error: unknown) {
+ throw new BadRequestError({
+ message: `Failed to create OpenAI admin API key: ${createErrorMessage(error)}`
+ });
+ }
+ };
+
+ /**
+ * Deletes an admin API key via the OpenAI Admin API.
+ */
+ const $deleteApiKey = async (keyId: string) => {
+ try {
+ await request.delete(`${OPENAI_API_BASE_URL}/organization/admin_api_keys/${keyId}`, {
+ headers: {
+ Authorization: `Bearer ${provisioningApiKey}`,
+ "Content-Type": "application/json"
+ }
+ });
+ } catch (error: unknown) {
+ // If key doesn't exist (404), consider it already deleted
+ if (error instanceof AxiosError && error.response?.status === 404) {
+ return;
+ }
+
+ throw new BadRequestError({
+ message: `Failed to delete OpenAI admin API key: ${createErrorMessage(error)}`
+ });
+ }
+ };
+
+ /**
+ * Issues a new set of credentials.
+ */
+ const issueCredentials: TRotationFactoryIssueCredentials<TOpenAIAdminApiKeyRotationGeneratedCredentials> = async (
+ callback
+ ) => {
+ const credentials = await $createApiKey();
+ return callback(credentials);
+ };
+
+ /**
+ * Revokes a list of credentials.
+ */
+ const revokeCredentials: TRotationFactoryRevokeCredentials<TOpenAIAdminApiKeyRotationGeneratedCredentials> = async (
+ credentials,
+ callback
+ ) => {
+ if (!credentials?.length) return callback();
+
+ await Promise.all(credentials.map(({ keyId }) => $deleteApiKey(keyId)));
+
+ return callback();
+ };
+
+ /**
+ * Rotates credentials by issuing new ones and revoking the old.
+ */
+ const rotateCredentials: TRotationFactoryRotateCredentials<TOpenAIAdminApiKeyRotationGeneratedCredentials> = async (
+ oldCredentials,
+ callback
+ ) => {
+ // First create the new credentials
+ const newCredentials = await $createApiKey();
+
+ // Store the new credentials via callback
+ const result = await callback(newCredentials);
+
+ // Then delete the old key if it exists
+ if (oldCredentials?.keyId) {
+ await $deleteApiKey(oldCredentials.keyId);
+ }
+
+ return result;
+ };
+
+ /**
+ * Maps the generated credentials into the secret payload format.
+ */
+ const getSecretsPayload: TRotationFactoryGetSecretsPayload<TOpenAIAdminApiKeyRotationGeneratedCredentials> = ({
+ apiKey
+ }) => [{ key: secretsMapping.apiKey, value: apiKey }];
+
+ const checkActiveCredentials: TRotationFactoryCheckActiveCredentials<
+ TOpenAIAdminApiKeyRotationGeneratedCredentials
+ > = async ({ apiKey }) => {
+ try {
+ // A valid admin key can list admin keys; a 200 confirms the rotated key is still active.
+ await request.get(`${OPENAI_API_BASE_URL}/organization/admin_api_keys?limit=1`, {
+ headers: {
+ Authorization: `Bearer ${apiKey}`,
+ "Content-Type": "application/json"
+ }
+ });
+ } catch (error: unknown) {
+ throw new BadRequestError({
+ message: `OpenAI admin API key verification failed: ${createErrorMessage(error)}`
+ });
+ }
+ };
+
+ return {
+ issueCredentials,
+ revokeCredentials,
+ rotateCredentials,
+ getSecretsPayload,
+ checkActiveCredentials
+ };
+};
diff --git a/backend/src/ee/services/secret-rotation-v2/openai-admin-api-key/openai-admin-api-key-rotation-schemas.ts b/backend/src/ee/services/secret-rotation-v2/openai-admin-api-key/openai-admin-api-key-rotation-schemas.ts
new file mode 100644
index 0000000000..55569d1d6a
--- /dev/null
+++ b/backend/src/ee/services/secret-rotation-v2/openai-admin-api-key/openai-admin-api-key-rotation-schemas.ts
@@ -0,0 +1,72 @@
+import { z } from "zod";
+
+import { SecretRotation } from "@app/ee/services/secret-rotation-v2/secret-rotation-v2-enums";
+import {
+ BaseCreateSecretRotationSchema,
+ BaseSecretRotationSchema,
+ BaseUpdateSecretRotationSchema
+} from "@app/ee/services/secret-rotation-v2/secret-rotation-v2-schemas";
+import { SecretRotations } from "@app/lib/api-docs";
+import { SecretNameSchema } from "@app/server/lib/schemas";
+import { AppConnection } from "@app/services/app-connection/app-connection-enums";
+
+export const OpenAIAdminApiKeyRotationGeneratedCredentialsSchema = z
+ .object({
+ apiKey: z.string(),
+ keyId: z.string()
+ })
+ .array()
+ .min(1)
+ .max(2);
+
+/** Max length for OpenAI admin API key name. */
+export const OPENAI_ADMIN_API_KEY_NAME_MAX_LENGTH = 100;
+
+const OpenAIAdminApiKeyRotationParametersSchema = z.object({
+ name: z
+ .string()
+ .trim()
+ .min(1, "Key name required")
+ .max(
+ OPENAI_ADMIN_API_KEY_NAME_MAX_LENGTH,
+ `Key name must be ${OPENAI_ADMIN_API_KEY_NAME_MAX_LENGTH} characters or fewer`
+ )
+ .describe(SecretRotations.PARAMETERS.OPENAI_ADMIN_API_KEY.name)
+});
+
+const OpenAIAdminApiKeyRotationSecretsMappingSchema = z.object({
+ apiKey: SecretNameSchema.describe(SecretRotations.SECRETS_MAPPING.OPENAI_ADMIN_API_KEY.apiKey)
+});
+
+export const OpenAIAdminApiKeyRotationTemplateSchema = z.object({
+ secretsMapping: z.object({
+ apiKey: z.string()
+ })
+});
+
+export const OpenAIAdminApiKeyRotationSchema = BaseSecretRotationSchema(SecretRotation.OpenAIAdminApiKey).extend({
+ type: z.literal(SecretRotation.OpenAIAdminApiKey),
+ parameters: OpenAIAdminApiKeyRotationParametersSchema,
+ secretsMapping: OpenAIAdminApiKeyRotationSecretsMappingSchema
+});
+
+export const CreateOpenAIAdminApiKeyRotationSchema = BaseCreateSecretRotationSchema(
+ SecretRotation.OpenAIAdminApiKey
+).extend({
+ parameters: OpenAIAdminApiKeyRotationParametersSchema,
+ secretsMapping: OpenAIAdminApiKeyRotationSecretsMappingSchema
+});
+
+export const UpdateOpenAIAdminApiKeyRotationSchema = BaseUpdateSecretRotationSchema(
+ SecretRotation.OpenAIAdminApiKey
+).extend({
+ parameters: OpenAIAdminApiKeyRotationParametersSchema.optional(),
+ secretsMapping: OpenAIAdminApiKeyRotationSecretsMappingSchema.optional()
+});
+
+export const OpenAIAdminApiKeyRotationListItemSchema = z.object({
+ name: z.literal("OpenAI Admin API Key"),
+ connection: z.literal(AppConnection.OpenAI),
+ type: z.literal(SecretRotation.OpenAIAdminApiKey),
+ template: OpenAIAdminApiKeyRotationTemplateSchema
+});
diff --git a/backend/src/ee/services/secret-rotation-v2/openai-admin-api-key/openai-admin-api-key-rotation-types.ts b/backend/src/ee/services/secret-rotation-v2/openai-admin-api-key/openai-admin-api-key-rotation-types.ts
new file mode 100644
index 0000000000..b62191c5e0
--- /dev/null
+++ b/backend/src/ee/services/secret-rotation-v2/openai-admin-api-key/openai-admin-api-key-rotation-types.ts
@@ -0,0 +1,41 @@
+import { z } from "zod";
+
+import { TOpenAIConnection } from "@app/services/app-connection/openai";
+
+import {
+ CreateOpenAIAdminApiKeyRotationSchema,
+ OpenAIAdminApiKeyRotationGeneratedCredentialsSchema,
+ OpenAIAdminApiKeyRotationListItemSchema,
+ OpenAIAdminApiKeyRotationSchema
+} from "./openai-admin-api-key-rotation-schemas";
+
+export type TOpenAIAdminApiKeyRotation = z.infer<typeof OpenAIAdminApiKeyRotationSchema>;
+
+export type TOpenAIAdminApiKeyRotationInput = z.infer<typeof CreateOpenAIAdminApiKeyRotationSchema>;
+
+export type TOpenAIAdminApiKeyRotationListItem = z.infer<typeof OpenAIAdminApiKeyRotationListItemSchema>;
+
+export type TOpenAIAdminApiKeyRotationWithConnection = TOpenAIAdminApiKeyRotation & {
+ connection: TOpenAIConnection;
+};
+
+export type TOpenAIAdminApiKeyRotationGeneratedCredentials = z.infer<
+ typeof OpenAIAdminApiKeyRotationGeneratedCredentialsSchema
+>;
+
+export interface TOpenAIAdminApiKeyRotationParameters {
+ name: string;
+}
+
+export interface TOpenAIAdminApiKeyRotationSecretsMapping {
+ apiKey: string;
+}
+
+export interface TOpenAIAdminApiKeyCreateResponse {
+ object: string;
+ id: string;
+ name: string;
+ redacted_value: string;
+ value: string;
+ created_at: number;
+}
diff --git a/backend/src/ee/services/secret-rotation-v2/secret-rotation-v2-enums.ts b/backend/src/ee/services/secret-rotation-v2/secret-rotation-v2-enums.ts
index cc89c95193..1bfa235a50 100644
--- a/backend/src/ee/services/secret-rotation-v2/secret-rotation-v2-enums.ts
+++ b/backend/src/ee/services/secret-rotation-v2/secret-rotation-v2-enums.ts
@@ -15,6 +15,7 @@ export enum SecretRotation {
DbtServiceToken = "dbt-service-token",
WindowsLocalAccount = "windows-local-account",
OpenRouterApiKey = "open-router-api-key",
+ OpenAIAdminApiKey = "openai-admin-api-key",
HpIloLocalAccount = "hp-ilo-local-account",
SupabaseApiKey = "supabase-api-key",
SalesforceOauthCredentials = "salesforce-oauth-credentials",
diff --git a/backend/src/ee/services/secret-rotation-v2/secret-rotation-v2-fns.ts b/backend/src/ee/services/secret-rotation-v2/secret-rotation-v2-fns.ts
index 6f8345ff81..1ef6ecca2d 100644
--- a/backend/src/ee/services/secret-rotation-v2/secret-rotation-v2-fns.ts
+++ b/backend/src/ee/services/secret-rotation-v2/secret-rotation-v2-fns.ts
@@ -23,6 +23,7 @@ import { MSSQL_CREDENTIALS_ROTATION_LIST_OPTION } from "./mssql-credentials";
import { MYSQL_CREDENTIALS_ROTATION_LIST_OPTION } from "./mysql-credentials";
import { OKTA_CLIENT_SECRET_ROTATION_LIST_OPTION } from "./okta-client-secret";
import { OPEN_ROUTER_API_KEY_ROTATION_LIST_OPTION } from "./open-router-api-key";
+import { OPENAI_ADMIN_API_KEY_ROTATION_LIST_OPTION } from "./openai-admin-api-key";
import { ORACLEDB_CREDENTIALS_ROTATION_LIST_OPTION } from "./oracledb-credentials";
import { POSTGRES_CREDENTIALS_ROTATION_LIST_OPTION } from "./postgres-credentials";
import { REDIS_CREDENTIALS_ROTATION_LIST_OPTION } from "./redis-credentials";
@@ -65,6 +66,7 @@ const SECRET_ROTATION_LIST_OPTIONS: Record<SecretRotation, TSecretRotationV2List
[SecretRotation.DbtServiceToken]: DBT_SERVICE_TOKEN_ROTATION_LIST_OPTION,
[SecretRotation.WindowsLocalAccount]: WINDOWS_LOCAL_ACCOUNT_ROTATION_LIST_OPTION,
[SecretRotation.OpenRouterApiKey]: OPEN_ROUTER_API_KEY_ROTATION_LIST_OPTION,
+ [SecretRotation.OpenAIAdminApiKey]: OPENAI_ADMIN_API_KEY_ROTATION_LIST_OPTION,
[SecretRotation.HpIloLocalAccount]: HP_ILO_ROTATION_LIST_OPTION,
[SecretRotation.SupabaseApiKey]: SUPABASE_API_KEY_ROTATION_LIST_OPTION,
[SecretRotation.SalesforceOauthCredentials]: SALESFORCE_OAUTH_CREDENTIALS_ROTATION_LIST_OPTION,
diff --git a/backend/src/ee/services/secret-rotation-v2/secret-rotation-v2-maps.ts b/backend/src/ee/services/secret-rotation-v2/secret-rotation-v2-maps.ts
index ccc913fc69..ca17ea39f7 100644
--- a/backend/src/ee/services/secret-rotation-v2/secret-rotation-v2-maps.ts
+++ b/backend/src/ee/services/secret-rotation-v2/secret-rotation-v2-maps.ts
@@ -18,6 +18,7 @@ export const SECRET_ROTATION_NAME_MAP: Record<SecretRotation, string> = {
[SecretRotation.DbtServiceToken]: "DBT Service Token",
[SecretRotation.WindowsLocalAccount]: "Windows Local Account",
[SecretRotation.OpenRouterApiKey]: "OpenRouter API Key",
+ [SecretRotation.OpenAIAdminApiKey]: "OpenAI Admin API Key",
[SecretRotation.HpIloLocalAccount]: "HP iLO Local Account",
[SecretRotation.SupabaseApiKey]: "Supabase API Key",
[SecretRotation.SalesforceOauthCredentials]: "Salesforce OAuth Credentials",
@@ -42,6 +43,7 @@ export const SECRET_ROTATION_CONNECTION_MAP: Record<SecretRotation, AppConnectio
[SecretRotation.DbtServiceToken]: AppConnection.Dbt,
[SecretRotation.WindowsLocalAccount]: AppConnection.SMB,
[SecretRotation.OpenRouterApiKey]: AppConnection.OpenRouter,
+ [SecretRotation.OpenAIAdminApiKey]: AppConnection.OpenAI,
[SecretRotation.HpIloLocalAccount]: AppConnection.SSH,
[SecretRotation.SupabaseApiKey]: AppConnection.Supabase,
[SecretRotation.SalesforceOauthCredentials]: AppConnection.Salesforce,
diff --git a/backend/src/ee/services/secret-rotation-v2/secret-rotation-v2-service.ts b/backend/src/ee/services/secret-rotation-v2/secret-rotation-v2-service.ts
index 2f900d8cb0..1bb0c292ba 100644
--- a/backend/src/ee/services/secret-rotation-v2/secret-rotation-v2-service.ts
+++ b/backend/src/ee/services/secret-rotation-v2/secret-rotation-v2-service.ts
@@ -107,6 +107,7 @@ import { THpIloRotation, THpIloRotationGeneratedCredentials } from "./hp-ilo-rot
import { mongodbCredentialsRotationFactory } from "./mongodb-credentials/mongodb-credentials-rotation-fns";
import { oktaClientSecretRotationFactory } from "./okta-client-secret/okta-client-secret-rotation-fns";
import { openRouterApiKeyRotationFactory } from "./open-router-api-key/open-router-api-key-rotation-fns";
+import { openAIAdminApiKeyRotationFactory } from "./openai-admin-api-key/openai-admin-api-key-rotation-fns";
import { redisCredentialsRotationFactory } from "./redis-credentials/redis-credentials-rotation-fns";
import { TSecretRotationV2DALFactory } from "./secret-rotation-v2-dal";
import { supabaseApiKeyRotationFactory } from "./supabase-api-key/supabase-api-key-rotation-fns";
@@ -198,6 +199,7 @@ const SECRET_ROTATION_FACTORY_MAP: Record<SecretRotation, TRotationFactoryImplem
[SecretRotation.DbtServiceToken]: dbtServiceTokenRotationFactory as TRotationFactoryImplementation,
[SecretRotation.WindowsLocalAccount]: windowsLocalAccountRotationFactory as TRotationFactoryImplementation,
[SecretRotation.OpenRouterApiKey]: openRouterApiKeyRotationFactory as TRotationFactoryImplementation,
+ [SecretRotation.OpenAIAdminApiKey]: openAIAdminApiKeyRotationFactory as TRotationFactoryImplementation,
[SecretRotation.HpIloLocalAccount]: hpIloRotationFactory as TRotationFactoryImplementation,
[SecretRotation.SupabaseApiKey]: supabaseApiKeyRotationFactory as TRotationFactoryImplementation,
[SecretRotation.SalesforceOauthCredentials]:
diff --git a/backend/src/ee/services/secret-rotation-v2/secret-rotation-v2-types.ts b/backend/src/ee/services/secret-rotation-v2/secret-rotation-v2-types.ts
index 2b7da37159..0ed04a88b9 100644
--- a/backend/src/ee/services/secret-rotation-v2/secret-rotation-v2-types.ts
+++ b/backend/src/ee/services/secret-rotation-v2/secret-rotation-v2-types.ts
@@ -104,6 +104,13 @@ import {
TOpenRouterApiKeyRotationListItem,
TOpenRouterApiKeyRotationWithConnection
} from "./open-router-api-key";
+import {
+ TOpenAIAdminApiKeyRotation,
+ TOpenAIAdminApiKeyRotationGeneratedCredentials,
+ TOpenAIAdminApiKeyRotationInput,
+ TOpenAIAdminApiKeyRotationListItem,
+ TOpenAIAdminApiKeyRotationWithConnection
+} from "./openai-admin-api-key";
import {
TOracleDBCredentialsRotation,
TOracleDBCredentialsRotationInput,
@@ -171,6 +178,7 @@ export type TSecretRotationV2 =
| TDbtServiceTokenRotation
| TWindowsLocalAccountRotation
| TOpenRouterApiKeyRotation
+ | TOpenAIAdminApiKeyRotation
| THpIloRotation
| TSupabaseApiKeyRotation
| TSalesforceOauthCredentialsRotation
@@ -194,6 +202,7 @@ export type TSecretRotationV2WithConnection =
| TDbtServiceTokenRotationWithConnection
| TWindowsLocalAccountRotationWithConnection
| TOpenRouterApiKeyRotationWithConnection
+ | TOpenAIAdminApiKeyRotationWithConnection
| THpIloRotationWithConnection
| TSupabaseApiKeyRotationWithConnection
| TSalesforceOauthCredentialsRotationWithConnection
@@ -213,6 +222,7 @@ export type TSecretRotationV2GeneratedCredentials =
| TDbtServiceTokenRotationGeneratedCredentials
| TWindowsLocalAccountRotationGeneratedCredentials
| TOpenRouterApiKeyRotationGeneratedCredentials
+ | TOpenAIAdminApiKeyRotationGeneratedCredentials
| THpIloRotationGeneratedCredentials
| TSupabaseApiKeyRotationGeneratedCredentials
| TSalesforceOauthCredentialsRotationGeneratedCredentials
@@ -236,6 +246,7 @@ export type TSecretRotationV2Input =
| TDbtServiceTokenRotationInput
| TWindowsLocalAccountRotationInput
| TOpenRouterApiKeyRotationInput
+ | TOpenAIAdminApiKeyRotationInput
| THpIloRotationInput
| TSupabaseApiKeyRotationInput
| TSalesforceOauthCredentialsRotationInput
@@ -259,6 +270,7 @@ export type TSecretRotationV2ListItem =
| TDbtServiceTokenRotationListItem
| TWindowsLocalAccountRotationListItem
| TOpenRouterApiKeyRotationListItem
+ | TOpenAIAdminApiKeyRotationListItem
| THpIloRotationListItem
| TSupabaseApiKeyRotationListItem
| TSalesforceOauthCredentialsRotationListItem
diff --git a/backend/src/ee/services/secret-rotation-v2/secret-rotation-v2-union-schema.ts b/backend/src/ee/services/secret-rotation-v2/secret-rotation-v2-union-schema.ts
index d1cfa6cfc2..636fda37de 100644
--- a/backend/src/ee/services/secret-rotation-v2/secret-rotation-v2-union-schema.ts
+++ b/backend/src/ee/services/secret-rotation-v2/secret-rotation-v2-union-schema.ts
@@ -11,6 +11,7 @@ import { MsSqlCredentialsRotationSchema } from "@app/ee/services/secret-rotation
import { MySqlCredentialsRotationSchema } from "@app/ee/services/secret-rotation-v2/mysql-credentials";
import { OktaClientSecretRotationSchema } from "@app/ee/services/secret-rotation-v2/okta-client-secret";
import { OpenRouterApiKeyRotationSchema } from "@app/ee/services/secret-rotation-v2/open-router-api-key";
+import { OpenAIAdminApiKeyRotationSchema } from "@app/ee/services/secret-rotation-v2/openai-admin-api-key";
import { OracleDBCredentialsRotationSchema } from "@app/ee/services/secret-rotation-v2/oracledb-credentials";
import { PostgresCredentialsRotationSchema } from "@app/ee/services/secret-rotation-v2/postgres-credentials";
import { RedisCredentialsRotationSchema } from "@app/ee/services/secret-rotation-v2/redis-credentials";
@@ -40,6 +41,7 @@ export const SecretRotationV2Schema = z.discriminatedUnion("type", [
DbtServiceTokenRotationSchema,
WindowsLocalAccountRotationSchema,
OpenRouterApiKeyRotationSchema,
+ OpenAIAdminApiKeyRotationSchema,
HpIloRotationSchema,
SupabaseApiKeyRotationSchema,
SalesforceOauthCredentialsRotationSchema,
diff --git a/backend/src/lib/api-docs/constants.ts b/backend/src/lib/api-docs/constants.ts
index da57f38cc9..e61de909f2 100644
--- a/backend/src/lib/api-docs/constants.ts
+++ b/backend/src/lib/api-docs/constants.ts
@@ -3457,6 +3457,9 @@ export const SecretRotations = {
includeByokInLimit:
"Whether to include BYOK (Bring Your Own Key) usage in the spending limit. When enabled, usage from your own provider keys counts toward this key's limit. See OpenRouter BYOK docs for details."
},
+ OPENAI_ADMIN_API_KEY: {
+ name: "The name for the generated OpenAI admin API key."
+ },
SUPABASE_API_KEY: {
projectRef: "The reference ID of the Supabase project to rotate the API key for.",
keyType: "The type of the API key to rotate (e.g. publishable, secret)."
@@ -3531,6 +3534,9 @@ export const SecretRotations = {
OPEN_ROUTER_API_KEY: {
apiKey: "The name of the secret that the rotated OpenRouter API key will be mapped to."
},
+ OPENAI_ADMIN_API_KEY: {
+ apiKey: "The name of the secret that the rotated OpenAI admin API key will be mapped to."
+ },
SUPABASE_API_KEY: {
apiKey: "The name of the secret that the rotated Supabase API key will be mapped to."
},
diff --git a/frontend/src/components/secret-rotations-v2/ViewSecretRotationV2GeneratedCredentials/ViewOpenAIAdminApiKeyRotationGeneratedCredentials.tsx b/frontend/src/components/secret-rotations-v2/ViewSecretRotationV2GeneratedCredentials/ViewOpenAIAdminApiKeyRotationGeneratedCredentials.tsx
new file mode 100644
index 0000000000..8606664df0
--- /dev/null
+++ b/frontend/src/components/secret-rotations-v2/ViewSecretRotationV2GeneratedCredentials/ViewOpenAIAdminApiKeyRotationGeneratedCredentials.tsx
@@ -0,0 +1,32 @@
+import { CredentialDisplay } from "@app/components/secret-rotations-v2/ViewSecretRotationV2GeneratedCredentials/shared/CredentialDisplay";
+import { TOpenAIAdminApiKeyRotationGeneratedCredentialsResponse } from "@app/hooks/api/secretRotationsV2/types/openai-admin-api-key-rotation";
+
+import { ViewRotationGeneratedCredentialsDisplay } from "./shared";
+
+type Props = {
+ generatedCredentialsResponse: TOpenAIAdminApiKeyRotationGeneratedCredentialsResponse;
+};
+
+export const ViewOpenAIAdminApiKeyRotationGeneratedCredentials = ({
+ generatedCredentialsResponse: { generatedCredentials, activeIndex }
+}: Props) => {
+ const inactiveIndex = activeIndex === 0 ? 1 : 0;
+
+ const activeCredentials = generatedCredentials[activeIndex];
+ const inactiveCredentials = generatedCredentials[inactiveIndex];
+
+ return (
+ <ViewRotationGeneratedCredentialsDisplay
+ activeCredentials={
+ <CredentialDisplay isSensitive label="API Key">
+ {activeCredentials?.apiKey}
+ </CredentialDisplay>
+ }
+ inactiveCredentials={
+ <CredentialDisplay isSensitive label="API Key">
+ {inactiveCredentials?.apiKey}
+ </CredentialDisplay>
+ }
+ />
+ );
+};
diff --git a/frontend/src/components/secret-rotations-v2/ViewSecretRotationV2GeneratedCredentials/ViewSecretRotationV2GeneratedCredentials.tsx b/frontend/src/components/secret-rotations-v2/ViewSecretRotationV2GeneratedCredentials/ViewSecretRotationV2GeneratedCredentials.tsx
index 0ecd35e9fe..0d37a62964 100644
--- a/frontend/src/components/secret-rotations-v2/ViewSecretRotationV2GeneratedCredentials/ViewSecretRotationV2GeneratedCredentials.tsx
+++ b/frontend/src/components/secret-rotations-v2/ViewSecretRotationV2GeneratedCredentials/ViewSecretRotationV2GeneratedCredentials.tsx
@@ -28,6 +28,7 @@ import { ViewDatadogApplicationKeySecretRotationGeneratedCredentials } from "./V
import { ViewDbtServiceTokenRotationGeneratedCredentials } from "./ViewDbtSeviceTokenRotationGeneratedCredentials";
import { ViewHpIloRotationGeneratedCredentials } from "./ViewHpIloRotationGeneratedCredentials";
import { ViewOktaClientSecretRotationGeneratedCredentials } from "./ViewOktaClientSecretRotationGeneratedCredentials";
+import { ViewOpenAIAdminApiKeyRotationGeneratedCredentials } from "./ViewOpenAIAdminApiKeyRotationGeneratedCredentials";
import { ViewOpenRouterApiKeyRotationGeneratedCredentials } from "./ViewOpenRouterApiKeyRotationGeneratedCredentials";
import { ViewRedisCredentialsRotationGeneratedCredentials } from "./ViewRedisCredentialsRotationGeneratedCredentials";
import { ViewSalesforceOauthCredentialsRotationGeneratedCredentials } from "./ViewSalesforceOauthCredentialsRotationGeneratedCredentials";
@@ -161,6 +162,13 @@ const Content = ({ secretRotation }: ContentProps) => {
/>
);
break;
+ case SecretRotation.OpenAIAdminApiKey:
+ Component = (
+ <ViewOpenAIAdminApiKeyRotationGeneratedCredentials
+ generatedCredentialsResponse={generatedCredentialsResponse}
+ />
+ );
+ break;
case SecretRotation.HpIloLocalAccount:
Component = (
<ViewHpIloRotationGeneratedCredentials
diff --git a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/OpenAIAdminApiKeyRotationParametersFields.tsx b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/OpenAIAdminApiKeyRotationParametersFields.tsx
new file mode 100644
index 0000000000..64ec024e2a
--- /dev/null
+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/OpenAIAdminApiKeyRotationParametersFields.tsx
@@ -0,0 +1,38 @@
+import { Controller, useFormContext } from "react-hook-form";
+
+import { TSecretRotationV2Form } from "@app/components/secret-rotations-v2/forms/schemas";
+import { FormControl, Input } from "@app/components/v2";
+import { SecretRotation } from "@app/hooks/api/secretRotationsV2";
+
+/** Max length for OpenAI admin API key name (matches backend schema). */
+const OPENAI_ADMIN_API_KEY_NAME_MAX_LENGTH = 100;
+
+export const OpenAIAdminApiKeyRotationParametersFields = () => {
+ const { control } = useFormContext<
+ TSecretRotationV2Form & {
+ type: SecretRotation.OpenAIAdminApiKey;
+ }
+ >();
+
+ return (
+ <Controller
+ name="parameters.name"
+ control={control}
+ render={({ field: { value, onChange }, fieldState: { error } }) => (
+ <FormControl
+ isError={Boolean(error)}
+ errorText={error?.message}
+ label="Key Name"
+ tooltipText="A descriptive name for the generated admin API key"
+ >
+ <Input
+ value={value}
+ onChange={onChange}
+ placeholder="My Rotated Admin API Key"
+ maxLength={OPENAI_ADMIN_API_KEY_NAME_MAX_LENGTH}
+ />
+ </FormControl>
+ )}
+ />
+ );
+};
diff --git a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/SecretRotationV2ParametersFields.tsx b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/SecretRotationV2ParametersFields.tsx
index 7711fb3019..ed75555afd 100644
--- a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/SecretRotationV2ParametersFields.tsx
+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/SecretRotationV2ParametersFields.tsx
@@ -14,6 +14,7 @@ import { HpIloRotationParametersFields } from "./HpIloRotationParametersFields";
import { LdapPasswordRotationParametersFields } from "./LdapPasswordRotationParametersFields";
import { MongoRotationParametersFields } from "./MongoRotationParametersFields";
import { OktaClientSecretRotationParametersFields } from "./OktaClientSecretRotationParametersFields";
+import { OpenAIAdminApiKeyRotationParametersFields } from "./OpenAIAdminApiKeyRotationParametersFields";
import { OpenRouterApiKeyRotationParametersFields } from "./OpenRouterApiKeyRotationParametersFields";
import { RedisCredentialsRotationParametersFields } from "./RedisCredentialsRotationParametersFields";
import { SalesforceOauthCredentialsRotationParametersFields } from "./SalesforceOauthCredentialsRotationParametersFields";
@@ -40,6 +41,7 @@ const COMPONENT_MAP: Record<SecretRotation, React.FC> = {
[SecretRotation.DbtServiceToken]: DbtServiceTokenRotationParametersFields,
[SecretRotation.WindowsLocalAccount]: WindowsLocalAccountRotationParametersFields,
[SecretRotation.OpenRouterApiKey]: OpenRouterApiKeyRotationParametersFields,
+ [SecretRotation.OpenAIAdminApiKey]: OpenAIAdminApiKeyRotationParametersFields,
[SecretRotation.HpIloLocalAccount]: HpIloRotationParametersFields,
[SecretRotation.SupabaseApiKey]: SupabaseApiKeyRotationParametersFields,
[SecretRotation.SalesforceOauthCredentials]: SalesforceOauthCredentialsRotationParametersFields,
diff --git a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/OpenAIAdminApiKeyRotationReviewFields.tsx b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/OpenAIAdminApiKeyRotationReviewFields.tsx
new file mode 100644
index 0000000000..787cf2c6d6
--- /dev/null
+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/OpenAIAdminApiKeyRotationReviewFields.tsx
@@ -0,0 +1,28 @@
+import { useFormContext } from "react-hook-form";
+
+import { TSecretRotationV2Form } from "@app/components/secret-rotations-v2/forms/schemas";
+import { GenericFieldLabel } from "@app/components/v2";
+import { SecretRotation } from "@app/hooks/api/secretRotationsV2";
+
+import { SecretRotationReviewSection } from "./shared";
+
+export const OpenAIAdminApiKeyRotationReviewFields = () => {
+ const { watch } = useFormContext<
+ TSecretRotationV2Form & {
+ type: SecretRotation.OpenAIAdminApiKey;
+ }
+ >();
+
+ const [parameters, { apiKey }] = watch(["parameters", "secretsMapping"]);
+
+ return (
+ <>
+ <SecretRotationReviewSection label="Parameters">
+ <GenericFieldLabel label="Key Name">{parameters.name}</GenericFieldLabel>
+ </SecretRotationReviewSection>
+ <SecretRotationReviewSection label="Secrets Mapping">
+ <GenericFieldLabel label="API Key">{apiKey}</GenericFieldLabel>
+ </SecretRotationReviewSection>
+ </>
+ );
+};
diff --git a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/SecretRotationReviewFields.tsx b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/SecretRotationReviewFields.tsx
index 90b38931de..a5b18b5364 100644
--- a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/SecretRotationReviewFields.tsx
+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/SecretRotationReviewFields.tsx
@@ -16,6 +16,7 @@ import { DbtServiceTokenRotationReviewFields } from "./DbtServiceTokenRotationRe
import { HpIloRotationReviewFields } from "./HpIloRotationReviewFields";
import { LdapPasswordRotationReviewFields } from "./LdapPasswordRotationReviewFields";
import { OktaClientSecretRotationReviewFields } from "./OktaClientSecretRotationReviewFields";
+import { OpenAIAdminApiKeyRotationReviewFields } from "./OpenAIAdminApiKeyRotationReviewFields";
import { OpenRouterApiKeyRotationReviewFields } from "./OpenRouterApiKeyRotationReviewFields";
import { RedisCredentialsRotationReviewFields } from "./RedisCredentialsRotationReviewFields";
import { SalesforceOauthCredentialsRotationReviewFields } from "./SalesforceOauthCredentialsRotationReviewFields";
@@ -42,6 +43,7 @@ const COMPONENT_MAP: Record<SecretRotation, React.FC> = {
[SecretRotation.DbtServiceToken]: DbtServiceTokenRotationReviewFields,
[SecretRotation.WindowsLocalAccount]: WindowsLocalAccountRotationReviewFields,
[SecretRotation.OpenRouterApiKey]: OpenRouterApiKeyRotationReviewFields,
+ [SecretRotation.OpenAIAdminApiKey]: OpenAIAdminApiKeyRotationReviewFields,
[SecretRotation.HpIloLocalAccount]: HpIloRotationReviewFields,
[SecretRotation.SupabaseApiKey]: SupabaseApiKeyRotationReviewFields,
[SecretRotation.SalesforceOauthCredentials]: SalesforceOauthCredentialsRotationReviewFields,
diff --git a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/OpenAIAdminApiKeyRotationSecretsMappingFields.tsx b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/OpenAIAdminApiKeyRotationSecretsMappingFields.tsx
new file mode 100644
index 0000000000..8b51e7bad0
--- /dev/null
+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/OpenAIAdminApiKeyRotationSecretsMappingFields.tsx
@@ -0,0 +1,40 @@
+import { Controller, useFormContext } from "react-hook-form";
+
+import { TSecretRotationV2Form } from "@app/components/secret-rotations-v2/forms/schemas";
+import { FormControl, Input } from "@app/components/v2";
+import { SecretRotation, useSecretRotationV2Option } from "@app/hooks/api/secretRotationsV2";
+
+import { SecretsMappingTable } from "./shared";
+
+export const OpenAIAdminApiKeyRotationSecretsMappingFields = () => {
+ const { control } = useFormContext<
+ TSecretRotationV2Form & {
+ type: SecretRotation.OpenAIAdminApiKey;
+ }
+ >();
+
+ const { rotationOption } = useSecretRotationV2Option(SecretRotation.OpenAIAdminApiKey);
+
+ const items = [
+ {
+ name: "API Key",
+ input: (
+ <Controller
+ render={({ field: { value, onChange }, fieldState: { error } }) => (
+ <FormControl isError={Boolean(error)} errorText={error?.message}>
+ <Input
+ value={value}
+ onChange={onChange}
+ placeholder={rotationOption?.template.secretsMapping.apiKey}
+ />
+ </FormControl>
+ )}
+ control={control}
+ name="secretsMapping.apiKey"
+ />
+ )
+ }
+ ];
+
+ return <SecretsMappingTable items={items} />;
+};
diff --git a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/SecretRotationV2SecretsMappingFields.tsx b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/SecretRotationV2SecretsMappingFields.tsx
index 3dc2f925e1..e905957f13 100644
--- a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/SecretRotationV2SecretsMappingFields.tsx
+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/SecretRotationV2SecretsMappingFields.tsx
@@ -13,6 +13,7 @@ import { DbtServiceTokenRotationSecretsMappingFields } from "./DbtServiceTokenRo
import { HpIloRotationSecretsMappingFields } from "./HpIloRotationSecretsMappingFields";
import { LdapPasswordRotationSecretsMappingFields } from "./LdapPasswordRotationSecretsMappingFields";
import { OktaClientSecretRotationSecretsMappingFields } from "./OktaClientSecretRotationSecretsMappingFields";
+import { OpenAIAdminApiKeyRotationSecretsMappingFields } from "./OpenAIAdminApiKeyRotationSecretsMappingFields";
import { OpenRouterApiKeyRotationSecretsMappingFields } from "./OpenRouterApiKeyRotationSecretsMappingFields";
import { RedisCredentialsRotationSecretsMappingFields } from "./RedisCredentialsRotationSecretsMappingFields";
import { SalesforceOauthCredentialsRotationSecretsMappingFields } from "./SalesforceOauthCredentialsRotationSecretsMappingFields";
@@ -39,6 +40,7 @@ const COMPONENT_MAP: Record<SecretRotation, React.FC> = {
[SecretRotation.DbtServiceToken]: DbtServiceTokenRotationSecretsMappingFields,
[SecretRotation.WindowsLocalAccount]: WindowsLocalAccountRotationSecretsMappingFields,
[SecretRotation.OpenRouterApiKey]: OpenRouterApiKeyRotationSecretsMappingFields,
+ [SecretRotation.OpenAIAdminApiKey]: OpenAIAdminApiKeyRotationSecretsMappingFields,
[SecretRotation.HpIloLocalAccount]: HpIloRotationSecretsMappingFields,
[SecretRotation.SupabaseApiKey]: SupabaseApiKeyRotationSecretsMappingFields,
[SecretRotation.SalesforceOauthCredentials]:
diff --git a/frontend/src/components/secret-rotations-v2/forms/schemas/index.ts b/frontend/src/components/secret-rotations-v2/forms/schemas/index.ts
index 499d876872..1fe8fffb13 100644
--- a/frontend/src/components/secret-rotations-v2/forms/schemas/index.ts
+++ b/frontend/src/components/secret-rotations-v2/forms/schemas/index.ts
@@ -21,6 +21,7 @@ import { DbtServiceTokenRotationSchema } from "./dbt-service-token-rotation-sche
import { HpIloRotationSchema } from "./hp-ilo-rotation-schema";
import { OktaClientSecretRotationSchema } from "./okta-client-secret-rotation-schema";
import { OpenRouterApiKeyRotationSchema } from "./open-router-api-key-rotation-schema";
+import { OpenAIAdminApiKeyRotationSchema } from "./openai-admin-api-key-rotation-schema";
import { OracleDBCredentialsRotationSchema } from "./oracledb-credentials-rotation-schema";
import { RedisCredentialsRotationSchema } from "./redis-credentials-rotation-schema";
import { SalesforceOauthCredentialsRotationSchema } from "./salesforce-oauth-credentials-rotation-schema";
@@ -48,6 +49,7 @@ export const SecretRotationV2FormSchema = (isUpdate: boolean) =>
DbtServiceTokenRotationSchema,
WindowsLocalAccountRotationSchema,
OpenRouterApiKeyRotationSchema,
+ OpenAIAdminApiKeyRotationSchema,
HpIloRotationSchema,
SupabaseApiKeyRotationSchema,
SalesforceOauthCredentialsRotationSchema,
diff --git a/frontend/src/components/secret-rotations-v2/forms/schemas/openai-admin-api-key-rotation-schema.ts b/frontend/src/components/secret-rotations-v2/forms/schemas/openai-admin-api-key-rotation-schema.ts
new file mode 100644
index 0000000000..782de9202a
--- /dev/null
+++ b/frontend/src/components/secret-rotations-v2/forms/schemas/openai-admin-api-key-rotation-schema.ts
@@ -0,0 +1,26 @@
+import { z } from "zod";
+
+import { BaseSecretRotationSchema } from "@app/components/secret-rotations-v2/forms/schemas/base-secret-rotation-v2-schema";
+import { SecretRotation } from "@app/hooks/api/secretRotationsV2";
+
+/** Max length for OpenAI admin API key name (matches backend schema). */
+const OPENAI_ADMIN_API_KEY_NAME_MAX_LENGTH = 100;
+
+export const OpenAIAdminApiKeyRotationSchema = z
+ .object({
+ type: z.literal(SecretRotation.OpenAIAdminApiKey),
+ parameters: z.object({
+ name: z
+ .string()
+ .trim()
+ .min(1, "Key name required")
+ .max(
+ OPENAI_ADMIN_API_KEY_NAME_MAX_LENGTH,
+ `Key name must be ${OPENAI_ADMIN_API_KEY_NAME_MAX_LENGTH} characters or fewer`
+ )
+ }),
+ secretsMapping: z.object({
+ apiKey: z.string().trim().min(1, "API Key secret name required")
+ })
+ })
+ .merge(BaseSecretRotationSchema);
diff --git a/frontend/src/helpers/secretRotationsV2.ts b/frontend/src/helpers/secretRotationsV2.ts
index f768f4dc25..4e8f168b3b 100644
--- a/frontend/src/helpers/secretRotationsV2.ts
+++ b/frontend/src/helpers/secretRotationsV2.ts
@@ -85,6 +85,11 @@ export const SECRET_ROTATION_MAP: Record<
image: "OpenRouter.png",
size: 50
},
+ [SecretRotation.OpenAIAdminApiKey]: {
+ name: "OpenAI Admin API Key",
+ image: "OpenAI.png",
+ size: 50
+ },
[SecretRotation.HpIloLocalAccount]: {
name: "HP iLO Local Account",
image: "SSH.png",
@@ -129,6 +134,7 @@ export const SECRET_ROTATION_CONNECTION_MAP: Record<SecretRotation, AppConnectio
[SecretRotation.DbtServiceToken]: AppConnection.Dbt,
[SecretRotation.WindowsLocalAccount]: AppConnection.SMB,
[SecretRotation.OpenRouterApiKey]: AppConnection.OpenRouter,
+ [SecretRotation.OpenAIAdminApiKey]: AppConnection.OpenAI,
[SecretRotation.HpIloLocalAccount]: AppConnection.SSH,
[SecretRotation.SupabaseApiKey]: AppConnection.Supabase,
[SecretRotation.SalesforceOauthCredentials]: AppConnection.Salesforce,
@@ -154,6 +160,7 @@ export const IS_ROTATION_DUAL_CREDENTIALS: Record<SecretRotation, boolean> = {
[SecretRotation.DbtServiceToken]: true,
[SecretRotation.WindowsLocalAccount]: false,
[SecretRotation.OpenRouterApiKey]: true,
+ [SecretRotation.OpenAIAdminApiKey]: true,
[SecretRotation.HpIloLocalAccount]: false,
[SecretRotation.SupabaseApiKey]: true,
[SecretRotation.SalesforceOauthCredentials]: true,
diff --git a/frontend/src/hooks/api/secretRotationsV2/enums.ts b/frontend/src/hooks/api/secretRotationsV2/enums.ts
index ce3c11c8e5..b7cb3aa898 100644
--- a/frontend/src/hooks/api/secretRotationsV2/enums.ts
+++ b/frontend/src/hooks/api/secretRotationsV2/enums.ts
@@ -15,6 +15,7 @@ export enum SecretRotation {
DbtServiceToken = "dbt-service-token",
WindowsLocalAccount = "windows-local-account",
OpenRouterApiKey = "open-router-api-key",
+ OpenAIAdminApiKey = "openai-admin-api-key",
HpIloLocalAccount = "hp-ilo-local-account",
SupabaseApiKey = "supabase-api-key",
SalesforceOauthCredentials = "salesforce-oauth-credentials",
diff --git a/frontend/src/hooks/api/secretRotationsV2/types/index.ts b/frontend/src/hooks/api/secretRotationsV2/types/index.ts
index 3f0370531f..d14510c593 100644
--- a/frontend/src/hooks/api/secretRotationsV2/types/index.ts
+++ b/frontend/src/hooks/api/secretRotationsV2/types/index.ts
@@ -75,6 +75,11 @@ import {
TOpenRouterApiKeyRotationGeneratedCredentialsResponse,
TOpenRouterApiKeyRotationOption
} from "./open-router-api-key-rotation";
+import {
+ TOpenAIAdminApiKeyRotation,
+ TOpenAIAdminApiKeyRotationGeneratedCredentialsResponse,
+ TOpenAIAdminApiKeyRotationOption
+} from "./openai-admin-api-key-rotation";
import {
TOracleDBCredentialsRotation,
TOracleDBCredentialsRotationGeneratedCredentialsResponse
@@ -122,6 +127,7 @@ export type TSecretRotationV2 = (
| TDbtServiceTokenRotation
| TWindowsLocalAccountRotation
| TOpenRouterApiKeyRotation
+ | TOpenAIAdminApiKeyRotation
| THpIloRotation
| TSupabaseApiKeyRotation
| TSalesforceOauthCredentialsRotation
@@ -145,6 +151,7 @@ export type TSecretRotationV2Option =
| TDbtServiceTokenRotationOption
| TWindowsLocalAccountRotationOption
| TOpenRouterApiKeyRotationOption
+ | TOpenAIAdminApiKeyRotationOption
| THpIloRotationOption
| TSupabaseApiKeyRotationOption
| TSalesforceOauthCredentialsRotationOption
@@ -172,6 +179,7 @@ export type TViewSecretRotationGeneratedCredentialsResponse =
| TDbtServiceTokenRotationGeneratedCredentialsResponse
| TWindowsLocalAccountRotationGeneratedCredentialsResponse
| TOpenRouterApiKeyRotationGeneratedCredentialsResponse
+ | TOpenAIAdminApiKeyRotationGeneratedCredentialsResponse
| THpIloRotationGeneratedCredentialsResponse
| TSupabaseApiKeyRotationGeneratedCredentialsResponse
| TSalesforceOauthCredentialsRotationGeneratedCredentialsResponse
@@ -247,6 +255,7 @@ export type TSecretRotationOptionMap = {
[SecretRotation.DbtServiceToken]: TDbtServiceTokenRotationOption;
[SecretRotation.WindowsLocalAccount]: TWindowsLocalAccountRotationOption;
[SecretRotation.OpenRouterApiKey]: TOpenRouterApiKeyRotationOption;
+ [SecretRotation.OpenAIAdminApiKey]: TOpenAIAdminApiKeyRotationOption;
[SecretRotation.HpIloLocalAccount]: THpIloRotationOption;
[SecretRotation.SupabaseApiKey]: TSupabaseApiKeyRotationOption;
[SecretRotation.SalesforceOauthCredentials]: TSalesforceOauthCredentialsRotationOption;
@@ -271,6 +280,7 @@ export type TSecretRotationGeneratedCredentialsResponseMap = {
[SecretRotation.DbtServiceToken]: TDbtServiceTokenRotationGeneratedCredentialsResponse;
[SecretRotation.WindowsLocalAccount]: TWindowsLocalAccountRotationGeneratedCredentialsResponse;
[SecretRotation.OpenRouterApiKey]: TOpenRouterApiKeyRotationGeneratedCredentialsResponse;
+ [SecretRotation.OpenAIAdminApiKey]: TOpenAIAdminApiKeyRotationGeneratedCredentialsResponse;
[SecretRotation.HpIloLocalAccount]: THpIloRotationGeneratedCredentialsResponse;
[SecretRotation.SupabaseApiKey]: TSupabaseApiKeyRotationGeneratedCredentialsResponse;
[SecretRotation.SalesforceOauthCredentials]: TSalesforceOauthCredentialsRotationGeneratedCredentialsResponse;
diff --git a/frontend/src/hooks/api/secretRotationsV2/types/openai-admin-api-key-rotation.ts b/frontend/src/hooks/api/secretRotationsV2/types/openai-admin-api-key-rotation.ts
new file mode 100644
index 0000000000..c8782e6d7f
--- /dev/null
+++ b/frontend/src/hooks/api/secretRotationsV2/types/openai-admin-api-key-rotation.ts
@@ -0,0 +1,36 @@
+import { AppConnection } from "@app/hooks/api/appConnections/enums";
+import { SecretRotation } from "@app/hooks/api/secretRotationsV2";
+import {
+ TSecretRotationV2Base,
+ TSecretRotationV2GeneratedCredentialsResponseBase
+} from "@app/hooks/api/secretRotationsV2/types/shared";
+
+export type TOpenAIAdminApiKeyRotation = TSecretRotationV2Base & {
+ type: SecretRotation.OpenAIAdminApiKey;
+ parameters: {
+ name: string;
+ };
+ secretsMapping: {
+ apiKey: string;
+ };
+};
+
+export type TOpenAIAdminApiKeyRotationGeneratedCredentials = {
+ apiKey: string;
+ keyId: string;
+};
+
+export type TOpenAIAdminApiKeyRotationGeneratedCredentialsResponse =
+ TSecretRotationV2GeneratedCredentialsResponseBase<
+ SecretRotation.OpenAIAdminApiKey,
+ TOpenAIAdminApiKeyRotationGeneratedCredentials
+ >;
+
+export type TOpenAIAdminApiKeyRotationOption = {
+ name: string;
+ type: SecretRotation.OpenAIAdminApiKey;
+ connection: AppConnection.OpenAI;
+ template: {
+ secretsMapping: TOpenAIAdminApiKeyRotation["secretsMapping"];
+ };
+};