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

# Create secret

> Store a new encrypted secret for the authenticated user.

The secret value is encrypted at rest using AES-256-GCM encryption.
Once stored, the original value cannot be retrieved - only a masked 
version is returned in API responses.

**Important:**
- Secret names must be unique per user
- Names should follow environment variable conventions (UPPER_SNAKE_CASE)
- Values are encrypted immediately and never logged




## OpenAPI

````yaml https://neo.api.projectdiscovery.io/api/openapi.json post /api/v1/secrets
openapi: 3.1.0
info:
  contact:
    name: ProjectDiscovery
    url: https://neo.projectdiscovery.io
  description: Neo API Server - Security agent orchestration platform
  license:
    name: Apache 2.0
    url: https://www.apache.org/licenses/LICENSE-2.0
  title: Neo API
  version: 1.0.0
servers:
  - description: Production
    url: https://neo.api.projectdiscovery.io
  - description: Local development
    url: http://localhost:8080
security: []
tags:
  - description: Task execution and management
    name: Tasks
  - description: Agent listing and management
    name: Agents
  - description: Public agent directory
    name: Agent Directory
  - description: User file storage management
    name: Files
  - description: User working memory management
    name: Memory
  - description: Scheduled and recurring task management
    name: Schedules
  - description: Knowledge base and semantic search
    name: Knowledge
  - description: Encrypted user credentials and API keys
    name: Secrets
  - description: Neo API key management for programmatic access
    name: API Keys
  - description: User profile and account information
    name: User
  - description: Task and LLM usage tracking
    name: Usage
  - description: Bring Your Own Key provider management
    name: BYOK
  - description: Model discovery and capabilities
    name: Models
  - description: Third-party integrations
    name: Integrations
  - description: Skill knowledge documents for agent prompts
    name: Skills
  - description: Team management and member invitations
    name: Teams
  - description: Prompt library management and discovery
    name: Prompts
  - description: Slack bot integration for workspace installation and OAuth
    name: Slack
  - description: GitHub integration for PR reviews and repository management
    name: GitHub
  - description: Vulnerability issue tracking and management
    name: Issues
  - description: Subscription billing and plans
    name: Billing
  - description: Project management and member assignments
    name: Projects
  - description: SSH key pair generation and management for remote server access
    name: SSH Keys
  - description: Codebase structural analysis and mapping
    name: Codemaps
  - description: AI-generated codebase documentation and security analysis
    name: CodeWiki
  - description: Captured HTTP traffic query and replay
    name: Network Events
paths:
  /api/v1/secrets:
    post:
      tags:
        - Secrets
      summary: Create secret
      description: >
        Store a new encrypted secret for the authenticated user.


        The secret value is encrypted at rest using AES-256-GCM encryption.

        Once stored, the original value cannot be retrieved - only a masked 

        version is returned in API responses.


        **Important:**

        - Secret names must be unique per user

        - Names should follow environment variable conventions
        (UPPER_SNAKE_CASE)

        - Values are encrypted immediately and never logged
      operationId: post-v1-secrets
      requestBody:
        content:
          application/json:
            example:
              default_available: true
              name: GITHUB_TOKEN
              value: ghp_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
            schema:
              $ref: '#/components/schemas/CreateSecretRequest'
        required: true
      responses:
        '201':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SecretResponse'
          description: Secret created successfully
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Invalid request - check name format or value requirements
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Unauthorized - valid authentication required
        '409':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Conflict - a secret with this name already exists
      security:
        - BearerAuth: []
        - ApiKeyAuth: []
components:
  schemas:
    CreateSecretRequest:
      properties:
        created_by_agent:
          default: false
          description: >
            Indicates whether this secret was automatically created by an AI
            agent (true)

            or manually created by the user (false). Defaults to false if not
            specified.
          example: true
          type: boolean
        default_available:
          default: false
          description: >
            Whether this secret should be exposed by default at task runtime for
            its scope.

            Defaults to false if not specified.
          example: false
          type: boolean
        name:
          description: >
            Secret name (environment variable style).

            Must start with uppercase letter, contain only uppercase letters,
            numbers, and underscores.
          example: GITHUB_TOKEN
          maxLength: 128
          minLength: 1
          pattern: ^[A-Z][A-Z0-9_]*$
          type: string
        project_id:
          description: |
            Optional project ID to create a project-scoped secret.
            If provided, the secret will be shared with all project members.
            Requires project membership to create.
          format: uuid
          type: string
        value:
          description: |
            The secret value to store. This will be encrypted at rest.
            Maximum length is 10,000 characters.
          example: ghp_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
          maxLength: 10000
          minLength: 1
          type: string
      required:
        - name
        - value
      type: object
    SecretResponse:
      properties:
        created_at:
          description: When the secret was created
          format: date-time
          type: string
        created_by_agent:
          description: >
            Indicates whether this secret was automatically created by an AI
            agent (true)

            or manually created by the user (false).
          example: true
          type: boolean
        default_available:
          default: false
          description: >
            Whether this secret is exposed by default at task runtime for its
            scope.

            If false, it is only exposed when explicitly selected in task
            requests.
          example: false
          type: boolean
        id:
          description: Unique identifier for the secret
          example: 550e8400-e29b-41d4-a716-446655440000
          format: uuid
          type: string
        masked_value:
          description: |
            Masked representation of the secret value for display purposes.
            Shows first 3 and last 4 characters with bullets (•) in between.
          example: ghp_xx••••••••xxxx
          type: string
        name:
          description: >
            Secret name (used as environment variable name when injected into
            agent execution).

            Should follow UPPER_SNAKE_CASE convention.
          example: GITHUB_TOKEN
          type: string
        project_id:
          description: |
            Project ID if this is a project-scoped secret.
            Null/absent for personal secrets.
          format: uuid
          type: string
        updated_at:
          description: When the secret was last updated
          format: date-time
          type: string
      required:
        - id
        - name
        - masked_value
        - default_available
      type: object
    ErrorResponse:
      properties:
        code:
          description: >
            Stable machine-readable error code — branch on this rather than

            matching the human `error`/`message` strings. Domain codes include

            `user_spending_cap_reached`, `project_spending_cap_reached`, and

            `insufficient_neo_credits`; otherwise it mirrors the error kind

            (e.g. `forbidden`, `invalid_request`, `not_exists`,
            `already_exists`).
          example: user_spending_cap_reached
          type: string
        error:
          example: Bad request
          type: string
        error_id:
          description: Correlation id for a specific error instance, when present.
          type: string
        kind:
          description: Coarse error category (e.g. "forbidden request", "invalid request").
          example: forbidden request
          type: string
        message:
          description: |
            Human-readable detail (the kind prefixed to the error). For display,
            not for branching.
          type: string
      required:
        - error
      type: object
  securitySchemes:
    BearerAuth:
      bearerFormat: JWT
      description: JWT authentication token
      scheme: bearer
      type: http
    ApiKeyAuth:
      description: Neo API key (neo_sk_* prefix)
      in: header
      name: X-Api-Key
      type: apiKey

````