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

# Set value (SDK)

> Sets a value with optional TTL (seconds). The namespace is created implicitly on first write.



## OpenAPI

````yaml /api-reference/openapi.json put /api/v1/runtime/v1/kv/{namespace}/item/{key}
openapi: 3.0.0
info:
  title: Runflow Runtime API
  description: >-
    Programmatic surface for the Runflow platform — used by the SDK, the CLI,
    the execution engine, and any server-to-server caller. Authenticate with an
    `x-api-key` header (or `Authorization: Bearer ...`).
  version: 1.0.0
  contact: {}
servers:
  - url: https://api.runflow.ai
    description: Production
  - url: http://localhost:3000
    description: Local development
security: []
tags: []
paths:
  /api/v1/runtime/v1/kv/{namespace}/item/{key}:
    put:
      tags:
        - Runtime API - Key-Value Store
      summary: Set value (SDK)
      description: >-
        Sets a value with optional TTL (seconds). The namespace is created
        implicitly on first write.
      operationId: KvRuntimeController_setItem
      parameters:
        - name: namespace
          required: true
          in: path
          description: Namespace name
          schema:
            type: string
        - name: key
          required: true
          in: path
          description: Entry key (URL-encoded)
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SetKvEntryDto'
      responses:
        '200':
          description: Value stored successfully.
      security:
        - bearer: []
components:
  schemas:
    SetKvEntryDto:
      type: object
      properties:
        value:
          description: >-
            Value to store (any JSON-serializable value, max 256 KB). null is
            rejected — use DELETE to remove a key.
          example:
            step: checkout
            items: 3
        ttl:
          type: integer
          minimum: 1
          description: >-
            Time-to-live in seconds. Omit for a persistent entry. Setting a
            value without ttl clears any previous TTL.
          example: 3600
      required:
        - value

````