# Commit files

```http
POST /projects/{project_reference}/commit
```

Commit the files. Requires project.files.write.

## Parameters

| Name                | In   | Required | Description |
| ------------------- | ---- | -------- | ----------- |
| `project_reference` | path | Yes      |             |

## Request body

| Field                 | Type   | Required | Description                                                                                                                                                                     |
| --------------------- | ------ | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `file_ids`            | array  |          | Legacy alias of file\_references. Conflicting alias values return 400.                                                                                                          |
| `file_references`     | array  |          | Paths or legacy file UUIDs whose pending edits, deletions and renames are committed. Files commit independently: a conflict may leave other files committed.                    |
| `branch_reference`    | string |          | Branch whose pending changes are committed; defaults to main.                                                                                                                   |
| `expected_version_id` | string |          | Expected persisted version for a single file. A stale version returns 409; reread and retry only conflicted files.                                                              |
| `expected_versions`   | object |          | Expected persisted version per file. A stale version returns 409, with committed versions and conflicted files in the Problem response. Reread and retry only conflicted files. |

## Responses

| Status | Description              |
| ------ | ------------------------ |
| 200    | Committed file versions. |
| 400    | Bad request              |
| 401    | Unauthorized             |
| 403    | Forbidden                |
| 404    | Not found                |
| 409    | Conflict                 |
| 500    | Server error             |
