# Replace pending file draft

```http
PUT /projects/{project_reference}/branches/{branchName}/files/{filePath}/draft
```

Replace pending file draft. Requires project.files.write.

## Parameters

| Name                | In   | Required | Description                                                |
| ------------------- | ---- | -------- | ---------------------------------------------------------- |
| `project_reference` | path | Yes      | Project slug, UUID, or domain that identifies the project. |
| `branchName`        | path | Yes      |                                                            |
| `filePath`          | path | Yes      |                                                            |

## Request body

| Field                    | Type         | Required | Description                                                                                                                                                                 |
| ------------------------ | ------------ | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `content`                | string       | Yes      | Full pending source-file body; empty strings are valid. Saves durable Yjs repair without creating an immutable version. Identical bodies retain the pending draft sequence. |
| `expected_draft_version` | integer,null |          | Observed pending draft sequence; zero means no prior draft. Separate from commit expected-version IDs. Omit for unconditional replacement; a stale sequence returns 409.    |

## Responses

| Status | Description             |
| ------ | ----------------------- |
| 200    | Persisted pending draft |
| 400    | Bad request             |
| 401    | Unauthorized            |
| 403    | Forbidden               |
| 404    | Not found               |
| 409    | Conflict                |
| 500    | Server error            |
