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

# Write a secret

> A webhook signing secret or a model credential. Write only.



## OpenAPI

````yaml openapi/en/cell.json PUT /v1/secrets/{kind}/{secret_id}
openapi: 3.1.0
info:
  title: Niadra data API
  version: '1'
  description: >-
    Writing, context, history, objects, identity, privacy and governance of one
    space. Every space has a stable address, with the space and the region in
    its name.
servers:
  - url: https://{space}.{region}.api.niadra.com
    variables:
      space:
        default: acme-prod
        description: The space, which comes in the source key.
      region:
        default: us-east-1
        description: The region of the space, which also comes in the key.
security: []
paths:
  /v1/secrets/{kind}/{secret_id}:
    put:
      tags:
        - governance
      summary: Write a secret
      description: >-
        Writes a secret straight into the vault of the cell: a webhook signing
        secret (`webhook`) or the credential of a model provider you bring
        (`model`). Secrets are write only; the answer carries the new version,
        and during a webhook secret rotation the previous version stays valid
        until you retire it.


        **Authentication.** Console person token with the `security` role (or
        admin), or a source key with the `admin` scope.
      operationId: put_secret_v1_secrets__kind___secret_id__put
      parameters:
        - in: path
          name: kind
          required: true
          schema:
            enum:
              - webhook
              - model
            title: Kind
            type: string
          description: >-
            `webhook` for a webhook signing secret, `model` for a model provider
            credential.
          example: webhook
        - in: path
          name: secret_id
          required: true
          schema:
            title: Secret Id
            type: string
          example: whe_crm
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SecretIn'
            example:
              value: whsec_MfKQ9r8GKYqrTwjUPD8ILPZIo2LaLaSw
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SecretWritten'
              example:
                version: 3
          description: Stored. `version` is the secret version now in use.
        '422':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Problem'
          description: The request does not match the contract.
      security:
        - sourceKey: []
        - personToken: []
components:
  schemas:
    SecretIn:
      additionalProperties: false
      description: 'Write-only: the value goes to the cell vault and is never returned.'
      properties:
        value:
          maxLength: 8192
          minLength: 1
          title: Value
          type: string
      required:
        - value
      title: SecretIn
      type: object
    SecretWritten:
      additionalProperties: false
      properties:
        version:
          title: Version
          type: integer
      required:
        - version
      title: SecretWritten
      type: object
    Problem:
      additionalProperties: false
      description: RFC 9457 problem details; `code` comes from the versioned error catalog.
      properties:
        code:
          title: Code
          type: string
        detail:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          title: Detail
        request_id:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          title: Request Id
        status:
          title: Status
          type: integer
        title:
          title: Title
          type: string
        type:
          default: about:blank
          title: Type
          type: string
      required:
        - title
        - status
        - code
      title: Problem
      type: object
  securitySchemes:
    sourceKey:
      type: http
      scheme: bearer
      description: nia_sk_...
    personToken:
      type: http
      scheme: bearer
      bearerFormat: JWT

````