# Search file text

```http
POST /projects/{project_reference}/files/search
```

Search file text. Requires project.files.read.

## Parameters

| Name                | In   | Required | Description                                                |
| ------------------- | ---- | -------- | ---------------------------------------------------------- |
| `project_reference` | path | Yes      | Project slug, UUID, or domain that identifies the project. |

## Request body

| Field            | Type    | Required | Description                                                                                                                                    |
| ---------------- | ------- | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------- |
| `query`          | string  | Yes      | Search query (text or regex pattern) across textual project files. Matches contain only the matching line; surrounding context is unsupported. |
| `pattern`        | string  |          | File path pattern filter (for example, \*.tsx).                                                                                                |
| `is_regex`       | boolean |          | Treat query as regex (default: false)                                                                                                          |
| `case_sensitive` | boolean |          | Case sensitive search (default: false)                                                                                                         |
| `limit`          | integer |          | Maximum matching files, from 1 to 100 (default: 50). Limits files, not lines.                                                                  |
| `max_results`    | integer |          | Earlier spelling of limit. Maximum matching files, from 1 to 100 (default: 50). Limits files, not lines.                                       |
| `maxResults`     | integer |          | Compatibility alias for max\_results. Maximum matching files, from 1 to 100 (default: 50). Limits files, not lines.                            |

## Responses

| Status | Description                                                                             |
| ------ | --------------------------------------------------------------------------------------- |
| 200    | Search results.                                                                         |
| 400    | Invalid query, regex, or limit; unsupported input fields; or conflicting limit aliases. |
| 401    | Unauthorized                                                                            |
| 403    | Forbidden - insufficient permissions                                                    |
| 404    | Not found                                                                               |
| 500    | Server error                                                                            |
