# fileTextSearch

```graphql
query FileTextSearch($input: FileTextSearchInput!) {
  fileTextSearch(input: $input) {
    data {
      path
      versionId
    }
    totalMatches
  }
}
```

Search file text. Requires project.files.read.

## Arguments

| Name                     | Type                 | Required | Description                                                                                   |
| ------------------------ | -------------------- | -------- | --------------------------------------------------------------------------------------------- |
| `input`                  | FileTextSearchInput! | Yes      |                                                                                               |
| `input.projectReference` | String               |          | Project UUID, slug or configured domain. Omit it to use the project of the request.           |
| `input.ref`              | String               |          | Content to search: main, branch:<name-or-id>, release:<version> or env:<name>. Omit for main. |
| `input.query`            | String!              | Yes      | Literal text to find, or a regular expression when isRegex is true.                           |
| `input.pattern`          | String               |          | File path pattern, for example *.tsx or pages/*.                                              |
| `input.isRegex`          | Boolean              |          | Read query as a regular expression (default false).                                           |
| `input.caseSensitive`    | Boolean              |          | Match letter case exactly (default false).                                                    |
| `input.limit`            | Int                  |          | Largest number of matching files, 1 to 100 (default 50). It limits files, not matching lines. |

## Variables

```json
{
  "input": {
    "query": "string"
  }
}
```

## Responses

| Status | Description                                       |
| ------ | ------------------------------------------------- |
| 200    | The FileTextSearchResult! in data.fileTextSearch. |

## Call it

```bash
curl -X POST "https://api.veryfront.com/graphql" \
  -H "Authorization: Bearer $VERYFRONT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "query": "query FileTextSearch($input: FileTextSearchInput!) {\n  fileTextSearch(input: $input) {\n    data {\n      path\n      versionId\n    }\n    totalMatches\n  }\n}",
  "variables": {
    "input": {
      "query": "string"
    }
  }
}'
```

## Example response

```json
{
  "data": {
    "fileTextSearch": {
      "data": [
        {
          "path": "string",
          "versionId": "string"
        }
      ],
      "totalMatches": 0
    }
  }
}
```
