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

# Get all directories

> Retrieve all directories (folders) in the workspace with hierarchical structure.

This endpoint returns a paginated list of directories including their nested subfolders. Each directory includes breadcrumb navigation for easy hierarchy tracking.

Query Parameters:

- page (optional): Page number for pagination (default: 1)

- limit (optional): Number of items per page (default: 10)

Response:

The response includes:
- directories: Array of directory objects with nested subfolders

- count: Total number of directories

- currentPage: Current page number

Retrieve all directories (folders) in the workspace with hierarchical structure. This endpoint returns a paginated list of directories including their nested subfolders with breadcrumb navigation for easy hierarchy tracking.

## Use Cases

<CardGroup cols={2}>
  <Card title="Folder Management" icon="folder-tree">
    Browse and manage your workspace folder structure programmatically
  </Card>

  <Card title="File Organization" icon="sitemap">
    Understand folder hierarchy for automated file routing and organization
  </Card>

  <Card title="Navigation Systems" icon="map">
    Build custom navigation interfaces with breadcrumb support
  </Card>

  <Card title="Automation Rules" icon="robot">
    Identify folders created by automation rules for workflow tracking
  </Card>
</CardGroup>

## Query Parameters

| Parameter | Type   | Required | Default     | Description                      |
| --------- | ------ | -------- | ----------- | -------------------------------- |
| page      | number | No       | 1           | Page number for pagination       |
| limit     | number | No       | 100         | Number of items per page         |
| sortBy    | string | No       | `createdAt` | Field to sort by                 |
| sortOrder | string | No       | `ASC`       | Sort direction (`ASC` or `DESC`) |

## Response Structure

### Directory Object

Each directory object contains:

| Field               | Type    | Description                                     |
| ------------------- | ------- | ----------------------------------------------- |
| id                  | string  | Unique directory identifier                     |
| name                | string  | Directory name                                  |
| description         | string  | Directory description                           |
| status              | string  | Directory status (e.g., "active")               |
| parentId            | string  | Parent directory ID (null for root directories) |
| depth               | number  | Depth level in hierarchy (0 for root)           |
| metadata            | object  | User, organization, and workspace IDs           |
| isFromAutomatedRule | boolean | Whether directory was created by automation     |
| breadcrumbs         | array   | Full path from root to current directory        |
| subfolders          | array   | Nested subdirectories (recursive structure)     |
| createdAt           | string  | ISO 8601 timestamp of creation                  |
| updatedAt           | string  | ISO 8601 timestamp of last update               |

## Understanding the Hierarchy

<AccordionGroup>
  <Accordion title="Depth Levels" icon="layer-group">
    The `depth` field indicates how deep a folder is in the hierarchy:

    * `depth: 0` - Root level folders
    * `depth: 1` - First level subfolders
    * `depth: 2` - Second level subfolders, and so on
  </Accordion>

  <Accordion title="Breadcrumbs Navigation" icon="arrow-right">
    The `breadcrumbs` array provides the complete path from root to the current directory:

    ```json theme={null}
    "breadcrumbs": [
      { "id": "root-id", "name": "Parent Folder" },
      { "id": "child-id", "name": "Child Folder" },
      { "id": "current-id", "name": "Current Folder" }
    ]
    ```
  </Accordion>

  <Accordion title="Recursive Subfolders" icon="folder-tree">
    The `subfolders` array contains nested directories recursively. Each subfolder has the same structure as the parent directory, allowing you to traverse the entire hierarchy.
  </Accordion>

  <Accordion title="Automated Folders" icon="robot">
    Folders created by automation rules are marked with `isFromAutomatedRule: true`. This helps distinguish manually created folders from those generated by workflow automation.
  </Accordion>
</AccordionGroup>


## OpenAPI

````yaml get /prod/v1/directories
openapi: 3.0.0
info:
  title: Public API
  description: >-

    ### Welcome to fileAI’s Public API Documentation.

    This API allows users to check the health of the system, upload and manage
    files, and manage AI Schemas.

    Should you have any questions, please reach out to fileAI via the “Contact a
    Developer” link below.



    [Contact a Developer](mailto:support@file.ai)



    ### Prerequisites


    Before using our API, please ensure you complete the following prerequisites

    - You must have a fileAI account. Sign up or login
    [here](https://orion.file.ai/en/sign-up)

    - You must have an API Key. After creating your fileAI account, you can
    generate your API Key. Refer to the Authentication section below for more
    details.



    ### Authentication

    All API requests require an API key for authentication.

    - To obtain your API key, please log in to your fileAI account and navigate
    to Project Settings in your dashboard

    - Keep your API key secure and do not share it publicly.


    ![Authentication](https://fileai-static-assets.s3.us-west-2.amazonaws.com/public-api-service/authentication.png)


    ### How to Use Your API Key

    Once you have your API key:

    - Click the Authorize button on the top-right of this page

    - Enter your API Key under Value

    - Click Authorize to start making authenticated requests directly from the
    documentation


    ![How to Use Your API
    Key](https://fileai-static-assets.s3.us-west-2.amazonaws.com/public-api-service/how-to-use-api-keys.png)
        
  version: '1.0'
  contact: {}
servers:
  - url: https://api.orion.file.ai
security: []
tags:
  - name: Public API V1
paths:
  /prod/v1/directories:
    get:
      tags:
        - Public API V1
      summary: Get all directories
      description: >-
        Retrieve all directories (folders) in the workspace with hierarchical
        structure.


        This endpoint returns a paginated list of directories including their
        nested subfolders. Each directory includes breadcrumb navigation for
        easy hierarchy tracking.


        Query Parameters:


        - page (optional): Page number for pagination (default: 1)


        - limit (optional): Number of items per page (default: 10)


        Response:


        The response includes:

        - directories: Array of directory objects with nested subfolders


        - count: Total number of directories


        - currentPage: Current page number
      operationId: PublicAPIController_getAllDirectories
      parameters:
        - name: page
          required: false
          in: query
          description: Page number
          schema:
            default: 1
            example: 1
            type: number
        - name: limit
          required: false
          in: query
          description: Number of items per page
          schema:
            default: 100
            example: 100
            type: number
        - name: sortBy
          required: false
          in: query
          description: Field to sort by
          schema:
            default: createdAt
            example: createdAt
            type: string
        - name: sortOrder
          required: false
          in: query
          description: Sort direction
          schema:
            default: ASC
            example: ASC
            enum:
              - ASC
              - DESC
            type: string
      responses:
        '200':
          description: The directories are retrieved
          content:
            application/json:
              example:
                directories:
                  - id: 68e4a80a0e79a0744ac72943
                    name: Smart folder 4
                    description: Smart folder 4
                    status: active
                    createdAt: '2025-10-07T05:41:30.472Z'
                    updatedAt: '2025-10-07T05:41:30.472Z'
                    depth: 0
                    metadata:
                      userId: 68e387848a36d1dd65fa064e
                      organizationId: 68e387848a36d1dd65fa0653
                      workspaceId: 68e387848a36d1dd65fa064f
                    isFromAutomatedRule: false
                    breadcrumbs:
                      - id: 68e4a80a0e79a0744ac72943
                        name: Smart folder 4
                    subfolders: []
                  - id: 68e4a79e0e79a0744ac7293d
                    name: Smart folder 3
                    description: Smart folder 3
                    status: active
                    createdAt: '2025-10-07T05:39:42.819Z'
                    updatedAt: '2025-10-07T05:39:42.819Z'
                    depth: 0
                    metadata:
                      userId: 68e387848a36d1dd65fa064e
                      organizationId: 68e387848a36d1dd65fa0653
                      workspaceId: 68e387848a36d1dd65fa064f
                    isFromAutomatedRule: false
                    breadcrumbs:
                      - id: 68e4a79e0e79a0744ac7293d
                        name: Smart folder 3
                    subfolders:
                      - id: 68e4a8060e79a0744ac72941
                        name: Smart folder 4
                        description: Smart folder 4
                        status: active
                        createdAt: '2025-10-07T05:41:26.853Z'
                        updatedAt: '2025-10-07T05:41:26.853Z'
                        parentId: 68e4a79e0e79a0744ac7293d
                        depth: 1
                        metadata:
                          userId: 68e387848a36d1dd65fa064e
                          organizationId: 68e387848a36d1dd65fa0653
                          workspaceId: 68e387848a36d1dd65fa064f
                        isFromAutomatedRule: false
                        breadcrumbs:
                          - id: 68e4a79e0e79a0744ac7293d
                            name: Smart folder 3
                          - id: 68e4a8060e79a0744ac72941
                            name: Smart folder 4
                        subfolders: []
                count: 4
                currentPage: 1
              schema:
                type: object
                properties:
                  directories:
                    type: array
                    items:
                      type: object
                      properties:
                        id:
                          type: string
                        name:
                          type: string
                        description:
                          type: string
                        status:
                          type: string
                        parentId:
                          type: string
                          nullable: true
                        depth:
                          type: number
                        metadata:
                          type: object
                          properties:
                            userId:
                              type: string
                            organizationId:
                              type: string
                            workspaceId:
                              type: string
                        isFromAutomatedRule:
                          type: boolean
                        breadcrumbs:
                          type: array
                          items:
                            type: object
                            properties:
                              id:
                                type: string
                              name:
                                type: string
                        subfolders:
                          type: array
                          items:
                            type: object
                        createdAt:
                          type: string
                          format: date-time
                        updatedAt:
                          type: string
                          format: date-time
                  count:
                    type: number
                  currentPage:
                    type: number
        '401':
          description: Invalid API key | API key is missing
          content:
            application/json:
              example:
                message: Invalid API key | API key is missing
                error: Unauthorized
                statusCode: 401
              schema:
                type: object
                properties:
                  message:
                    type: string
                  error:
                    type: string
                  statusCode:
                    type: number
        '429':
          description: Too Many Requests
          content:
            application/json:
              example:
                statusCode: 429
                message: Too Many Requests
              schema:
                type: object
                properties:
                  statusCode:
                    type: number
                  message:
                    type: string
      security:
        - x-api-key: []
components:
  securitySchemes:
    x-api-key:
      type: apiKey
      in: header
      name: x-api-key
      description: API key for authentication

````