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

# Get Folders

Use this API to retrieve the given folder's metadata and its subfolders.

<Warning>
  Prior to using this API, you must:

  * Enable advanced queries option in [the console](https://console.velt.dev/dashboard/config/appconfig)
  * Deploy v4 series of the Velt SDK.
</Warning>

# Endpoint

`POST https://api.velt.dev/v1/organizations/folders/get`

# Headers

<ParamField header="x-velt-api-key" type="string" required>
  Your API key.
</ParamField>

<ParamField header="x-velt-auth-token" type="string" required>
  Your [Auth Token](/security/auth-tokens).
</ParamField>

# Body

#### Params

<ParamField body="data" type="object" required>
  <Expandable title="properties">
    <ParamField body="organizationId" type="string" required>
      Organization ID
    </ParamField>

    <ParamField body="folderId" type="string">
      Folder ID to retrieve a specific folder and its subfolders. If not provided, all folders in the organization will be retrieved.
    </ParamField>
  </Expandable>
</ParamField>

## **Example Requests**

#### 1. Get all folders in organization

```JSON theme={null}
{
  "data": {
    "organizationId": "yourOrganizationId"
  }
}
```

#### 2. Get specific folder in an organization

```JSON theme={null}
{
  "data": {
    "organizationId": "yourOrganizationId",
    "folderId": "yourFolderId"
  }
}
```

# Response

#### Success Response for All Folders

```JSON theme={null}
{
  "result": {
    "status": "success",
    "message": "Folders retrieved successfully.",
    "data": [
      {
        "folderId": "folderId1",
        "folderName": "Folder 1",
        "organizationId": "yourOrganizationId",
        "parentFolderId": "root",
        "createdAt": 1738695615706,
        "lastUpdated": 1738696287859
      },
      {
        "folderId": "folderId2",
        "folderName": "Folder 2",
        "organizationId": "yourOrganizationId",
        "parentFolderId": "root",
        "createdAt": 1738695077691,
        "lastUpdated": 1738695077691
      }
    ]
  }
}
```

#### Success Response for Specific Folder

```JSON theme={null}
{
  "result": {
    "status": "success",
    "message": "Folders retrieved successfully.",
    "data": [
      {
        "folderId": "folderId1",
        "folderName": "Folder 1",
        "organizationId": "yourOrganizationId",
        "parentFolderId": "root",
        "createdAt": 1738695077691,
        "lastUpdated": 1738695077691,
        "subFolders": [
          {
            "folderId": "childFolderId1",
            "folderName": "Child Folder 1",
            "organizationId": "yourOrganizationId",
            "parentFolderId": "folderId1",
            "createdAt": 1738695615706,
            "lastUpdated": 1738698727591
          }
        ]
      }
    ]
  }
}
```

#### Failure Response

```JSON theme={null}
{
  "error": {
    "message": "ERROR_MESSAGE",
    "status": "INVALID_ARGUMENT"
  }
}
```

<ResponseExample>
  ```js theme={null}
  {
    "result": {
      "status": "success",
      "message": "Folders retrieved successfully.",
      "data": [
        {
          "folderId": "folderId1",
          "folderName": "Folder 1",
          "organizationId": "yourOrganizationId",
          "parentFolderId": "root",
          "createdAt": 1738695077691,
          "lastUpdated": 1738695077691,
          "subFolders": [
            {
              "folderId": "childFolderId1",
              "folderName": "Child Folder 1",
              "organizationId": "yourOrganizationId",
              "parentFolderId": "folderId1",
              "createdAt": 1738695615706,
              "lastUpdated": 1738698727591
            }
          ]
        }
      ]
    }
  }
  ```
</ResponseExample>
