# fileDiff

```graphql
query FileDiff($input: FileDiffInput!) {
  fileDiff(input: $input) {
    path
    diff
    additions
    deletions
  }
}
```

Return file diff. Requires project.files.read.

## Arguments

| Name                 | Type           | Required | Description                                                                 |
| -------------------- | -------------- | -------- | --------------------------------------------------------------------------- |
| `input`              | FileDiffInput! | Yes      |                                                                             |
| `input.filePath`     | String!        | Yes      |                                                                             |
| `input.ref`          | String         |          | Main, branch:<name-or-id>, release:<version>, or env:<name>. Omit for main. |
| `input.branch`       | String         |          |                                                                             |
| `input.branchId`     | String         |          |                                                                             |
| `input.sourceRef`    | String         |          | Source version ID; required except branch diffs, which default to main.     |
| `input.contextLines` | Int            |          | Surrounding diff context lines, 0..10 (default: 3).                         |

## Variables

```json
{
  "input": {
    "filePath": "string"
  }
}
```

## Responses

| Status | Description                            |
| ------ | -------------------------------------- |
| 200    | The FileDiffPayload! in data.fileDiff. |

## Call it

```bash
curl -X POST "https://api.veryfront.com/graphql" \
  -H "Authorization: Bearer $VERYFRONT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "query": "query FileDiff($input: FileDiffInput!) {\n  fileDiff(input: $input) {\n    path\n    diff\n    additions\n    deletions\n  }\n}",
  "variables": {
    "input": {
      "filePath": "string"
    }
  }
}'
```

## Example response

```json
{
  "data": {
    "fileDiff": {
      "path": "string",
      "diff": "string",
      "additions": 0,
      "deletions": 0
    }
  }
}
```
