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

# Create Secret

> Create a new global secret.

The secret will be encrypted and stored securely. If teamId is provided,
the secret will be associated with that team (requires team membership).



## OpenAPI

````yaml https://api.primeintellect.ai/openapi.json post /api/v1/secrets/
openapi: 3.1.0
info:
  title: PI API
  version: 0.1.0
servers:
  - url: https://api.primeintellect.ai
security: []
paths:
  /api/v1/secrets/:
    post:
      tags:
        - Secrets
      summary: Create Secret
      description: |-
        Create a new global secret.

        The secret will be encrypted and stored securely. If teamId is provided,
        the secret will be associated with that team (requires team membership).
      operationId: create_secret_api_v1_secrets__post
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SecretCreateRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GenericResponse_SecretResponse_'
        '401':
          description: Authorization failed
        '422':
          description: Invalid request data
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - HTTPBearer: []
components:
  schemas:
    SecretCreateRequest:
      properties:
        name:
          type: string
          maxLength: 255
          minLength: 1
          pattern: ^[A-Z][A-Z0-9_]*$
          title: Name
          description: >-
            Name of the secret (must start with uppercase, only uppercase,
            numbers, underscores)
        description:
          anyOf:
            - type: string
              maxLength: 500
            - type: 'null'
          title: Description
          description: Optional description of the secret
        value:
          type: string
          minLength: 1
          title: Value
          description: The secret value to store (will be encrypted)
        teamId:
          anyOf:
            - type: string
            - type: 'null'
          title: Teamid
          description: Optional team ID for team-level secrets
        isFile:
          type: boolean
          title: Isfile
          description: Whether this secret represents a file (max 64KB base64 encoded)
          default: false
      type: object
      required:
        - name
        - value
      title: SecretCreateRequest
    GenericResponse_SecretResponse_:
      properties:
        data:
          anyOf:
            - $ref: '#/components/schemas/SecretResponse'
            - type: 'null'
          description: Response data
        status:
          anyOf:
            - type: string
            - type: 'null'
          title: Status
          description: Response status
      type: object
      title: GenericResponse[SecretResponse]
    ErrorResponse:
      properties:
        errors:
          items:
            $ref: '#/components/schemas/ErrorDetail'
          type: array
          title: Errors
      type: object
      required:
        - errors
      title: ErrorResponse
    SecretResponse:
      properties:
        id:
          type: string
          title: Id
          description: Unique identifier of the secret
        name:
          type: string
          title: Name
          description: Name of the secret
        description:
          anyOf:
            - type: string
            - type: 'null'
          title: Description
          description: Description of the secret
        isFile:
          type: boolean
          title: Isfile
          description: Whether this secret is a file
          default: false
        userId:
          anyOf:
            - type: string
            - type: 'null'
          title: Userid
          description: ID of the owning user
        teamId:
          anyOf:
            - type: string
            - type: 'null'
          title: Teamid
          description: ID of the owning team
        createdAt:
          type: string
          format: date-time
          title: Createdat
          description: When the secret was created
        updatedAt:
          type: string
          format: date-time
          title: Updatedat
          description: When the secret was last updated
      type: object
      required:
        - id
        - name
        - createdAt
        - updatedAt
      title: SecretResponse
    ErrorDetail:
      properties:
        param:
          type: string
          title: Param
        details:
          type: string
          title: Details
      type: object
      required:
        - param
        - details
      title: ErrorDetail
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer

````