---
title: "GitHub API: Repository Compare Files | Perceptlayer"
description: "Repository Compare Files from GitHub as JSON. 1 credit per successful call."
url: https://perceptlayer.com/apis/github/repository-compare-files
---

[APIs](https://perceptlayer.com/apis) / [GitHub](https://perceptlayer.com/apis/github) / Repository Compare Files

# GitHub: Repository Compare Files

Repository Compare Files from GitHub as JSON. 1 credit per successful call.

GET `/v1/github/repository-compare-files`

## Parameters

Send parameters in the query string.

| Parameter | Type | Required | Allowed values |
| --- | --- | --- | --- |
| `owner` | string | Required | Up to 39 characters |
| `repo` | string | Required | Up to 100 characters |
| `base` | string | Required | Up to 255 characters |
| `head` | string | Required | Up to 255 characters |

## Example request

GitHub

GET /v1/github/repository-compare-files?owner=laravel&repo=framework&base=12.x&head=13.x 

```
{
  "search_parameters": {
    "engine": "github_compare_files",
    "owner": "laravel",
    "repo": "framework",
    "base": "12.x",
    "head": "13.x"
  },
  "repository": "laravel/framework",
  "range": "12.x...13.x",
  "files": [
    {
      "path": ".agents/resume",
      "additions": 0,
      "deletions": 0,
      "lines": [
        "@@ -0,0 +1,7 @@",
        "#!/usr/bin/env bash",
        "set -euo pipefail"
      ]
    },
    {
      "path": ".agents/setup",
      "additions": 0,
      "deletions": 0,
      "lines": [
        "@@ -0,0 +1,86 @@",
        "#!/usr/bin/env bash",
        "set -euo pipefail"
      ]
    },
    {
      "path": ".amp/services.yaml",
      "additions": 0,
      "deletions": 0,
      "lines": [
        "@@ -0,0 +1,7 @@",
        "services:",
        "redis:"
      ]
    }
  ],
  "file_count": 8
}
```

200 OK JSON X-Credits-Used: 1

Recorded 12 Nov 2026 and shortened.

[Run this endpoint in the playground](https://perceptlayer.com/apis/github?try=repository-compare-files#playground) with your own parameters. 1 credit per successful call; failed calls are free.

## Response fields

The response has these 5 fields, read from a recorded call. The recording leaves out fields that were empty, so a live call can return more.

| Field | Type |
| --- | --- |
| `search_parameters` | object |
| `repository` | string |
| `range` | string |
| `files` | object\[\] |
| `file_count` | integer |
