---
title: "Create secret version"
method: POST
path: "/orgs/{orgID}/secrets/{secretID}/versions"
tags: ["Secrets"]
---

# Create secret version

`POST /orgs/{orgID}/secrets/{secretID}/versions`

## Request

- Base URL: `https://api.omnara.com/v1`
- URL: `https://api.omnara.com/v1/orgs/{orgID}/secrets/{secretID}/versions`
- Auth: one of:
  - HTTP bearer
  - API key in cookie `__Host-omnara_session` and API key in header `X-Omnara-Csrf`

## Path parameters

- `orgID` string, required
- `secretID` string, required

## Request body

- SecretVersionRequest
  - `material` union, required: The secret's value. kind selects its shape: generic, oauth_token_set, aws_credentials, or github_app_credentials.
    - GenericSecretMaterial
      - `kind` 'generic', required: generic: a single value, such as an API key.
      - `value` string, required: The secret value, up to 64 KiB.
    - OAuthTokenSetSecretMaterial
      - `kind` 'oauth_token_set', required: oauth_token_set: OAuth tokens for MCP servers that use oauth auth.
      - `access_token` string, required: Access token sent to the MCP server; replaced on each refresh.
      - `access_token_expires_in_seconds` integer: Seconds until the access token expires. Omit if it doesn't expire.
      - `refresh` OAuthRefreshSecretMaterial: Refresh material. Without it, the token can't be renewed once it expires.
        - `refresh_token` string, required: Refresh token exchanged at token_endpoint for new access tokens.
        - `token_endpoint` string, uri, required: OAuth token endpoint used to refresh the access token. Must be HTTPS, except for loopback hosts in local development.
        - `client_id` string, required: OAuth client ID.
        - `client_secret` string: OAuth client secret sent with refresh requests. Omit if the client has none.
        - `resource` string, required: Resource indicator sent with refresh requests.
      - `id_token` string: OpenID Connect ID token, if one was issued.
      - `mcp_url` string: URL of the MCP server the tokens were issued for.
      - `scopes` string: Granted scopes, space-separated.
      - `token_type` string: Token type, such as Bearer.
    - AWSCredentialsSecretMaterial
      - `kind` 'aws_credentials', required: aws_credentials: AWS access keys used to sign requests with SigV4.
      - `access_key_id` string, required: AWS access key ID.
      - `secret_access_key` string, required: AWS secret access key.
      - `session_token` string: Session token for temporary credentials. Not refreshed automatically.
      - `role_arn` string: IAM role to assume through STS before signing.
      - `external_id` string: External ID sent to STS when assuming role_arn.
    - GitHubAppCredentialsSecretMaterial
      - `kind` 'github_app_credentials', required: github_app_credentials: a GitHub App's ID, private key, and webhook secret.
      - `app_id` string, required: GitHub App ID, not the installation ID.
      - `private_key` string, required: Unencrypted RSA private key in PEM format. Stored encrypted.
      - `webhook_secret` string, required: The App's webhook secret, used to verify webhook signatures.

## Response `200`

Secret version created.

- Secret
  - `id` string, required: Identifies the secret; other resources reference it by this ID instead of storing the value.
  - `org_id` string, required: Organization the secret belongs to.
  - `management_kind` 'tenant' | 'cluster', required: Whether the organization manages this secret or the Omnara installation provisions and manages it.
  - `owner` union, required: Who owns the secret; a project can use it without a grant only if the project owns it.
    - OrgSecretOwner
      - `kind` 'org', required: org: the organization owns the secret.
    - ProjectSecretOwner
      - `kind` 'project', required: project: a single project owns the secret.
      - `project_id` string, required: Project that owns the secret.
    - UserSecretOwner
      - `kind` 'user', required: user: a user owns the secret.
      - `user_id` string, required: User who owns the secret.
  - `name` string, required: Display name of the secret.
  - `kind` 'generic' | 'oauth_token_set' | 'slack_app_credentials' | 'aws_credentials' | 'github_app_credentials', required: What type of credential the secret holds, which determines its payload fields.
  - `metadata` Metadata, required: Caller-supplied key-value labels on the secret.
  - `current_version_number` integer, required: Version of the value currently in use; each rotation increments it.
  - `payload_keys` string[], required: Names of the fields stored in the current value, such as value or access_token; values are never returned.
  - `created_at` string, date-time, required: When the secret was created.
  - `updated_at` string, date-time, required: When the secret's name, metadata, or current version last changed.

## Other responses

- `400`: The request was invalid.
- `401`: Authentication is required or invalid.
- `403`: The authenticated principal is not authorized.
- `404`: The requested resource was not found or is not visible.
- `409`: The request conflicts with current resource state or idempotency history.
- `500`: An unexpected internal server error occurred.
- `503`: The service dependency required to satisfy the request is unavailable.
- `4XX`: Any other client error. The body carries the shared Error envelope restricted to client error codes; statuses with a dedicated response above are documented precisely.
- `5XX`: Any other server error. The body carries the shared Error envelope restricted to server error codes.

## Changes

- **2026-10-07** `680248a0ba72`: 1 warning, 2 info
  - added the new `github_app_credentials` enum value to the `kind` response property for the response status `200`
  - added `github_app_credentials` discriminator mapping keys to the `material` request property
  - added `#/components/schemas/GitHubAppCredentialsSecretMaterial` to the `material` request property `oneOf` list
- **2026-09-28** `acddeb8fc6a5`: 8 warning, 8 info
  - added the new `upstream_unavailable` enum value to the `code` response property for the response status `400`
  - added the new `upstream_unavailable` enum value to the `code` response property for the response status `401`
  - added the new `upstream_unavailable` enum value to the `code` response property for the response status `403`
  - added the new `upstream_unavailable` enum value to the `code` response property for the response status `404`
  - …12 more
- **2026-09-01** `e4978b047d7a`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/omnara/apis/omnara-api-2/changes/orgs/:orgID/secrets/:secretID/versions/post.md)

---

[API](https://skmtc.dev/omnara/apis/omnara-api-2.md) - [All operations](https://skmtc.dev/omnara/apis/omnara-api-2/llms.txt) - [OpenAPI document](https://skmtc.dev/omnara/apis/omnara-api-2/revisions/343aebb1dff1?raw)
