# deleteFile

```graphql
mutation DeleteFile($input: DeleteFileInput!) {
  deleteFile(input: $input) {
    ok
  }
}
```

Delete a file. Requires project.files.write; API keys also need delete scope.

## Arguments

| Name                      | Type             | Required | Description                                                                                                                                                                                                                                                              |
| ------------------------- | ---------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `input`                   | DeleteFileInput! | Yes      |                                                                                                                                                                                                                                                                          |
| `input.filePath`          | String!          | Yes      | File path whose deletion appends a deletion version in main or the selected branch; immutable history remains. URL-encode this path when supplied in a REST URL.                                                                                                         |
| `input.expectedVersionId` | String           |          | Optional optimistic-concurrency guard: the delete is rejected before any mutation when the file's current version no longer matches.                                                                                                                                     |
| `input.ref`               | String           |          | Canonical content selector: main, branch:<name-or-id>, release:<version> or env:<name>. An unresolvable reference is rejected; it never falls back to main. A release or environment is read-only, so a write addressed to one is refused rather than applied elsewhere. |
| `input.branchId`          | String           |          | Legacy alias for ref=branch:<value>. Supplying both is accepted when they name the same content and rejected when they do not.                                                                                                                                           |

## Variables

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

## Responses

| Status | Description                               |
| ------ | ----------------------------------------- |
| 200    | The DeleteFilePayload in data.deleteFile. |

## 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 DeleteFile($input: DeleteFileInput!) {\n  deleteFile(input: $input) {\n    ok\n  }\n}",
  "variables": {
    "input": {
      "filePath": "string"
    }
  }
}'
```

## Example response

```json
{
  "data": {
    "deleteFile": {
      "ok": false
    }
  }
}
```
