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

# Patch Instructions

> Upsert and patch the authenticated user's global instructions.

PATCH semantics: only fields present in the body change. If no row exists
for the user, one is created seeded from ``DEFAULT_INSTRUCTIONS`` and then
the patch is applied. ``updated_at`` is bumped on any write; ``created_at``
is only set on insert. ``user_id`` is always the authenticated principal's.



## OpenAPI

````yaml patch /api/v1/instructions
openapi: 3.1.0
info:
  title: EDN Memory Engine
  version: 0.1.0
servers:
  - description: EDN evaluation endpoint
    url: https://api.tensorpro.ai
security:
  - EDNApiKey: []
paths:
  /api/v1/instructions:
    patch:
      summary: Patch Instructions
      description: >-
        Upsert and patch the authenticated user's global instructions.


        PATCH semantics: only fields present in the body change. If no row
        exists

        for the user, one is created seeded from ``DEFAULT_INSTRUCTIONS`` and
        then

        the patch is applied. ``updated_at`` is bumped on any write;
        ``created_at``

        is only set on insert. ``user_id`` is always the authenticated
        principal's.
      operationId: patch_instructions_api_v1_instructions_patch
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/InstructionsUpdate'
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InstructionsResponse'
          description: Successful Response
        '422':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
          description: Validation Error
components:
  schemas:
    InstructionsUpdate:
      additionalProperties: false
      description: |-
        PATCH body: every field optional, only provided fields are applied.

        ``custom_instructions`` length is bounded at the API layer; an over-long
        value is rejected with 422 before any DB write.
      properties:
        custom_instructions:
          anyOf:
            - maxLength: 4000
              type: string
            - type: 'null'
          title: Custom Instructions
        display_name:
          anyOf:
            - type: string
            - type: 'null'
          title: Display Name
        domain:
          anyOf:
            - type: string
            - type: 'null'
          title: Domain
        language:
          anyOf:
            - type: string
            - type: 'null'
          title: Language
        onboarded:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Onboarded
        response_style:
          anyOf:
            - type: string
            - type: 'null'
          title: Response Style
        values:
          anyOf:
            - type: string
            - type: 'null'
          title: Values
      title: InstructionsUpdate
      type: object
    InstructionsResponse:
      description: |-
        Console-facing global instructions.

        Mirrors the nullable columns on ``user_instructions``. A user with no
        stored row is returned the defaults (all null) without a row being
        created.
      properties:
        custom_instructions:
          anyOf:
            - type: string
            - type: 'null'
          title: Custom Instructions
        display_name:
          anyOf:
            - type: string
            - type: 'null'
          title: Display Name
        domain:
          anyOf:
            - type: string
            - type: 'null'
          title: Domain
        language:
          anyOf:
            - type: string
            - type: 'null'
          title: Language
        onboarded:
          default: false
          title: Onboarded
          type: boolean
        response_style:
          anyOf:
            - type: string
            - type: 'null'
          title: Response Style
        values:
          anyOf:
            - type: string
            - type: 'null'
          title: Values
      title: InstructionsResponse
      type: object
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          title: Detail
          type: array
      title: HTTPValidationError
      type: object
    ValidationError:
      properties:
        ctx:
          title: Context
          type: object
        input:
          title: Input
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          title: Location
          type: array
        msg:
          title: Message
          type: string
        type:
          title: Error Type
          type: string
      required:
        - loc
        - msg
        - type
      title: ValidationError
      type: object
  securitySchemes:
    EDNApiKey:
      description: >-
        EDN API key presented as 'Bearer <key>' in the Authorization header.
        Create and manage keys from the Console.
      in: header
      name: Authorization
      type: apiKey

````