# Get branch file diff

```http
GET /projects/{project_reference}/branches/{branchName}/files/{filePath}/diff
```

Return branch file diff. Requires project.read.

## Parameters

| Name                | In    | Required | Description                                                |
| ------------------- | ----- | -------- | ---------------------------------------------------------- |
| `project_reference` | path  | Yes      | Project slug, UUID, or domain that identifies the project. |
| `branchName`        | path  | Yes      |                                                            |
| `filePath`          | path  | Yes      |                                                            |
| `source_ref`        | query |          | Source version ID to compare from (default: main branch)   |
| `context_lines`     | query |          | Context lines (default: 3)                                 |

## Responses

| Status | Description                                                                 |
| ------ | --------------------------------------------------------------------------- |
| 200    | Unified diff in git-compatible format.                                      |
| 400    | Invalid request parameters; context\_lines must be an integer from 0 to 10. |
| 401    | Unauthorized                                                                |
| 403    | Restricted server-function source or insufficient permissions               |
| 404    | Not found                                                                   |
| 500    | Server error                                                                |
