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

# Create a new organization secret

> Creates a new secret at the organization level. The secret is stored securely in Infisical and the creator is automatically granted owner permissions. The secret value should be provided as a JSON string matching the format required by the resource type.



## OpenAPI

````yaml /openapi/em-runtime-governance-v2.yaml post /governance/resources/organizations/secrets
openapi: 3.1.0
info:
  title: em_runtime_governance
  version: 5.27.0
servers: []
security: []
paths:
  /governance/resources/organizations/secrets:
    post:
      tags:
        - secrets
      summary: Create a new organization secret
      description: >-
        Creates a new secret at the organization level. The secret is stored
        securely in Infisical and the creator is automatically granted owner
        permissions. The secret value should be provided as a JSON string
        matching the format required by the resource type.
      operationId: create_org_secret
      parameters:
        - name: X-Project-ID
          in: header
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: X-Project-Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SecretCreateRequest'
      responses:
        '201':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SecretCreateResponse'
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Bad Request
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Unauthorized
        '403':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Forbidden
        '404':
          description: Not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '409':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Conflict
        '422':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Unprocessable Entity
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Internal Server Error
        '503':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Service Unavailable
      security:
        - HTTPBearer: []
components:
  schemas:
    SecretCreateRequest:
      properties:
        name:
          type: string
          title: Name
          description: Secret name (e.g., 'credentials')
        value:
          type: string
          title: Value
          description: >-
            Secret value as string. Structure depends on the resource type. For
            more complex secrets this can be a serialized JSON string.
        description:
          anyOf:
            - type: string
            - type: 'null'
          title: Description
          description: Optional description of the secret
      type: object
      required:
        - name
        - value
      title: SecretCreateRequest
      description: Request body for creating a secret.
      examples:
        - description: AWS credentials for my-bucket
          name: credentials
          value: >-
            {"aws_access_key_id": "AKIAIOSFODNN7EXAMPLE",
            "aws_secret_access_key": "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY"}
        - description: GCS service account for analytics bucket
          name: credentials
          value: >-
            {"service_account_json": {"type": "service_account", "project_id":
            "my-project", "private_key": "..."}}
        - description: Azure storage connection
          name: credentials
          value: >-
            {"connection_string":
            "DefaultEndpointsProtocol=https;AccountName=myaccount;AccountKey=mykey;EndpointSuffix=core.windows.net"}
        - description: PostgreSQL database credentials
          name: credentials
          value: '{"username": "db_user", "password": "db_password"}'
    SecretCreateResponse:
      properties:
        name:
          type: string
          title: Name
          description: Name of the created secret
        created_at:
          type: string
          format: date-time
          title: Created At
          description: Timestamp when the secret was created
      type: object
      required:
        - name
        - created_at
      title: SecretCreateResponse
      description: Response body for a newly created secret.
    ErrorResponse:
      properties:
        error:
          $ref: '#/components/schemas/ErrorBody'
      type: object
      required:
        - error
      title: ErrorResponse
      description: Standard error response model.
    ErrorBody:
      properties:
        code:
          $ref: '#/components/schemas/ErrorCode'
        message:
          type: string
          title: Message
        details:
          additionalProperties: true
          type: object
          title: Details
        request_id:
          type: string
          title: Request Id
        timestamp:
          type: string
          format: date-time
          title: Timestamp
      type: object
      required:
        - code
        - message
        - request_id
        - timestamp
      title: ErrorBody
      description: Error body with structured details.
    ErrorCode:
      type: string
      enum:
        - INVALID_REQUEST
        - INVALID_TOKEN
        - INSUFFICIENT_PERMISSIONS
        - RESOURCE_NOT_FOUND
        - RESOURCE_ALREADY_EXISTS
        - VALIDATION_ERROR
        - RATE_LIMIT_EXCEEDED
        - SERVICE_UNAVAILABLE
        - INTERNAL_ERROR
      title: ErrorCode
      description: Standard error codes for API responses.
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer

````