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

# Get project tree

> Auto-acquires a Design Engine instance, then returns a flat tree of project objects.



## OpenAPI

````yaml /openapi/davinci-public.v2.yaml get /api/v2/programmatic/projects/{projectId}/tree
openapi: 3.1.0
info:
  title: Davinci Public API
  version: 2.0.0
  description: >-
    Public Routing Server API contract for Davinci integrations and official
    SDKs.
servers:
  - url: https://davinci-app.com
    description: Production
security:
  - ApiKeyBearer: []
tags:
  - name: Meta
    description: API metadata and health checks.
  - name: Projects
    description: Read project metadata, trees, objects, and attached files.
paths:
  /api/v2/programmatic/projects/{projectId}/tree:
    get:
      tags:
        - Projects
      summary: Get project tree
      description: >-
        Auto-acquires a Design Engine instance, then returns a flat tree of
        project objects.
      operationId: getProjectTree
      parameters:
        - $ref: '#/components/parameters/ProjectId'
        - $ref: '#/components/parameters/Branch'
      responses:
        '200':
          description: Project tree.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProjectTreeEnvelope'
        '401':
          $ref: '#/components/responses/InvalidApiKey'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/ProjectNotFound'
        '429':
          $ref: '#/components/responses/RateLimited'
        '500':
          $ref: '#/components/responses/InternalError'
        '503':
          description: >-
            Project acquisition unavailable. Common error codes include
            `PROJECT_NOT_READY`, `SERVICE_UNAVAILABLE`, and
            `SERVER_NOT_AVAILABLE`.
          headers:
            Retry-After:
              schema:
                type: integer
                minimum: 1
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
      security:
        - ApiKeyBearer: []
      x-codeSamples:
        - lang: typescript
          label: TypeScript SDK
          source: >
            import { DavinciClient } from '@celedon/davinci-sdk';


            const client = new DavinciClient({
              apiKey: process.env.DAVINCI_API_KEY!,
            });


            const tree = await client.projects.getTree('project-id', { branch:
            'main' });

            console.log(tree.tree.length);
        - lang: python
          label: Python SDK
          source: |
            import os
            from davinci_sdk import DavinciClient

            with DavinciClient(api_key=os.environ["DAVINCI_API_KEY"]) as client:
                tree = client.projects.get_tree("project-id", branch="main")
                print(len(tree.tree))
components:
  parameters:
    ProjectId:
      name: projectId
      in: path
      required: true
      schema:
        type: string
        minLength: 1
      description: Project id. May be compound in the form `{projectId}--{branchName}`.
    Branch:
      name: branch
      in: query
      required: false
      schema:
        type: string
        default: main
  schemas:
    ProjectTreeEnvelope:
      allOf:
        - $ref: '#/components/schemas/SuccessEnvelope'
        - type: object
          properties:
            data:
              $ref: '#/components/schemas/ProjectTree'
    ErrorEnvelope:
      type: object
      required:
        - success
        - error
      properties:
        success:
          type: boolean
        error:
          type: object
          required:
            - code
            - message
          properties:
            code:
              type: string
            message:
              type: string
            details:
              type: object
              additionalProperties: true
          additionalProperties: true
      additionalProperties: true
    SuccessEnvelope:
      type: object
      required:
        - success
        - data
      properties:
        success:
          type: boolean
        data: {}
      additionalProperties: true
    ProjectTree:
      type: object
      required:
        - tree
      properties:
        objectCount:
          type: integer
          minimum: 0
        tree:
          type: array
          items:
            $ref: '#/components/schemas/TreeNode'
      additionalProperties: true
    TreeNode:
      type: object
      required:
        - id
        - name
        - type
        - parent
      properties:
        id:
          type: string
        name:
          type: string
        type:
          type: string
        parent:
          type: string
        childrenCount:
          type: integer
          minimum: 0
      additionalProperties: true
  responses:
    InvalidApiKey:
      description: Missing, invalid, expired, or inactive API key.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
    Forbidden:
      description: Caller is authenticated but not authorized.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
    ProjectNotFound:
      description: Project does not exist or is hidden from the caller.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
    RateLimited:
      description: API key request rate exceeded.
      headers:
        Retry-After:
          schema:
            type: integer
            minimum: 1
          description: Seconds to wait before retrying.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
    InternalError:
      description: Unexpected server error.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
  securitySchemes:
    ApiKeyBearer:
      type: http
      scheme: bearer
      bearerFormat: dav_ak_live_... or dav_ak_test_...
      x-default: dav_ak_live_your_token
      description: >-
        Personal access token. Programmatic reads require the projects:read
        scope.

````