# POST /v1/workspaces/{workspace_id}/fs/_/grep - Search files

Source: <https://everruns.com/docs/api/operations/grep_files/>

POST

/v1/workspaces/{workspace\_id}/fs/\_/grep

Select code samplecURL (shell:curl)

```js
const url = 'https://app.everruns.com/api/v1/workspaces/example/fs/_/grep';
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json'},
  body: '{"path_pattern":"example","pattern":"example"}'
};


try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```sh
curl --request POST \
  --url https://app.everruns.com/api/v1/workspaces/example/fs/_/grep \
  --header 'Content-Type: application/json' \
  --data '{ "path_pattern": "example", "pattern": "example" }'
```

* Production APIapp.everruns.com/api/v1/workspaces/{workspace\_id}/fs/\_/grep

## Parameters

### Path Parameters

**workspace\_id**

required

string

Workspace ID (wsp\_<32-hex>)

## Request Bodyrequired

Media typeapplication/json

object

**path\_pattern**

Optional path glob (`**/*.rs`, `docs/*.md`).

string | null

**pattern**

required

Regex pattern to search for.

string

##### Examplegenerated

```json
{
  "path_pattern": "example",
  "pattern": "example"
}
```

## Responses

### 200

Search results

Media typeapplication/json

Response wrapper for list endpoints. All list endpoints return responses wrapped in a `data` field.

object

**data**

required

Array of items returned by the list operation.

Array\<object>

Grep result for a file

object

**matches**

required

Array\<object>

Grep match result

object

**line**

required

string

**line\_number**

required

integer

**path**

required

string

**path**

required

string

##### Examplegenerated

```json
{
  "data": [
    {
      "matches": [
        {
          "line": "example",
          "line_number": 1,
          "path": "example"
        }
      ],
      "path": "example"
    }
  ]
}
```

### 400

Invalid regex pattern

### 500

Internal server error