---
title: "searchRepoExtensionFilesAtBranch"
---

> Documentation Index
> Fetch the complete documentation index at: https://buildrforge.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# searchRepoExtensionFilesAtBranch

Path: Forge API › extensions

`POST /repos/{repo_id}/branches/{branch}/extensions/{name}/files/search`

Read the files that ids names with their content, a page at a time, at the branch's working state. Send the same ids again with each page's next_cursor until it is null. An id that names no file of the extension refuses the read.

## Path parameters

- `repo_id` (`searchRepoExtensionFilesAtBranch.path.repo_id`; string, required)
  - pattern: `^repo_[0-7][0-9a-hjkmnp-tv-z]{25}$`
- `branch` (`searchRepoExtensionFilesAtBranch.path.branch`; string, required)
  - minLength: `1`
- `name` (`searchRepoExtensionFilesAtBranch.path.name`; string, required)
  - maxLength: `64` · pattern: `^[a-z0-9]+(?:-[a-z0-9]+)*$`

## Request body

_Required._

- `ids` (`searchRepoExtensionFilesAtBranch.ids`; array of string, required)
  - pattern: `^extension_file_[0-7][0-9a-hjkmnp-tv-z]{25}$`
- `cursor` (`searchRepoExtensionFilesAtBranch.cursor`; string, optional)
  - minLength: `1`

## Example request

```json
{
  "ids": [
    "string"
  ],
  "cursor": "string"
}
```

## Code samples

### cURL

```bash
curl --request POST \
  --url '<base-url>/repos/<repo_id>/branches/<branch>/extensions/<name>/files/search' \
  --header 'Content-Type: application/json' \
  --data '
{
  "ids": [
    "string"
  ],
  "cursor": "string"
}
'
```

### TypeScript

```typescript
const url = '<base-url>/repos/<repo_id>/branches/<branch>/extensions/<name>/files/search';
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json'},
  body: JSON.stringify({ids: ['string'], cursor: 'string'})
};

fetch(url, options)
  .then(res => res.json())
  .then(json => console.log(json))
  .catch(err => console.error(err));
```

### Python

```python
import requests

url = "<base-url>/repos/<repo_id>/branches/<branch>/extensions/<name>/files/search"

payload = {
    "ids": ["string"],
    "cursor": "string"
}
headers = {"Content-Type": "application/json"}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
```

## Responses

### 200

ExtensionFilePage

#### Example

```json
{
  "data": [
    {
      "id": "string",
      "extension_id": "string",
      "path": "string",
      "content": "string",
      "attachment_blob_id": "string",
      "formatted_content": "string",
      "formatting_pending": true
    }
  ],
  "next_cursor": "string"
}
```

- `data` (`searchRepoExtensionFilesAtBranch.response.200.data`; array of object, required)
  - `id` (`searchRepoExtensionFilesAtBranch.response.200.data.id`; string, required)
    - pattern: `^extension_file_[0-7][0-9a-hjkmnp-tv-z]{25}$`
  - `extension_id` (`searchRepoExtensionFilesAtBranch.response.200.data.extension_id`; string, required)
    - pattern: `^extension_[0-7][0-9a-hjkmnp-tv-z]{25}$`
  - `path` (`searchRepoExtensionFilesAtBranch.response.200.data.path`; string, required)
    - maxLength: `256` · pattern: `^(?:[A-Za-z0-9_][A-Za-z0-9._-]*\/)*[A-Za-z0-9_][A-Za-z0-9._-]*$`
  - `content` (`searchRepoExtensionFilesAtBranch.response.200.data.content`; string, required)
  - `attachment_blob_id` (`searchRepoExtensionFilesAtBranch.response.200.data.attachment_blob_id`; any of, required)
    - any of the following: `TypeId`, `null`
  - `formatted_content` (`searchRepoExtensionFilesAtBranch.response.200.data.formatted_content`; any of, required) — The file formatted with Prettier for reading, when that differs from `content`. Forge formats a file shortly after it's written, so this is null until then, and stays null when the file is already formatted, isn't TypeScript, JavaScript or JSON, is over 256 KiB, or doesn't parse. Writes never take it, and builds read only `content`, so edit from `content`.
    - any of the following: `string`, `null`
  - `formatting_pending` (`searchRepoExtensionFilesAtBranch.response.200.data.formatting_pending`; boolean, required) — Whether Forge is still formatting the file: read it again shortly for `formatted_content`. False once it's formatted, or when Forge doesn't format it.
- `next_cursor` (`searchRepoExtensionFilesAtBranch.response.200.next_cursor`; any of, required)
  - any of the following: `PageCursor`, `null`

### 400

InvalidCursor | InvalidRequest | RequestBodyTooDeep

#### Example

```json
{
  "_tag": "InvalidCursor",
  "reason": "string"
}
```

Any of the following:

- `InvalidCursorEncoded`
  - `_tag` (`InvalidCursorEncoded._tag`; string, required)
    - one of `"InvalidCursor"`
  - `reason` (`InvalidCursorEncoded.reason`; string, required)
    - minLength: `1`
- `InvalidRequestEncoded`
  - `_tag` (`InvalidRequestEncoded._tag`; string, required)
    - one of `"InvalidRequest"`
  - `part` (`InvalidRequestEncoded.part`; string, required)
    - one of `"path"`, `"query"`, `"headers"`, `"body"`
  - `issues` (`InvalidRequestEncoded.issues`; array of object, required)
    - `path` (`InvalidRequestEncoded.issues.path`; array\<any of\>, required)
      - any of the following: `string`, `integer`
    - `message` (`InvalidRequestEncoded.issues.message`; string, required)
- `RequestBodyTooDeepEncoded`
  - `_tag` (`RequestBodyTooDeepEncoded._tag`; string, required)
    - one of `"RequestBodyTooDeep"`
  - `max_depth` (`RequestBodyTooDeepEncoded.max_depth`; integer, required)
    - maximum: `9007199254740991` · minimum: `-9007199254740991`

### 401

InvalidCredentials

#### Example

```json
{
  "_tag": "InvalidCredentials"
}
```

- `_tag` (`searchRepoExtensionFilesAtBranch.response.401._tag`; string, required)
  - one of `"InvalidCredentials"`

### 403

Forbidden | ForbiddenOrigin | RequiresPersonalSession | RunBranchRequired

#### Example

```json
{
  "_tag": "Forbidden",
  "message": "string"
}
```

Any of the following:

- `ForbiddenEncoded`
  - `_tag` (`ForbiddenEncoded._tag`; string, required)
    - one of `"Forbidden"`
  - `message` (`ForbiddenEncoded.message`; string, required)
- `ForbiddenOriginEncoded`
  - `_tag` (`ForbiddenOriginEncoded._tag`; string, required)
    - one of `"ForbiddenOrigin"`
- `RequiresPersonalSessionEncoded`
  - `_tag` (`RequiresPersonalSessionEncoded._tag`; string, required)
    - one of `"RequiresPersonalSession"`
- `RunBranchRequiredEncoded`
  - `_tag` (`RunBranchRequiredEncoded._tag`; string, required)
    - one of `"RunBranchRequired"`
  - `branch` (`RunBranchRequiredEncoded.branch`; string, required)
    - minLength: `1`
  - `message` (`RunBranchRequiredEncoded.message`; string, required)

### 404

BranchNotFound | ExtensionNotFound | ExtensionFileNotFound | RepoNotFound

#### Example

```json
{
  "_tag": "BranchNotFound",
  "branch": "string"
}
```

Any of the following:

- `BranchNotFoundEncoded`
  - `_tag` (`BranchNotFoundEncoded._tag`; string, required)
    - one of `"BranchNotFound"`
  - `branch` (`BranchNotFoundEncoded.branch`; string, required)
    - minLength: `1`
- `ExtensionNotFoundEncoded`
  - `_tag` (`ExtensionNotFoundEncoded._tag`; string, required)
    - one of `"ExtensionNotFound"`
  - `extension_name` (`ExtensionNotFoundEncoded.extension_name`; string, required)
    - minLength: `1`
- `ExtensionFileNotFoundEncoded`
  - `_tag` (`ExtensionFileNotFoundEncoded._tag`; string, required)
    - one of `"ExtensionFileNotFound"`
  - `extension_name` (`ExtensionFileNotFoundEncoded.extension_name`; string, required)
    - minLength: `1`
  - `file_id` (`ExtensionFileNotFoundEncoded.file_id`; string, required)
    - pattern: `^[a-z](?:[a-z_]{0,61}[a-z])?_[0-7][0-9a-hjkmnp-tv-z]{25}$`
- `RepoNotFoundEncoded`
  - `_tag` (`RepoNotFoundEncoded._tag`; string, required)
    - one of `"RepoNotFound"`

### 413

RequestBodyTooLarge

#### Example

```json
{
  "_tag": "RequestBodyTooLarge",
  "max_bytes": -9007199254740991
}
```

- `_tag` (`searchRepoExtensionFilesAtBranch.response.413._tag`; string, required)
  - one of `"RequestBodyTooLarge"`
- `max_bytes` (`searchRepoExtensionFilesAtBranch.response.413.max_bytes`; integer, required)
  - maximum: `9007199254740991` · minimum: `-9007199254740991`

### 429

RateLimited

#### Example

```json
{
  "_tag": "RateLimited"
}
```

- `_tag` (`searchRepoExtensionFilesAtBranch.response.429._tag`; string, required)
  - one of `"RateLimited"`

### 500

RepoFailure

#### Example

```json
{
  "_tag": "RepoFailure",
  "reason": "string"
}
```

- `_tag` (`searchRepoExtensionFilesAtBranch.response.500._tag`; string, required)
  - one of `"RepoFailure"`
- `reason` (`searchRepoExtensionFilesAtBranch.response.500.reason`; string, required)

### 503

SessionUnavailable | RateLimitUnavailable

#### Example

```json
{
  "_tag": "SessionUnavailable"
}
```

Any of the following:

- `SessionUnavailableEncoded`
  - `_tag` (`SessionUnavailableEncoded._tag`; string, required)
    - one of `"SessionUnavailable"`
- `RateLimitUnavailableEncoded`
  - `_tag` (`RateLimitUnavailableEncoded._tag`; string, required)
    - one of `"RateLimitUnavailable"`


Source: https://buildrforge.com/docs/api/search-repo-extension-files-at-branch/index.md
