# commitFiles

```graphql
mutation CommitFiles($input: CommitFilesInput!) {
  commitFiles(input: $input) {
    success
    versions {
      fileId
      versionId
      path
    }
    conflicts {
      fileId
      path
      error
    }
    problem {
      status
      slug
      detail
    }
  }
}
```

Commit the files. Requires project.files.write.

## Arguments

| Name                      | Type              | Required | Description                                                                   |
| ------------------------- | ----------------- | -------- | ----------------------------------------------------------------------------- |
| `input`                   | CommitFilesInput! | Yes      |                                                                               |
| `input.projectReference`  | String            |          | Project ID or slug. Requires project.files.write.                             |
| `input.fileReferences`    | \[String!]        |          | File paths or UUIDs. Omit/null commits all pending changes; \[] commits none. |
| `input.branchReference`   | String            |          | Branch name or UUID. Omit/null selects main.                                  |
| `input.expectedVersionId` | ID                |          | Expected persisted version UUID; requires exactly one selected file.          |
| `input.expectedVersions`  | JSON              |          | Map from file paths or UUIDs to expected persisted version UUIDs.             |

## Variables

```json
{
  "input": {}
}
```

## Responses

| Status | Description                                  |
| ------ | -------------------------------------------- |
| 200    | The CommitFilesPayload! in data.commitFiles. |

## Call it

```bash
curl -X POST "https://api.veryfront.com/graphql" \
  -H "Authorization: Bearer $VERYFRONT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "query": "mutation CommitFiles($input: CommitFilesInput!) {\n  commitFiles(input: $input) {\n    success\n    versions {\n      fileId\n      versionId\n      path\n    }\n    conflicts {\n      fileId\n      path\n      error\n    }\n    problem {\n      status\n      slug\n      detail\n    }\n  }\n}",
  "variables": {
    "input": {}
  }
}'
```

## Example response

```json
{
  "data": {
    "commitFiles": {
      "success": false,
      "versions": [
        {
          "fileId": "string",
          "versionId": "string",
          "path": "string"
        }
      ],
      "conflicts": [
        {
          "fileId": "string",
          "path": "string",
          "error": "string"
        }
      ],
      "problem": {
        "status": 0,
        "slug": "string",
        "detail": "string"
      }
    }
  }
}
```
