---
title: "getRepoExtensionFileAtCommit"
---

> 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.

# getRepoExtensionFileAtCommit

Path: Forge API › extensions

`GET /repos/{repo_id}/commits/{commit_id}/extensions/{name}/files/{file_id}`

Read one extension file with its content as written and the copy Forge formatted for reading.

## Path parameters

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

## Code samples

### cURL

```bash
curl --request GET \
  --url '<base-url>/repos/<repo_id>/commits/<commit_id>/extensions/<name>/files/<file_id>'
```

### TypeScript

```typescript
const url = '<base-url>/repos/<repo_id>/commits/<commit_id>/extensions/<name>/files/<file_id>';
const options = {method: 'GET'};

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>/commits/<commit_id>/extensions/<name>/files/<file_id>"

response = requests.get(url)

print(response.text)
```

## Responses

### 200

ExtensionFile

#### Example

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

- `id` (`getRepoExtensionFileAtCommit.response.200.id`; string, required)
  - pattern: `^extension_file_[0-7][0-9a-hjkmnp-tv-z]{25}$`
- `extension_id` (`getRepoExtensionFileAtCommit.response.200.extension_id`; string, required)
  - pattern: `^extension_[0-7][0-9a-hjkmnp-tv-z]{25}$`
- `path` (`getRepoExtensionFileAtCommit.response.200.path`; string, required)
  - maxLength: `256` · pattern: `^(?:[A-Za-z0-9_][A-Za-z0-9._-]*\/)*[A-Za-z0-9_][A-Za-z0-9._-]*$`
- `content` (`getRepoExtensionFileAtCommit.response.200.content`; string, required)
- `attachment_blob_id` (`getRepoExtensionFileAtCommit.response.200.attachment_blob_id`; any of, required)
  - any of the following: `TypeId`, `null`
- `formatted_content` (`getRepoExtensionFileAtCommit.response.200.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` (`getRepoExtensionFileAtCommit.response.200.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.

### 400

InvalidRequest

#### Example

```json
{
  "_tag": "InvalidRequest",
  "part": "path",
  "issues": [
    {
      "path": [
        "string"
      ],
      "message": "string"
    }
  ]
}
```

- `_tag` (`getRepoExtensionFileAtCommit.response.400._tag`; string, required)
  - one of `"InvalidRequest"`
- `part` (`getRepoExtensionFileAtCommit.response.400.part`; string, required)
  - one of `"path"`, `"query"`, `"headers"`, `"body"`
- `issues` (`getRepoExtensionFileAtCommit.response.400.issues`; array of object, required)
  - `path` (`getRepoExtensionFileAtCommit.response.400.issues.path`; array\<any of\>, required)
    - any of the following: `string`, `integer`
  - `message` (`getRepoExtensionFileAtCommit.response.400.issues.message`; string, required)

### 401

InvalidCredentials

#### Example

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

- `_tag` (`getRepoExtensionFileAtCommit.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

CommitNotFound | ExtensionNotFound | ExtensionFileNotFound | RepoNotFound

#### Example

```json
{
  "_tag": "CommitNotFound",
  "commit_id": "string"
}
```

Any of the following:

- `CommitNotFoundEncoded`
  - `_tag` (`CommitNotFoundEncoded._tag`; string, required)
    - one of `"CommitNotFound"`
  - `commit_id` (`CommitNotFoundEncoded.commit_id`; string, required)
    - pattern: `^commit_[0-7][0-9a-hjkmnp-tv-z]{25}$`
- `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"`

### 429

RateLimited

#### Example

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

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

### 500

RepoFailure

#### Example

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

- `_tag` (`getRepoExtensionFileAtCommit.response.500._tag`; string, required)
  - one of `"RepoFailure"`
- `reason` (`getRepoExtensionFileAtCommit.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/get-repo-extension-file-at-commit/index.md
