# fileVersions

```graphql
query FileVersions($input: FileVersionsInput!) {
  fileVersions(input: $input) {
    data {
      id
      fileId
      path
      type
      createdAt
      createdBy
      sizeBytes
    }
    pageInfo {
      hasNextPage
      hasPreviousPage
      startCursor
      endCursor
    }
  }
}
```

List file versions. Requires project.files.read.

## Arguments

| Name             | Type               | Required | Description                                                              |
| ---------------- | ------------------ | -------- | ------------------------------------------------------------------------ |
| `input`          | FileVersionsInput! | Yes      |                                                                          |
| `input.filePath` | String!            | Yes      |                                                                          |
| `input.ref`      | String             |          | Main or branch:<name-or-id>. Release/environment history is unsupported. |
| `input.branch`   | String             |          | Branch name or ID alias for ref. Supplied aliases must agree.            |
| `input.branchId` | String             |          | Branch UUID alias for ref. Supplied aliases must agree.                  |
| `input.cursor`   | String             |          | Opaque endCursor returned by the preceding page.                         |
| `input.limit`    | Int                |          | Maximum committed versions, 1..100 (default: 20).                        |

## Variables

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

## Responses

| Status | Description                                    |
| ------ | ---------------------------------------------- |
| 200    | The FileVersionsPayload! in data.fileVersions. |

## 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 FileVersions($input: FileVersionsInput!) {\n  fileVersions(input: $input) {\n    data {\n      id\n      fileId\n      path\n      type\n      createdAt\n      createdBy\n      sizeBytes\n    }\n    pageInfo {\n      hasNextPage\n      hasPreviousPage\n      startCursor\n      endCursor\n    }\n  }\n}",
  "variables": {
    "input": {
      "filePath": "string"
    }
  }
}'
```

## Example response

```json
{
  "data": {
    "fileVersions": {
      "data": [
        {
          "id": "string",
          "fileId": "string",
          "path": "string",
          "type": "string",
          "createdAt": "string",
          "createdBy": "string",
          "sizeBytes": 0
        }
      ],
      "pageInfo": {
        "hasNextPage": false,
        "hasPreviousPage": false,
        "startCursor": "string",
        "endCursor": "string"
      }
    }
  }
}
```
