---
title: "getRepoDiff"
---

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

# getRepoDiff

Path: Forge API › diffs

`GET /repos/{repo_id}/diffs`

A page of the records that differ between base and head, in record id order across models. Pass next_cursor back as cursor with the same base, head, and model. A branch side reads its working state as of each page's request, so to read a diff that holds still across pages, diff two commits.

## Path parameters

- `repo_id` (`getRepoDiff.path.repo_id`; string, required)
  - pattern: `^repo_[0-7][0-9a-hjkmnp-tv-z]{25}$`

## Query parameters

- `base_branch` (`getRepoDiff.query.base_branch`; string, optional)
  - minLength: `1`
- `base_commit_id` (`getRepoDiff.query.base_commit_id`; string, optional)
  - pattern: `^commit_[0-7][0-9a-hjkmnp-tv-z]{25}$`
- `head_branch` (`getRepoDiff.query.head_branch`; string, optional)
  - minLength: `1`
- `head_commit_id` (`getRepoDiff.query.head_commit_id`; string, optional)
  - pattern: `^commit_[0-7][0-9a-hjkmnp-tv-z]{25}$`
- `cursor` (`getRepoDiff.query.cursor`; string, optional)
  - minLength: `1`
- `limit` (`getRepoDiff.query.limit`; string, optional)
  - pattern: `^[+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:[Ee][+-]?\d+)?$`
- `model` (`getRepoDiff.query.model`; string, optional)
  - minLength: `1`

## Code samples

### cURL

```bash
curl --request GET \
  --url '<base-url>/repos/<repo_id>/diffs'
```

### TypeScript

```typescript
const url = '<base-url>/repos/<repo_id>/diffs';
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>/diffs"

response = requests.get(url)

print(response.text)
```

## Responses

### 200

Success

#### Example

```json
{
  "data": [
    {
      "model": "string",
      "record_id": "string",
      "change": "added",
      "previous": {},
      "current": {},
      "changed_fields": [
        "string"
      ]
    }
  ],
  "next_cursor": "string"
}
```

- `data` (`getRepoDiff.response.200.data`; array of object, required)
  - `model` (`getRepoDiff.response.200.data.model`; string, required)
    - minLength: `1`
  - `record_id` (`getRepoDiff.response.200.data.record_id`; string, required)
    - pattern: `^[a-z](?:[a-z_]{0,61}[a-z])?_[0-7][0-9a-hjkmnp-tv-z]{25}$`
  - `change` (`getRepoDiff.response.200.data.change`; string, required)
    - one of `"added"`, `"modified"`, `"removed"`
  - `previous` (`getRepoDiff.response.200.data.previous`; any of, required)
    - any of the following: `object`, `null`
  - `current` (`getRepoDiff.response.200.data.current`; any of, required)
    - any of the following: `object`, `null`
  - `changed_fields` (`getRepoDiff.response.200.data.changed_fields`; array of string, required)
    - minLength: `1`
- `next_cursor` (`getRepoDiff.response.200.next_cursor`; any of, required)
  - any of the following: `PageCursor`, `null`

### 400

InvalidCursor | InvalidRequest

#### 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)

### 401

InvalidCredentials

#### Example

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

- `_tag` (`getRepoDiff.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 | CommitNotFound | 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`
- `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}$`
- `RepoNotFoundEncoded`
  - `_tag` (`RepoNotFoundEncoded._tag`; string, required)
    - one of `"RepoNotFound"`

### 429

RateLimited

#### Example

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

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

### 500

RepoFailure

#### Example

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

- `_tag` (`getRepoDiff.response.500._tag`; string, required)
  - one of `"RepoFailure"`
- `reason` (`getRepoDiff.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-diff/index.md
