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

# Create Vault Entry

> Create a Vault entry. Set kind to `secret` for a write-once credential whose value is never read back, or `variable` for a value readable by authorized callers. The name must be unique within the organisation; a duplicate name returns 409. Records the caller as the creator.



## OpenAPI

````yaml /api-reference/agents/shared-resources.oas.yaml post /v1/agents/secrets
openapi: 3.1.0
info:
  title: SLNG Agent Resources API
  version: 1.0.0
  description: >-
    Public control-plane API for agent resources: tools, MCP servers, Vault
    secrets and variables, and client models.
servers:
  - url: https://api.agents.slng.ai
    description: Production
security:
  - bearerAuth: []
tags:
  - name: Tools
    description: Create, test, publish, version, and attach agent tools.
    x-page-icon: wrench
  - name: MCP servers
    description: Configure MCP servers and refresh their live capabilities.
    x-page-icon: plug
  - name: Vault
    description: >-
      Store organisation secrets and readable variables without exposing secret
      values.
    x-page-icon: key
  - name: Client models
    description: Manage bring-your-own LLM provider credentials.
    x-page-icon: brain
paths:
  /v1/agents/secrets:
    post:
      tags:
        - Vault
      summary: Create Vault Entry
      description: >-
        Create a Vault entry. Set kind to `secret` for a write-once credential
        whose value is never read back, or `variable` for a value readable by
        authorized callers. The name must be unique within the organisation; a
        duplicate name returns 409. Records the caller as the creator.
      operationId: createVaultEntry
      requestBody:
        description: >-
          The name, kind, value, and optional description of the Vault entry to
          create.
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/OrgSecretCreate'
            examples:
              Secret:
                summary: Write-once secret
                description: A credential whose value is never returned after creation.
                value:
                  name: STRIPE_KEY
                  kind: secret
                  value: sk_live_example
                  description: Stripe live API key
              Variable:
                summary: Readable variable
                description: A value that authorized callers can read back.
                value:
                  name: DEFAULT_REGION
                  kind: variable
                  value: us-east-1
                  description: Default deployment region
        required: true
      responses:
        '201':
          description: The created Vault entry. Secret values are masked in the response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OrgSecretOut'
        '401':
          $ref: '#/components/responses/UnauthorizedError'
        '403':
          $ref: '#/components/responses/ForbiddenError'
        '409':
          description: An entry with this name already exists in the organisation.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorResponse'
              example:
                detail: A shared secret or variable named 'STRIPE_KEY' already exists
                error:
                  code: RESOURCE_CONFLICT
                  message: >-
                    A shared secret or variable named 'STRIPE_KEY' already
                    exists
                  request_id: 018f9b2c-7e4a-7c3d-9a1b-2c3d4e5f6a7b
        '422':
          $ref: '#/components/responses/ValidationError'
        '429':
          $ref: '#/components/responses/RateLimitError'
        '500':
          $ref: '#/components/responses/InternalServerError'
components:
  schemas:
    OrgSecretCreate:
      properties:
        name:
          type: string
          title: Name
          description: SCREAMING_SNAKE_CASE, unique per org
        kind:
          type: string
          enum:
            - secret
            - variable
          description: >-
            Whether this entry is a `secret` (write-only; its value is never
            returned) or a `variable` (its value is readable by authorized
            callers).
          title: Kind
        value:
          type: string
          maxLength: 10000
          minLength: 1
          description: >-
            The secret or variable value to store. Write-only: it is never
            returned in responses.
          title: Value
          writeOnly: true
        description:
          anyOf:
            - type: string
              maxLength: 500
            - type: 'null'
          description: Optional human-readable description of this resource.
          title: Description
      additionalProperties: false
      type: object
      required:
        - name
        - kind
        - value
      title: OrgSecretCreate
      description: >-
        Request body for creating a Vault entry. Supply the name, the kind
        (secret or variable), the value to store, and an optional description.
      example:
        name: STRIPE_KEY
        kind: secret
        value: sk_live_example
        description: Primary Stripe API key
    OrgSecretOut:
      properties:
        id:
          type: string
          format: uuid
          title: Id
        organisation_id:
          type: string
          format: uuid
          title: Organisation Id
        name:
          type: string
          title: Name
        kind:
          type: string
          enum:
            - secret
            - variable
          description: >-
            Kind of this entry: `secret` values are never returned, `variable`
            values are readable by authorized callers.
          title: Kind
        description:
          anyOf:
            - type: string
            - type: 'null'
          title: Description
        value:
          anyOf:
            - type: string
            - type: 'null'
          description: >-
            The stored value, returned only for variables to authorized readers.
            Always null for secrets, whose value is never returned.
          title: Value
        has_value:
          type: boolean
          description: >-
            Whether a value is stored. True even for secrets, whose value is
            withheld from responses.
          title: Has Value
          default: true
        is_managed:
          type: boolean
          description: >-
            Whether this entry is managed by SLNG rather than created directly
            by your organisation.
          title: Is Managed
          default: false
        revision:
          type: integer
          title: Revision
        created_by:
          anyOf:
            - type: string
            - type: 'null'
          title: Created By
        last_rotated_by:
          anyOf:
            - type: string
            - type: 'null'
          title: Last Rotated By
        last_rotated_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Last Rotated At
        created_at:
          type: string
          format: date-time
          title: Created At
        updated_at:
          type: string
          format: date-time
          title: Updated At
      type: object
      required:
        - id
        - organisation_id
        - name
        - kind
        - revision
        - created_at
        - updated_at
      title: OrgSecretOut
      description: >-
        List and detail view of a Vault entry. Secret values are never returned;
        variable values are returned to authorized readers in `value` (null for
        secrets).
      example:
        id: 3fa85f64-5717-4562-b3fc-2c963f66afa6
        organisation_id: 9c1e5b2a-1111-4c3d-8e2f-abcdef012345
        name: STRIPE_KEY
        kind: secret
        description: Primary Stripe API key
        value: null
        has_value: true
        is_managed: false
        revision: 2
        created_by: user:alice
        last_rotated_by: user:bob
        last_rotated_at: '2026-08-20T12:00:00Z'
        created_at: '2026-08-01T09:00:00Z'
        updated_at: '2026-08-20T12:00:00Z'
    ApiErrorResponse:
      type: object
      description: Standard error envelope returned for failed requests.
      required:
        - detail
        - error
      properties:
        detail:
          type: string
          description: Short human-readable summary of the error.
        error:
          $ref: '#/components/schemas/ApiErrorDetail'
      example:
        detail: A shared secret or variable named 'STRIPE_KEY' already exists
        error:
          code: RESOURCE_CONFLICT
          message: A shared secret or variable named 'STRIPE_KEY' already exists
          request_id: 018f9b2c-7e4a-7c3d-9a1b-2c3d4e5f6a7b
    ApiErrorDetail:
      type: object
      description: Structured error detail carried inside an error response.
      required:
        - code
        - message
      properties:
        code:
          type: string
          description: Stable machine-readable error code.
          example: RESOURCE_CONFLICT
        message:
          type: string
          description: Human-readable explanation of the error.
          example: A shared secret or variable named STRIPE_KEY already exists
        request_id:
          type:
            - string
            - 'null'
          description: Identifier for this request, useful when contacting support.
          example: req_01H8XY7Z9QEXAMPLE
        retryable:
          type: boolean
          description: Whether retrying the same request may succeed.
          example: false
        fields:
          type: array
          description: >-
            Per-field validation problems, when the error relates to specific
            request fields.
          items:
            type: object
            additionalProperties: true
          example: []
      example:
        code: PUBLIC_SHARED_RESOURCES_DISABLED
        message: Public shared resources are disabled for this organisation
        request_id: req_01H8XY7Z9QEXAMPLE
        retryable: false
  responses:
    UnauthorizedError:
      description: The API key is missing or invalid.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiErrorResponse'
          example:
            detail: Invalid API key
            error:
              code: AUTH_REQUIRED
              message: Invalid API key
              request_id: 018f9b2c-7e4a-7c3d-9a1b-2c3d4e5f6a7b
              retryable: false
    ForbiddenError:
      description: >-
        The caller lacks permission, or the public shared-resource API is
        disabled for the organisation.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiErrorResponse'
          examples:
            permission_denied:
              summary: Owner or admin access required
              value:
                detail: Organisation owner or admin access required
                error:
                  code: PERMISSION_DENIED
                  message: Organisation owner or admin access required
                  request_id: 018f9b2c-7e4a-7c3d-9a1b-2c3d4e5f6a7b
                  retryable: false
            api_disabled:
              summary: Public shared-resource API disabled for the organisation
              value:
                detail: >-
                  Public shared-resource API access is disabled for this
                  organisation
                error:
                  code: PUBLIC_SHARED_RESOURCES_DISABLED
                  message: >-
                    Public shared-resource API access is disabled for this
                    organisation
                  request_id: 018f9b2c-7e4a-7c3d-9a1b-2c3d4e5f6a7b
                  retryable: false
    ValidationError:
      description: Request validation failed. See error.fields for the offending fields.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiErrorResponse'
          example:
            detail: >-
              Request validation failed. Fix the highlighted fields and try
              again.
            error:
              code: VALIDATION_FAILED
              message: >-
                Request validation failed. Fix the highlighted fields and try
                again.
              request_id: 018f9b2c-7e4a-7c3d-9a1b-2c3d4e5f6a7b
              retryable: false
              fields:
                - path: name
                  message: >-
                    Name must be SCREAMING_SNAKE_CASE: start with a letter, then
                    letters, digits, or underscores (e.g. STRIPE_API_KEY)
    RateLimitError:
      description: >-
        The organisation exceeded its request rate limit. Retry after the window
        resets.
      headers:
        Retry-After:
          schema:
            type: integer
        X-RateLimit-Limit:
          schema:
            type: integer
        X-RateLimit-Remaining:
          schema:
            type: integer
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiErrorResponse'
          example:
            detail: Rate limit exceeded. Maximum 60 requests per 60 seconds.
            error:
              code: INTERNAL_ERROR
              message: Rate limit exceeded. Maximum 60 requests per 60 seconds.
              request_id: 018f9b2c-7e4a-7c3d-9a1b-2c3d4e5f6a7b
              retryable: false
    InternalServerError:
      description: The request failed unexpectedly. Secret values are never exposed.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiErrorResponse'
          example:
            detail: An unexpected error occurred.
            error:
              code: INTERNAL_ERROR
              message: An unexpected error occurred.
              request_id: 018f9b2c-7e4a-7c3d-9a1b-2c3d4e5f6a7b
              retryable: false
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: SLNG API key
      description: Your SLNG consumer API key.

````