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

# Reindent Todo

> Indent (delta=+1) or outdent (delta=-1) a step, moving its subtree with it.

Lets the user change a step's nesting level from the UI (drag only reorders
within a level). Invalid moves (outdent a top-level step, or indent with no
step above to nest under) are a no-op and return the unchanged list.

Args:
    payload:   ``{delta: +1 | -1}``.
    user:      Authenticated owner.
    thread_id: Target conversation.
    todo_id:   The step (subtree root) to re-level.
    db:        Database session.

Returns:
    The full todo list after the move.



## OpenAPI

````yaml /openapi.json patch /api/workspace/{thread_id}/todos/{todo_id}/reindent
openapi: 3.1.0
info:
  title: HAI-Co² API
  description: Human-AI Co-Construction reference implementation.
  version: 0.1.0
servers:
  - url: https://haico.gr
    description: Production
  - url: https://dev.haico.gr
    description: Development
  - url: http://localhost:8000
    description: Local development
security: []
paths:
  /api/workspace/{thread_id}/todos/{todo_id}/reindent:
    patch:
      tags:
        - Workspace
      summary: Reindent Todo
      description: >-
        Indent (delta=+1) or outdent (delta=-1) a step, moving its subtree with
        it.


        Lets the user change a step's nesting level from the UI (drag only
        reorders

        within a level). Invalid moves (outdent a top-level step, or indent with
        no

        step above to nest under) are a no-op and return the unchanged list.


        Args:
            payload:   ``{delta: +1 | -1}``.
            user:      Authenticated owner.
            thread_id: Target conversation.
            todo_id:   The step (subtree root) to re-level.
            db:        Database session.

        Returns:
            The full todo list after the move.
      operationId: reindent_todo_api_workspace__thread_id__todos__todo_id__reindent_patch
      parameters:
        - name: thread_id
          in: path
          required: true
          schema:
            type: string
            minLength: 1
            title: Thread Id
        - name: todo_id
          in: path
          required: true
          schema:
            type: integer
            minimum: 1
            title: Todo Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TodoReindentRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/TodoSchema'
                title: >-
                  Response Reindent Todo Api Workspace  Thread Id  Todos  Todo
                  Id  Reindent Patch
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - HTTPBearer: []
components:
  schemas:
    TodoReindentRequest:
      properties:
        delta:
          type: integer
          title: Delta
      type: object
      required:
        - delta
      title: TodoReindentRequest
      description: Payload for indenting/outdenting a todo (changing its nesting level).
    TodoSchema:
      properties:
        id:
          type: integer
          title: Id
        thread_id:
          type: string
          title: Thread Id
        text:
          type: string
          title: Text
        done:
          type: boolean
          title: Done
        position:
          type: integer
          title: Position
        depth:
          type: integer
          title: Depth
          default: 0
      type: object
      required:
        - id
        - thread_id
        - text
        - done
        - position
      title: TodoSchema
      description: Serialised todo item returned by workspace endpoints.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    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:
    HTTPBearer:
      type: http
      description: >-
        A personal access token (`haico_pat_...`), created under Profile → API
        keys. Send it as `Authorization: Bearer <key>`. The browser session JWT
        is also accepted but is an internal mechanism and is not part of the
        public contract.
      scheme: bearer

````