> ## Documentation Index
> Fetch the complete documentation index at: https://docs.gp.scale.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Create Secret

> Create an account-level secret.

The secret value is stored in the cloud provider's secret store.
SGP only stores metadata (key name, description, audit info).
The value is never returned by any API.
Returns 409 if a secret with the same key already exists.



## OpenAPI

````yaml https://api.dev-sgp.scale.com/openapi-versions/v5/openapi.json post /v5/sgp/secrets
openapi: 3.1.0
info:
  title: EGP API V5
  description: >-
    This is the parent API for all EGP APIs. If you are looking for the EGP API,
    please go to https://api.egp.scale.com/docs.
  contact:
    name: Scale Generative AI Platform
    url: https://scale.com/genai-platform
  version: 0.1.0
servers:
  - url: https://api.egp.scale.com
security: []
paths:
  /v5/sgp/secrets:
    post:
      tags:
        - SGP Cloud Secrets
      summary: Create Secret
      description: |-
        Create an account-level secret.

        The secret value is stored in the cloud provider's secret store.
        SGP only stores metadata (key name, description, audit info).
        The value is never returned by any API.
        Returns 409 if a secret with the same key already exists.
      operationId: POST-V5-/sgp/secrets
      parameters:
        - name: x-selected-account-id
          in: header
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: Account ID Header
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SgpCloudSecretCreateRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SgpCloudSecret'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      deprecated: true
      security:
        - APIKeyHeader: []
components:
  schemas:
    SgpCloudSecretCreateRequest:
      properties:
        key:
          type: string
          maxLength: 90
          minLength: 1
          pattern: ^[a-z0-9]([a-z0-9-]*[a-z0-9])?$
          title: Key
          description: >-
            Secret name (e.g. openai-api-key). Must be lowercase alphanumeric
            with hyphens (no dots or underscores), so it maps 1:1 to a valid
            secret name on every cloud backend (AWS / Azure Key Vault / GCP
            Secret Manager).
        value:
          type: string
          minLength: 1
          title: Value
          description: The secret value to store
        description:
          title: Description
          description: Optional human-readable description
          type: string
      type: object
      required:
        - key
        - value
      title: SgpCloudSecretCreateRequest
      description: Request body for creating a secret.
    SgpCloudSecret:
      properties:
        id:
          type: string
          title: Id
        object:
          type: string
          const: sgp_cloud_secret
          title: Object
          default: sgp_cloud_secret
        key:
          type: string
          title: Key
        description:
          title: Description
          type: string
        cloud_secret_path:
          type: string
          title: Cloud Secret Path
        updated_by:
          title: Updated By
          description: User who last updated the secret.
          type: string
        updated_at:
          title: Updated At
          description: Timestamp of last update.
          type: string
          format: date-time
        account_id:
          type: string
          title: Account Id
        created_at:
          type: string
          format: date-time
          title: Created At
        created_by:
          $ref: '#/components/schemas/Identity'
          description: The identity that created the entity.
      type: object
      required:
        - key
        - cloud_secret_path
        - id
        - account_id
        - created_at
        - created_by
      description: API response model for a secret. Never includes the secret value.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    Identity:
      properties:
        id:
          type: string
          title: Id
        object:
          type: string
          const: identity
          title: Object
          default: identity
        type:
          $ref: '#/components/schemas/IdentityType'
      type: object
      required:
        - id
        - type
      title: Identity
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          title: Error Type
          type: string
        input:
          title: Input
        ctx:
          type: object
          title: Context
          additionalProperties: true
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
    IdentityType:
      type: string
      enum:
        - user
        - service_account
      title: IdentityType
  securitySchemes:
    APIKeyHeader:
      type: apiKey
      in: header
      name: x-api-key

````