---
title: "Search folders"
method: POST
path: "/directory/v1/folders/search"
tags: ["Directory (Sites)"]
---

# Search folders

`POST /directory/v1/folders/search`

## Request body

- S12DirectoryV1SearchFoldersRequest — The parameters for `SearchFoldersRequest`
  - `query` string — Optional. The search value to query folders with when provided. When not provided, either all of the organisations folders or users folders will be returned in a paginated way
  - `order_by` S12DirectoryV1FoldersOrderBy — FoldersOrderBy represents the sort order folders will be returned in
    - `sort_field` 'SORT_FIELD_UNSPECIFIED' | 'SORT_FIELD_NAME' | 'SORT_FIELD_FOLDER_ID' | 'SORT_FIELD_USER_ID' | 'SORT_FIELD_CREATED_AT' | 'SORT_FIELD_MODIFIED_AT'
    - `sort_order` 'SORT_ORDER_UNSPECIFIED' | 'SORT_ORDER_ASCENDING' | 'SORT_ORDER_DESCENDING'
  - `filters` S12DirectoryV1FoldersFilter[] — Optional. Filters to apply when getting folders. Used for only returning folders that match the filter setting. i.e. only returning meta_label 'location'. Maximum of 1000 filters allowed.
    - `not` boolean — If true, exclude results that match the condition
    - `meta_label` string — Filter on the status
    - `folder_id` string — Filter on a specific folder id
    - `is_dynamic` boolean — Filter on whether a folder is dynamic or not
  - `only_assigned_folders` boolean — When true, SearchFolders will only return folders that are assigned to the user making the request. Defaults to false
  - `only_leaf_nodes` boolean — When true, SearchFolders will only search location folders. Defaults to false.
  - `include_members_count` boolean — Whether to return the directly associated members count with the folders. Defaults to false.
  - `include_folders_count` boolean — Whether to return the total number of folders discovered in the query. Defaults to false
  - `include_deleted_folders` boolean — Whether to return both deleted and non-deleted folders. Defaults to false
  - `limit` integer — The number of results to be returned. maximum 1500, default 500
  - `page_token` string — The offset used for pagination. The starting number for the next query
  - `ignore_folders_disabled` boolean — Optional. When true, folders will still be returned when disabled for the organisation
  - `domain` string — domain represents the type/domain/hierarchy for the folder. This is used for getting folders of a certain domain, i.e. getting all `template` folders or `site` folders

## Response `200`

A successful response.

- S12DirectoryV1SearchFoldersResponse — Result returned from `SearchFoldersResponse`
  - `folders` S12DirectoryV1FolderWithAncestors[] — An array of folders with their ancestors that match the search results
    - `folder` S12DirectoryV1Folder — Folder represents the main directory object
      - `id` string — An unique identifier for the folder. Must be a valid UUID. For example: '00001d65-d336-485a-8331-7b53f37e8f51'
      - `name` string — Name associated with folder
      - `org_id` string — The organisation that the folder belongs to
      - `creator_id` string — The user id responsible for creating the folder For example: 'user_5441fffcde344415bb7ccaceda27e196'
      - `created_at` string, date-time — The creation timestamp of the folder (Date, Time, Timezone) For example: '2020-04-28T04:14:31:00Z'
      - `modified_at` string, date-time — The timestamp of the last modification for the folder (Date, Time, Timezone) For example: '2020-04-28T04:14:00Z'
      - `meta_label` string — Additional meta information that can be associated with the folder e.g. 'location'
      - `members_count` integer — The number of users with a direct association of type 'MEMBER' for the folder
      - `deleted` boolean — Whether a folder has been marked as deleted or not.
    - `ancestors` S12DirectoryV1Folder[] — The folders ancestors. For example, when returning a `location` leaf node, the ancestors will be the [`area`,`region`] folders, when applicable
      - `id` string — An unique identifier for the folder. Must be a valid UUID. For example: '00001d65-d336-485a-8331-7b53f37e8f51'
      - `name` string — Name associated with folder
      - `org_id` string — The organisation that the folder belongs to
      - `creator_id` string — The user id responsible for creating the folder For example: 'user_5441fffcde344415bb7ccaceda27e196'
      - `created_at` string, date-time — The creation timestamp of the folder (Date, Time, Timezone) For example: '2020-04-28T04:14:31:00Z'
      - `modified_at` string, date-time — The timestamp of the last modification for the folder (Date, Time, Timezone) For example: '2020-04-28T04:14:00Z'
      - `meta_label` string — Additional meta information that can be associated with the folder e.g. 'location'
      - `members_count` integer — The number of users with a direct association of type 'MEMBER' for the folder
      - `deleted` boolean — Whether a folder has been marked as deleted or not.
    - `members_count` integer — Members count are the count of active users associated with the folder.
    - `has_children` boolean — Whether the folder has children or not
  - `folder_count` integer — The total number of folders found for the search query
  - `next_page_token` string — Optional. base64 encoded. If this field is present, the value should be used in subsequent calls to SearchFolders to get the next page of results. Otherwise, no further calls should be made.
  - `folders_enabled` boolean — Whether or not the org settings setting is enabled.

## Other responses

- `default` — An unexpected error response.

---

[API](https://skmtc.net/safetyculture/apis/safetyculture-api.md) · [All operations](https://skmtc.net/safetyculture/apis/safetyculture-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/safetyculture/safetyculture-api/revisions/5be91df61ded/schema)
