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

# Create or update a secret

> Writes a secret value (overwrites if it exists, i.e. rotation).
The name is the one referenced in the manifest's `runtime.env`;
multiple apps of the same publisher may share one name.



## OpenAPI

````yaml /jp/datahub/api/openapi.json put /v1/secrets/{name}
openapi: 3.1.0
info:
  title: DataHub API
  version: 0.2.0
  description: Public /v1 contract of Octoparse DataHub. Internal channels are excluded.
servers:
  - url: https://api-datahub.octoparse.com
security:
  - bearerAuth: []
tags:
  - name: Discovery
    description: >-
      Anonymous access: platform metadata (currency), data app search, detail
      and input contract, machine-readable manifest spec.
  - name: Publishing
    description: >-
      Self-service publishing channel (API Key auth), two-phase: validate first
      (validate / package, nothing persisted), then publish (POST /data-apps,
      the submission goes live as a new Release). api kind (declarative
      integration) becomes visible on publish; code kind (code package) returns
      202 and enters an async image build; once ready it is promoted to a
      Release, visible and runnable. Poll progress via GET
      /data-apps/{ref}/builds.
  - name: Runs & Results
    description: >-
      Start / query / cancel runs and read result records with pagination.
      Business inputs go in the request body; platform run options (wait,
      max_records) go in query parameters.
  - name: Datasets
    description: >-
      Metadata and record access for platform datasets (including seeded stock
      data).
  - name: Account
    description: Account info and cumulative usage for the current API Key.
  - name: Secrets
    description: >-
      CRUD for upstream credentials (environment entries referenced by manifest
      `runtime.env`). Plaintext is write-only: every read returns a mask.
paths:
  /v1/secrets/{name}:
    put:
      tags:
        - Secrets
      summary: Create or update a secret
      description: |-
        Writes a secret value (overwrites if it exists, i.e. rotation).
        The name is the one referenced in the manifest's `runtime.env`;
        multiple apps of the same publisher may share one name.
      operationId: put_secret_v1_secrets__name__put
      parameters:
        - name: name
          in: path
          required: true
          schema:
            type: string
            title: Name
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SecretValue'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DataEnvelope_SecretInfo_'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    SecretValue:
      properties:
        value:
          type: string
          title: Value
      type: object
      required:
        - value
      title: SecretValue
    DataEnvelope_SecretInfo_:
      properties:
        data:
          $ref: '#/components/schemas/SecretInfo'
      type: object
      required:
        - data
      title: DataEnvelope[SecretInfo]
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    SecretInfo:
      properties:
        name:
          type: string
          title: Name
        masked:
          type: string
          title: Masked
        scope:
          type: string
          title: Scope
          default: publisher
        created_at:
          type: string
          title: Created At
        updated_at:
          type: string
          title: Updated At
      type: object
      required:
        - name
        - masked
        - created_at
        - updated_at
      title: SecretInfo
      description: >-
        Secret metadata. The plaintext never leaves the API; only a mask is
        returned.
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: DataHub API Key

````