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

# Get Tree Document

> A node's write document: valid input to `PUT .../tree/{branch}/push`.

Read, edit `state`, set `message`, and push the whole document back.
Pushing it back unchanged is a no-op (`unchanged: true`).

- `state` is exactly what push stores. Push replaces all five sections,
  so always send the document you read, not a hand-written subset.
- Fields starting with `_` (`_title`, `_description`,
  `_snapshot_commit_id`, `_from_title`, `_to_title`) are read-only
  annotations; push ignores them.
- `status` is read-only context (parents, ingress/egress, counts).
- `expected_head_commit` is the branch head this document was read at; if
  the branch has moved since, push returns 409.



## OpenAPI

````yaml get /orgs/{org_id}/nodes/{node_id}/tree/{branch}
openapi: 3.1.0
info:
  title: Flow API
  description: Content-addressing backend with Git-like versioning
  version: 1.0.0
servers:
  - url: https://api.yertle.com
    description: Production
security:
  - BearerAuth: []
paths:
  /orgs/{org_id}/nodes/{node_id}/tree/{branch}:
    get:
      tags:
        - nodes
      summary: Get Tree Document
      description: >-
        A node's write document: valid input to `PUT .../tree/{branch}/push`.


        Read, edit `state`, set `message`, and push the whole document back.

        Pushing it back unchanged is a no-op (`unchanged: true`).


        - `state` is exactly what push stores. Push replaces all five sections,
          so always send the document you read, not a hand-written subset.
        - Fields starting with `_` (`_title`, `_description`,
          `_snapshot_commit_id`, `_from_title`, `_to_title`) are read-only
          annotations; push ignores them.
        - `status` is read-only context (parents, ingress/egress, counts).

        - `expected_head_commit` is the branch head this document was read at;
        if
          the branch has moved since, push returns 409.
      operationId: get_tree_document_orgs__org_id__nodes__node_id__tree__branch__get
      parameters:
        - name: org_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
            title: Org Id
        - name: node_id
          in: path
          required: true
          schema:
            type: string
            title: Node Id
        - name: branch
          in: path
          required: true
          schema:
            type: string
            title: Branch
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NodeTreeDocument'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    NodeTreeDocument:
      properties:
        expected_head_commit:
          anyOf:
            - type: string
            - type: 'null'
          title: Expected Head Commit
          description: >-
            Branch head this document was read at. Absent when read at a commit:
            that document is read-only.
        message:
          type: string
          title: Message
          description: Commit message; empty until you set one
          default: ''
        state:
          $ref: '#/components/schemas/NodeState'
        status:
          $ref: '#/components/schemas/TreeStatus'
      type: object
      required:
        - state
        - status
      title: NodeTreeDocument
      description: |-
        GET /tree/{branch}. Valid input to PUT /tree/{branch}/push as returned:
        edit `state`, set `message`, send it back. `expected_head_commit` is the
        branch head this document was read at; a stale one is rejected with 409.

        Read at a commit (GET .../commits/{commit_id}/tree) the document is
        read-only: it has no `expected_head_commit`, so push rejects it (422).
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    NodeState:
      properties:
        node:
          $ref: '#/components/schemas/NodeFields'
        tags:
          additionalProperties:
            anyOf:
              - $ref: '#/components/schemas/TagValue'
              - type: string
          type: object
          title: NodeStateTags
          description: 'Tag key to value. A bare string is shorthand for {"value": ...}.'
        directories:
          items:
            type: string
          type: array
          title: Directories
        visual_properties:
          items:
            $ref: '#/components/schemas/VisualProperty'
          type: array
          title: Visual Properties
        connections:
          items:
            $ref: '#/components/schemas/Connection'
          type: array
          title: Connections
      additionalProperties: true
      type: object
      required:
        - node
      title: NodeState
      description: |-
        The five sections push stores. Push replaces all of them: an omitted
        section is stored as empty.
    TreeStatus:
      properties:
        node_id:
          type: string
          title: Node Id
        org_id:
          type: string
          title: Org Id
        branch:
          anyOf:
            - type: string
            - type: 'null'
          title: Branch
          description: Branch this document was read from; absent at a commit
        commit_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Commit Id
          description: Commit this document was read at
        created_at:
          anyOf:
            - type: string
            - type: 'null'
          title: Created At
        parents:
          items:
            additionalProperties: true
            type: object
          type: array
          title: Parents
          description: Nodes whose canvas contains this node (read from main)
        ingress:
          items:
            additionalProperties: true
            type: object
          type: array
          title: Ingress
          description: Connections into this node on its parents' canvases (main)
        egress:
          items:
            additionalProperties: true
            type: object
          type: array
          title: Egress
          description: Connections out of this node on its parents' canvases (main)
        counts:
          $ref: '#/components/schemas/TreeCounts'
      type: object
      required:
        - node_id
        - org_id
        - counts
      title: TreeStatus
      description: Read-only context. Push ignores it.
    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
    NodeFields:
      properties:
        title:
          type: string
          title: Title
          description: Node title
        description:
          type: string
          title: Description
          description: Node description
          default: ''
        metadata:
          additionalProperties: true
          type: object
          title: NodeFieldsMetadata
          description: Free-form node metadata
      additionalProperties: true
      type: object
      required:
        - title
      title: NodeFields
      description: The node's own stored fields.
    TagValue:
      properties:
        value:
          type: string
          title: Value
          description: Tag value
        link:
          anyOf:
            - type: string
            - type: 'null'
          title: Link
          description: Optional URL for the tag
      additionalProperties: true
      type: object
      required:
        - value
      title: TagValue
      description: A tag's value, with an optional link.
    VisualProperty:
      properties:
        child_node_id:
          type: string
          title: Child Node Id
          description: Child node ID
        position_x:
          type: number
          title: Position X
          description: X position
          default: 0
        position_y:
          type: number
          title: Position Y
          description: Y position
          default: 0
        z_index:
          type: integer
          title: Z Index
          description: Stacking order
          default: 0
        width:
          anyOf:
            - type: number
            - type: 'null'
          title: Width
          description: Width
        height:
          anyOf:
            - type: number
            - type: 'null'
          title: Height
          description: Height
        rotation:
          type: number
          title: Rotation
          description: Rotation in degrees
          default: 0
        transparency:
          type: number
          title: Transparency
          description: Opacity, 0.0 to 1.0
          default: 1
        show_border:
          type: boolean
          title: Show Border
          description: Draw the child's border
          default: true
        title_position:
          type: string
          title: Title Position
          description: Where the title is drawn
          default: center
        show_preview:
          type: boolean
          title: Show Preview
          description: Render the child's canvas inside it
          default: false
        _title:
          anyOf:
            - type: string
            - type: 'null'
          title: Title
          description: 'Read-only: the child''s title. Ignored by push.'
        _description:
          anyOf:
            - type: string
            - type: 'null'
          title: Description
          description: 'Read-only: the child''s description. Ignored by push.'
        _snapshot_commit_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Snapshot Commit Id
          description: >-
            Read-only: the child's commit as of this node's last change, used by
            ?resolve_children=snapshot. Server-owned; ignored by push.
      additionalProperties: true
      type: object
      required:
        - child_node_id
      title: VisualProperty
      description: Where a child node sits on this node's canvas.
    Connection:
      properties:
        id:
          type: string
          title: Id
          description: Connection ID
        from_child_id:
          type: string
          title: From Child Id
          description: Source child node ID
        to_child_id:
          type: string
          title: To Child Id
          description: Target child node ID
        from_edge:
          type: string
          title: From Edge
          description: Edge of the source child
          default: center
        to_edge:
          type: string
          title: To Edge
          description: Edge of the target child
          default: center
        style:
          additionalProperties: true
          type: object
          title: ConnectionStyle
          description: Visual style
        label:
          anyOf:
            - type: string
            - type: 'null'
          title: Label
          description: Connection label
        type:
          type: string
          title: Type
          description: Connection type
          default: default
        metadata:
          additionalProperties: true
          type: object
          title: ConnectionMetadata
          description: Free-form connection metadata
        _from_title:
          anyOf:
            - type: string
            - type: 'null'
          title: From Title
          description: 'Read-only: the source child''s title. Ignored by push.'
        _to_title:
          anyOf:
            - type: string
            - type: 'null'
          title: To Title
          description: 'Read-only: the target child''s title. Ignored by push.'
      additionalProperties: true
      type: object
      required:
        - id
        - from_child_id
        - to_child_id
      title: Connection
      description: >-
        A connection between two children on this node's canvas.


        On push, an `id` starting with `temp-` creates a new connection; the
        real

        ID is returned in `connection_id_mappings`.
    TreeCounts:
      properties:
        children:
          type: integer
          title: Children
        connections:
          type: integer
          title: Connections
        parents:
          type: integer
          title: Parents
        ingress:
          type: integer
          title: Ingress
        egress:
          type: integer
          title: Egress
      type: object
      required:
        - children
        - connections
        - parents
        - ingress
        - egress
      title: TreeCounts
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT or yrt_*

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.