---
title: "Fuzzy search for files and folders"
method: POST
path: "/fuzzy-search/files"
tags: ["Files"]
---

# Fuzzy search for files and folders

`POST /fuzzy-search/files`

Performs fuzzy matching on file and folder paths within specified directories.
Returns matches sorted by relevance with character-level highlighting information.

Respects .gitignore by default. Search completes within 5 seconds or returns
partial results with timeout error.

## Request body

- FuzzySearchFilesRequest
  - `query` string, required — Fuzzy search pattern
  - `paths` string[], required — Directory paths to search within
  - `limit` integer — Maximum number of results to return
  - `filesOnly` boolean — Return only files, exclude directories
  - `respectGitignore` boolean — Filter out files/folders matching .gitignore patterns

## Response `200`

Search completed successfully

- FuzzySearchFilesResponse
  - `results` FileMatch[], required — Matched files/folders sorted by relevance
    - `path` string, required — Absolute path to matched file or folder
    - `displayPath` string, required — Relative path for display (relative to first search path if applicable)
    - `score` integer, required — Match quality score (higher is better)
    - `matchedIndexes` integer[], required — Character positions of matched query characters
    - `isDirectory` boolean, required — True if this is a directory, false for files
  - `metadata` SearchMetadata, required
    - `totalScanned` integer, required — Total number of files/folders scanned
    - `totalMatches` integer, required — Total matches found before applying limit
    - `durationMs` integer, required — Search duration in milliseconds
    - `timedOut` boolean, required — True if search was terminated due to timeout

## Other responses

- `400` — Bad request
- `500` — Internal server error

## Changes

- **2025-10-16** `a1c0e134c4c8` — 1 info
  - endpoint added
- **2025-10-16** `6f2ef131e921` — 1 breaking
  - api path removed without deprecation
- **2025-10-08** `4be2968bfaf5` — 1 info
  - endpoint added
- **2025-08-05** `f3a20bfa8bea` — 1 breaking
  - api path removed without deprecation

[Change history](https://skmtc.dev/humanlayer/apis/humanlayer-daemon-rest-api/changes/fuzzy-search/files/post.md)

---

[API](https://skmtc.dev/humanlayer/apis/humanlayer-daemon-rest-api.md) · [All operations](https://skmtc.dev/humanlayer/apis/humanlayer-daemon-rest-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/humanlayer/humanlayer-daemon-rest-api/revisions/02da8cb8aa12/schema)
