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

# List Departements as a tree

> List all departments as a tree.
Remark: first node is always empty and represents the starting point 
of the tree as multiple departments might be set to the highest level. 



## OpenAPI

````yaml /openapi-specs/organization-v3.yaml get /api/v3/departments/tree
openapi: 3.1.0
info:
  title: Organization structure API
  version: '1.0'
  description: |
    Welcome on the documentation for the Organization Structure API
  contact:
    name: API Support
    url: https://support.lucca.fr
    email: contact@luccasoftware.com
  license:
    name: Unlicensed
    url: https://www.luccasoftware.com
servers:
  - url: https://{host}
    description: Your Lucca account URL.
    variables:
      host:
        default: example.ilucca.net
        description: >-
          The URL of your dedicated Lucca account: `{account}.{env}.{region}`.


          Account reflects your company name. Env indicates the environment.
          Region depends on your server location.


          **Please, use your test or sandbox environments (and not your
          production env.) for testing purposes.**


          Environments:

          - `ilucca`: production environment for customers.

          - `ilucca-test`: test environment for customers.

          - `ilucca-demo`: demo environment for prospects.


          Regions:

          - `.ch` for Swiss located accounts.

          - `.net` for the others.


          Regarding sandboxes, the pattern differs:
          `https://{account}-{sandboxName}.sandbox.{server}.luccasoftware.com`,
          where:

          - `{sandboxName}` is automatically generated upon creation.

          - `{server}` may be "eu1", "eu2" or "ch1".
security: []
tags:
  - name: Legal-Units
    description: Structure > Legal-units
  - name: Establishments
    description: Structure > Establishments
  - name: Departments
    description: Structure > Departments
  - name: Axis-sections
    description: Structure > Axes & Axis-sections
paths:
  /api/v3/departments/tree:
    parameters:
      - $ref: '#/components/parameters/Authorization'
    get:
      tags:
        - Departments
      summary: List Departements as a tree
      description: |-
        List all departments as a tree.
        Remark: first node is always empty and represents the starting point 
        of the tree as multiple departments might be set to the highest level. 
      operationId: get-api-v3-departments-tree
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: object
                    properties:
                      node:
                        type: 'null'
                        description: Root department. Always null.
                      children:
                        type:
                          - array
                          - 'null'
                        description: 'Max depth: 9 levels'
                        items:
                          $ref: '#/components/schemas/DepartmentTreeNode'
        '400':
          $ref: '#/components/responses/Error'
        '401':
          $ref: '#/components/responses/Error'
        '500':
          description: Internal Server Error
      deprecated: true
components:
  parameters:
    Authorization:
      name: Authorization
      required: true
      description: 'API key. Value must be formatted like so: `lucca application={api_key}`.'
      in: header
      schema:
        type: string
  schemas:
    DepartmentTreeNode:
      title: IDepartment
      type: object
      properties:
        node:
          type: object
          properties:
            id:
              type: integer
              description: Department id
            name:
              type: string
              maxLength: 255
              minLength: 1
              description: Department name
            url:
              type: string
              format: uri
              description: Department URL
        children:
          type:
            - array
            - 'null'
          items:
            type: object
          description: List of DepartmentTreeNode objects
  responses:
    Error:
      description: Generique error message response
      content:
        application/json:
          schema:
            type: object
            properties:
              Status:
                type: integer
              Message:
                type: string
            x-examples:
              example-1:
                Status: 404
                Message: Resource Department with ID 13651 not found

````