# commitDraftContent

```graphql
mutation CommitDraftContent($input: CommitDraftContentInput!) {
  commitDraftContent(input: $input) {
    success
    entityId
    entityType
    bodyLength
    updatedAt
    versionId
  }
}
```

Commit draft content. Requires project.files.write.

## Arguments

| Name                      | Type                     | Required | Description                                                                          |
| ------------------------- | ------------------------ | -------- | ------------------------------------------------------------------------------------ |
| `input`                   | CommitDraftContentInput! | Yes      |                                                                                      |
| `input.projectReference`  | String                   |          |                                                                                      |
| `input.entityId`          | ID!                      | Yes      | Source-file path or UUID to commit to one immutable content version.                 |
| `input.entityType`        | DraftEntityType!         | Yes      | One of `page`, `component`, `function`, `virtual_file`.                              |
| `input.branchId`          | ID                       |          |                                                                                      |
| `input.expectedVersionId` | ID                       |          | Expected persisted version UUID. Stale preconditions are GraphQL concurrency errors. |

## Variables

```json
{
  "input": {
    "entityId": "string",
    "entityType": "page"
  }
}
```

## Responses

| Status | Description                                                |
| ------ | ---------------------------------------------------------- |
| 200    | The CommitDraftContentPayload! in data.commitDraftContent. |

## 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 CommitDraftContent($input: CommitDraftContentInput!) {\n  commitDraftContent(input: $input) {\n    success\n    entityId\n    entityType\n    bodyLength\n    updatedAt\n    versionId\n  }\n}",
  "variables": {
    "input": {
      "entityId": "string",
      "entityType": "page"
    }
  }
}'
```

## Example response

```json
{
  "data": {
    "commitDraftContent": {
      "success": false,
      "entityId": "string",
      "entityType": "page",
      "bodyLength": 0,
      "updatedAt": "2026-01-01T00:00:00Z",
      "versionId": "string"
    }
  }
}
```
