{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/safetyculture/json-schema/safetyculture-s12-directory-v1-search-folders-request-schema.json",
  "title": "SearchFoldersRequest",
  "description": "The parameters for `SearchFoldersRequest`",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/safetyculture-directory-sites-api-openapi.yml#/components/schemas/s12.directory.v1.SearchFoldersRequest",
  "type": "object",
  "properties": {
    "query": {
      "type": "string",
      "description": "Optional. The search value to query folders with when provided. When not\nprovided, either all of the organisations folders or users folders will be\nreturned in a paginated way"
    },
    "order_by": {
      "description": "The order in which folders are sorted.",
      "allOf": [
        {
          "$ref": "#/$defs/s12.directory.v1.FoldersOrderBy"
        }
      ]
    },
    "filters": {
      "type": "array",
      "items": {
        "type": "object",
        "$ref": "#/$defs/s12.directory.v1.FoldersFilter"
      },
      "description": "Optional. Filters to apply when getting folders. Used for only returning\nfolders that match the filter setting. i.e. only returning meta_label\n'location'. Maximum of 1000 filters allowed."
    },
    "only_assigned_folders": {
      "type": "boolean",
      "description": "When true, SearchFolders will only return folders that are assigned to\nthe user making the request. Defaults to false"
    },
    "only_leaf_nodes": {
      "type": "boolean",
      "description": "When true, SearchFolders will only search location folders. Defaults to false."
    },
    "include_members_count": {
      "type": "boolean",
      "description": "Whether to return the directly associated members\ncount with the folders. Defaults to false."
    },
    "include_folders_count": {
      "type": "boolean",
      "description": "Whether to return the total number of folders discovered\nin the query. Defaults to false"
    },
    "include_deleted_folders": {
      "type": "boolean",
      "description": "Whether to return both deleted and non-deleted folders. Defaults to false"
    },
    "limit": {
      "type": "integer",
      "format": "int32",
      "description": "The number of results to be returned. maximum 1500, default 500"
    },
    "page_token": {
      "type": "string",
      "description": "The offset used for pagination. The starting number for the next query"
    },
    "ignore_folders_disabled": {
      "type": "boolean",
      "description": "Optional. When true, folders will still be returned when disabled for the\norganisation"
    },
    "domain": {
      "type": "string",
      "description": "domain represents the type/domain/hierarchy for the folder. This is used\nfor getting folders of a certain domain, i.e. getting all `template`\nfolders or `site` folders"
    }
  },
  "$defs": {
    "s12.directory.v1.FoldersFilter": {
      "type": "object",
      "properties": {
        "not": {
          "type": "boolean",
          "description": "If true, exclude results that match the condition"
        },
        "meta_label": {
          "type": "string",
          "description": "Filter on the status"
        },
        "folder_id": {
          "type": "string",
          "description": "Filter on a specific folder id"
        },
        "is_dynamic": {
          "type": "boolean",
          "description": "Filter on whether a folder is dynamic or not"
        }
      },
      "description": "FoldersFilter represents a filter when getting folders",
      "title": "FoldersFilter"
    },
    "s12.directory.v1.FoldersOrderBy": {
      "type": "object",
      "properties": {
        "sort_field": {
          "allOf": [
            {
              "$ref": "#/$defs/s12.directory.v1.FoldersOrderBy.SortField"
            }
          ],
          "description": "The field to order by"
        },
        "sort_order": {
          "allOf": [
            {
              "$ref": "#/$defs/s12.directory.v1.FoldersOrderBy.SortOrder"
            }
          ],
          "description": "The direction to order by"
        }
      },
      "description": "FoldersOrderBy represents the sort order folders will be returned in",
      "title": "FoldersOrderBy"
    },
    "s12.directory.v1.FoldersOrderBy.SortField": {
      "type": "string",
      "enum": [
        "SORT_FIELD_UNSPECIFIED",
        "SORT_FIELD_NAME",
        "SORT_FIELD_FOLDER_ID",
        "SORT_FIELD_USER_ID",
        "SORT_FIELD_CREATED_AT",
        "SORT_FIELD_MODIFIED_AT"
      ],
      "default": "SORT_FIELD_UNSPECIFIED",
      "title": "- SORT_FIELD_UNSPECIFIED: The sort field is unspecified\n - SORT_FIELD_NAME: Sort the folder by name\n - SORT_FIELD_FOLDER_ID: Sort the folders by folder id\n - SORT_FIELD_USER_ID: Sort the folders by user id\n - SORT_FIELD_CREATED_AT: Sort the folders by created at\n - SORT_FIELD_MODIFIED_AT: Sort the folders by modified at"
    },
    "s12.directory.v1.FoldersOrderBy.SortOrder": {
      "type": "string",
      "enum": [
        "SORT_ORDER_UNSPECIFIED",
        "SORT_ORDER_ASCENDING",
        "SORT_ORDER_DESCENDING"
      ],
      "default": "SORT_ORDER_UNSPECIFIED",
      "title": "- SORT_ORDER_UNSPECIFIED: The sort order is not specified\n - SORT_ORDER_ASCENDING: The sort order is asc\n - SORT_ORDER_DESCENDING: The sort order is desc"
    }
  }
}